Skip to content

Commit

Permalink
Bypass flags checks for Notification constrctors
Browse files Browse the repository at this point in the history
Close #98 #96 as fixed.
In the decomplied smali files, the method `load_overrides_systemui`
of the class `FeatureFlagsImpl` is called only if its field
`systemui_is_cached` is false.
  • Loading branch information
JingMatrix committed Nov 22, 2024
1 parent 5da38f6 commit 1b98e55
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions daemon/src/main/java/org/lsposed/lspd/service/ServiceManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.lsposed.daemon.BuildConfig;

import java.io.File;
import java.lang.Class;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand Down Expand Up @@ -151,6 +152,9 @@ public static void start(String[] args) {

ConfigFileManager.reloadConfiguration();

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM)
notificationWorkaround();

BridgeService.send(mainService, new BridgeService.Listener() {
@Override
public void onSystemServerRestarted() {
Expand Down Expand Up @@ -237,6 +241,18 @@ private static void permissionManagerWorkaround() {
}
}

private static void notificationWorkaround() {
try {
Class feature = Class.forName("android.app.FeatureFlagsImpl");
Field systemui_is_cached = feature.getDeclaredField("systemui_is_cached");
systemui_is_cached.setAccessible(true);
systemui_is_cached.set(null, true);
Log.d(TAG, "set flag systemui_is_cached to true");
} catch (Throwable e) {
Log.e(TAG, "failed to change feature flags", e);
}
}

private static class BinderProxy extends Binder {
private static final Method rawGetService;

Expand Down

0 comments on commit 1b98e55

Please sign in to comment.