Skip to content

Commit 7d69dbc

Browse files
committed
Fix crash and sync
1 parent 941726d commit 7d69dbc

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

manager/src/main/java/org/lsposed/lspatch/manager/ManagerService.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ object ManagerService : ILSPApplicationService.Stub() {
1515

1616
private const val TAG = "ManagerService"
1717

18-
override fun getLegacyModulesList(): MutableList<Module> {
19-
TODO("Not yet implemented")
20-
}
21-
22-
override fun getModulesList(): List<Module> {
18+
override fun getLegacyModulesList(): List<Module> {
2319
val app = lspApp.packageManager.getNameForUid(Binder.getCallingUid())
2420
val list = app?.let {
2521
runBlocking { ConfigManager.getModuleFilesForApp(it) }
2622
}.orEmpty()
27-
Log.d(TAG, "$app calls getModulesList: $list")
23+
Log.d(TAG, "$app calls getLegacyModulesList: $list")
2824
return list
2925
}
3026

27+
override fun getModulesList(): List<Module> {
28+
return emptyList()
29+
}
30+
3131
override fun getPrefsPath(packageName: String): String {
3232
TODO("Not yet implemented")
3333
}

patch-loader/src/main/java/org/lsposed/lspatch/loader/LSPApplication.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ public static void onLoad() throws RemoteException, IOException {
8585
}
8686

8787
disableProfile(context);
88-
Startup.initXposed(false, ActivityThread.currentProcessName(), ActivityThread.currentApplication().getPackageCodePath(), service);
89-
Log.i(TAG, "Bootstrap Xposed");
88+
Startup.initXposed(false, ActivityThread.currentProcessName(), context.getApplicationInfo().dataDir, service);
9089
Startup.bootstrapXposed();
9190
// WARN: Since it uses `XResource`, the following class should not be initialized
9291
// before forkPostCommon is invoke. Otherwise, you will get failure of XResources

patch-loader/src/main/java/org/lsposed/lspatch/service/LocalApplicationService.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ public LocalApplicationService(Context context) {
5858
}
5959

6060
@Override
61-
public List<Module> getLegacyModulesList() throws RemoteException {
62-
return null;
61+
public List<Module> getLegacyModulesList() {
62+
return modules;
6363
}
6464

6565
@Override
6666
public List<Module> getModulesList() {
67-
return modules;
67+
return new ArrayList<>();
6868
}
6969

7070
@Override
@@ -76,4 +76,9 @@ public String getPrefsPath(String packageName) {
7676
public ParcelFileDescriptor requestInjectedManagerBinder(List<IBinder> binder) {
7777
return null;
7878
}
79+
80+
@Override
81+
public IBinder asBinder() {
82+
return this;
83+
}
7984
}

patch-loader/src/main/java/org/lsposed/lspatch/service/RemoteApplicationService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class RemoteApplicationService implements ILSPApplicationService {
3434
private static final String TAG = "LSPatch";
3535
private static final String MODULE_SERVICE = Constants.MANAGER_PACKAGE_NAME + ".manager.ModuleService";
3636

37-
private ILSPApplicationService service;
37+
private volatile ILSPApplicationService service;
3838

3939
@SuppressLint("DiscouragedPrivateApi")
4040
public RemoteApplicationService(Context context) throws RemoteException {
@@ -48,8 +48,8 @@ public RemoteApplicationService(Context context) throws RemoteException {
4848
@Override
4949
public void onServiceConnected(ComponentName name, IBinder binder) {
5050
Log.i(TAG, "Manager binder received");
51-
latch.countDown();
5251
service = Stub.asInterface(binder);
52+
latch.countDown();
5353
}
5454

5555
@Override

0 commit comments

Comments
 (0)