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"
override fun getLegacyModulesList(): MutableList<Module> {
TODO("Not yet implemented")
}
override fun getModulesList(): List<Module> {
override fun getLegacyModulesList(): List<Module> {
val app = lspApp.packageManager.getNameForUid(Binder.getCallingUid())
val list = app?.let {
runBlocking { ConfigManager.getModuleFilesForApp(it) }
}.orEmpty()
Log.d(TAG, "$app calls getModulesList: $list")
Log.d(TAG, "$app calls getLegacyModulesList: $list")
return list
}
override fun getModulesList(): List<Module> {
return emptyList()
}
override fun getPrefsPath(packageName: String): String {
TODO("Not yet implemented")
}

View File

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

View File

@ -58,13 +58,13 @@ public class LocalApplicationService extends ILSPApplicationService.Stub {
}
@Override
public List<Module> getLegacyModulesList() throws RemoteException {
return null;
public List<Module> getLegacyModulesList() {
return modules;
}
@Override
public List<Module> getModulesList() {
return modules;
return new ArrayList<>();
}
@Override
@ -76,4 +76,9 @@ public class LocalApplicationService extends ILSPApplicationService.Stub {
public ParcelFileDescriptor requestInjectedManagerBinder(List<IBinder> binder) {
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 MODULE_SERVICE = Constants.MANAGER_PACKAGE_NAME + ".manager.ModuleService";
private ILSPApplicationService service;
private volatile ILSPApplicationService service;
@SuppressLint("DiscouragedPrivateApi")
public RemoteApplicationService(Context context) throws RemoteException {
@ -48,8 +48,8 @@ public class RemoteApplicationService implements ILSPApplicationService {
@Override
public void onServiceConnected(ComponentName name, IBinder binder) {
Log.i(TAG, "Manager binder received");
latch.countDown();
service = Stub.asInterface(binder);
latch.countDown();
}
@Override