From 1b98e55cfc9e6fecdf901ad6435e680de0232c7e Mon Sep 17 00:00:00 2001 From: JingMatrix Date: Fri, 22 Nov 2024 20:30:09 +0100 Subject: [PATCH] Bypass flags checks for Notification constrctors 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. --- .../org/lsposed/lspd/service/ServiceManager.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/daemon/src/main/java/org/lsposed/lspd/service/ServiceManager.java b/daemon/src/main/java/org/lsposed/lspd/service/ServiceManager.java index 1d26901129a..c0d564f065d 100644 --- a/daemon/src/main/java/org/lsposed/lspd/service/ServiceManager.java +++ b/daemon/src/main/java/org/lsposed/lspd/service/ServiceManager.java @@ -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; @@ -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() { @@ -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;