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.
This commit is contained in:
JingMatrix 2024-11-22 20:30:09 +01:00
parent 5da38f60a2
commit 1b98e55cfc
1 changed files with 16 additions and 0 deletions

View File

@ -41,6 +41,7 @@ import com.android.internal.os.BinderInternal;
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 class ServiceManager {
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 @@ public class ServiceManager {
}
}
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;