Fix crash and sync

This commit is contained in:
LoveSy 2023-06-29 10:08:50 +08:00
parent 941726d559
commit 7d69dbcb66
4 changed files with 17 additions and 13 deletions

View File

@ -15,19 +15,19 @@ object ManagerService : ILSPApplicationService.Stub() {
private const val TAG = "ManagerService" private const val TAG = "ManagerService"
override fun getLegacyModulesList(): MutableList<Module> { override fun getLegacyModulesList(): List<Module> {
TODO("Not yet implemented")
}
override fun getModulesList(): List<Module> {
val app = lspApp.packageManager.getNameForUid(Binder.getCallingUid()) val app = lspApp.packageManager.getNameForUid(Binder.getCallingUid())
val list = app?.let { val list = app?.let {
runBlocking { ConfigManager.getModuleFilesForApp(it) } runBlocking { ConfigManager.getModuleFilesForApp(it) }
}.orEmpty() }.orEmpty()
Log.d(TAG, "$app calls getModulesList: $list") Log.d(TAG, "$app calls getLegacyModulesList: $list")
return list return list
} }
override fun getModulesList(): List<Module> {
return emptyList()
}
override fun getPrefsPath(packageName: String): String { override fun getPrefsPath(packageName: String): String {
TODO("Not yet implemented") TODO("Not yet implemented")
} }

View File

@ -85,8 +85,7 @@ public class LSPApplication {
} }
disableProfile(context); disableProfile(context);
Startup.initXposed(false, ActivityThread.currentProcessName(), ActivityThread.currentApplication().getPackageCodePath(), service); Startup.initXposed(false, ActivityThread.currentProcessName(), context.getApplicationInfo().dataDir, service);
Log.i(TAG, "Bootstrap Xposed");
Startup.bootstrapXposed(); Startup.bootstrapXposed();
// WARN: Since it uses `XResource`, the following class should not be initialized // WARN: Since it uses `XResource`, the following class should not be initialized
// before forkPostCommon is invoke. Otherwise, you will get failure of XResources // before forkPostCommon is invoke. Otherwise, you will get failure of XResources

View File

@ -58,13 +58,13 @@ public class LocalApplicationService extends ILSPApplicationService.Stub {
} }
@Override @Override
public List<Module> getLegacyModulesList() throws RemoteException { public List<Module> getLegacyModulesList() {
return null; return modules;
} }
@Override @Override
public List<Module> getModulesList() { public List<Module> getModulesList() {
return modules; return new ArrayList<>();
} }
@Override @Override
@ -76,4 +76,9 @@ public class LocalApplicationService extends ILSPApplicationService.Stub {
public ParcelFileDescriptor requestInjectedManagerBinder(List<IBinder> binder) { public ParcelFileDescriptor requestInjectedManagerBinder(List<IBinder> binder) {
return null; return null;
} }
@Override
public IBinder asBinder() {
return this;
}
} }

View File

@ -34,7 +34,7 @@ public class RemoteApplicationService implements ILSPApplicationService {
private static final String TAG = "LSPatch"; private static final String TAG = "LSPatch";
private static final String MODULE_SERVICE = Constants.MANAGER_PACKAGE_NAME + ".manager.ModuleService"; private static final String MODULE_SERVICE = Constants.MANAGER_PACKAGE_NAME + ".manager.ModuleService";
private ILSPApplicationService service; private volatile ILSPApplicationService service;
@SuppressLint("DiscouragedPrivateApi") @SuppressLint("DiscouragedPrivateApi")
public RemoteApplicationService(Context context) throws RemoteException { public RemoteApplicationService(Context context) throws RemoteException {
@ -48,8 +48,8 @@ public class RemoteApplicationService implements ILSPApplicationService {
@Override @Override
public void onServiceConnected(ComponentName name, IBinder binder) { public void onServiceConnected(ComponentName name, IBinder binder) {
Log.i(TAG, "Manager binder received"); Log.i(TAG, "Manager binder received");
latch.countDown();
service = Stub.asInterface(binder); service = Stub.asInterface(binder);
latch.countDown();
} }
@Override @Override