Skip to content

Commit

Permalink
fix daemon could not post notification after soft reboot (LSPosed#2899)
Browse files Browse the repository at this point in the history
  • Loading branch information
5ec1cff authored Dec 28, 2023
1 parent 58e8fcf commit edecd5c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions daemon/src/main/java/org/lsposed/lspd/service/BridgeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.lsposed.lspd.service.ServiceManager.TAG;

import android.app.ActivityManager;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
Expand Down Expand Up @@ -61,6 +62,20 @@ public void binderDied() {
((Map) sCache).clear();
}
Log.i(TAG, "clear ServiceManager");

//noinspection JavaReflectionMemberAccess DiscouragedPrivateApi
field = ActivityManager.class.getDeclaredField("IActivityManagerSingleton");
field.setAccessible(true);
Object singleton = field.get(null);
if (singleton != null) {
//noinspection PrivateApi DiscouragedPrivateApi
field = Class.forName("android.util.Singleton").getDeclaredField("mInstance");
field.setAccessible(true);
synchronized (singleton) {
field.set(singleton, null);
}
}
Log.i(TAG, "clear ActivityManager");
} catch (Throwable e) {
Log.w(TAG, "clear ServiceManager: " + Log.getStackTraceString(e));
}
Expand Down

0 comments on commit edecd5c

Please sign in to comment.