rovo89 / XposedBridge

The Java part of the Xposed framework.
3.89k stars 1.1k forks source link

Resources NullPointerException #44

Open Mikanoshi opened 9 years ago

Mikanoshi commented 9 years ago

I'm not sure it's Xposed, but can't think about anything else that can cause such error. This crash occurs randomly in different apps, sometimes in SystemUI, sometimes even in system services and it causes boot loop.

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get()' on a null object reference
    at android.app.ResourcesManager.applyConfigurationToResourcesLocked(ResourcesManager.java:293)
    at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:4457)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:155)
    at android.app.ActivityThread.main(ActivityThread.java:5696)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:117)
Mikanoshi commented 9 years ago

Fixed with this hook:

XposedHelpers.findAndHookMethod("android.app.ResourcesManager", null, "applyConfigurationToResourcesLocked", Configuration.class, "android.content.res.CompatibilityInfo", new XC_MethodHook(XCallback.PRIORITY_HIGHEST) {
    @Override
    @SuppressWarnings("unchecked")
    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
        ArrayMap<Object, Object> mActiveResources = (ArrayMap<Object, Object>)XposedHelpers.getObjectField(param.thisObject, "mActiveResources");
        if (mActiveResources.size() == 0) return;
        int cnt = 0;
        do {
            if (mActiveResources.valueAt(cnt) == null)
                mActiveResources.remove(mActiveResources.keyAt(cnt));
            else
                cnt++;
        } while (cnt < mActiveResources.size());
    }
});

Still no idea what causes it :)

kmark commented 9 years ago

Just a heads up, to find the problem a sample of the smallest most concise code possible that can reliably reproduce this bug may be required.

Mikanoshi commented 9 years ago

I cannot reproduce this bug reliably myself, it is random. Configuration is updated during device orientation changes, that is when bootloop happens most of the times.

zommuter commented 9 years ago

I got a similar one, consistently the same on a Huawei P8 lite ALE-L21:

E/AndroidRuntime(10021): *** FATAL EXCEPTION IN SYSTEM PROCESS: main
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.android.server.wm.WindowManagerService.showBootMessage(java.lang.CharSequence, boolean)' on a null object reference
    at com.android.server.am.ActivityManagerService.showBootMessage(ActivityManagerService.java:6822)
    at com.android.server.SystemServer.startOtherServices(SystemServer.java:719)
    at com.android.server.SystemServer.run(SystemServer.java:311)
    at com.android.server.SystemServer.main(SystemServer.java:212)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:115)

which is probably related to the preceding

E/LockPatternUtils(10021): Can't get DevicePolicyManagerService: is it running?
 java.lang.IllegalStateException: Stack trace:
    at com.android.internal.widget.LockPatternUtils.getDevicePolicyManager(LockPatternUtils.java:183)
    at com.android.internal.widget.LockPatternUtils.(LockPatternUtils.java:212)
    at com.android.server.accessibility.AccessibilityManagerService.(AccessibilityManagerService.java:236)
    at com.android.server.SystemServer.startOtherServices(SystemServer.java:681)
    at com.android.server.SystemServer.run(SystemServer.java:311)
    at com.android.server.SystemServer.main(SystemServer.java:212)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:115)
E/HwCustLockPatternUtils(10021): init the HwCustLockPatternUtils failed because mDevicePolicyManager is null

Which suggests the NullPointer is mDevicePolicyManager.

There might also be a problem with this:

I/Xposed  ( 9654): Detected ART runtime
 Found Xposed class de/robv/android/xposed/XposedBridge, now initializing
 Errors during Xposed initialization
 java.lang.ClassCastException: class android.content.res.XResources doesn't extend class android.content.res.HwResources
    at de.robv.android.xposed.XposedBridge.cloneToSubclass(XposedBridge.java:824)
    at de.robv.android.xposed.XposedBridge.hookResources(XposedBridge.java:402)
    at de.robv.android.xposed.XposedBridge.initForZygote(XposedBridge.java:268)
    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:100)

which in turn sounds like #46, but I haven't done anything except flashing xposed-v71-sdk21-arm64.zip yet.

kmark commented 9 years ago

Could you provide a concise code sample that reproduces it?

zommuter commented 9 years ago

What kind of code do you mean? I merely flashed the build provided in the XDA thread via TWRP and captured the boot log with LiveBoot, no code on my part involved.

kmark commented 9 years ago

Gotcha. This is a repository for what is effectively the Xposed API for developers. To report issues with Xposed itself try the Xposed repo.

That was inaccurate (as XposedBridge, especially as of Lollipop, has a good portion of loader code which I managed to forget somehow..). It's good to know now that this issue is in Xposed itself rather than a module or external interaction with XposedBridge.

rovo89 commented 9 years ago

@zommuter Could you please send me a full logcat? I've seen similar cases before, and there was usually a crash in the system services which led to this.

zommuter commented 9 years ago

@rovo89 Sure, here you go: https://gist.githubusercontent.com/zommuter/6d0ae42998f769c16a57/raw/06e2ac5835f69b884473a779bd7708778a94fd57/liveboot_xposed.log

I also tried a short analysis, you can find it here in German: http://www.android-hilfe.de/thema/xposed-beim-p8-lite-installieren.714376/

rovo89 commented 9 years ago

Similar messages where shown on some ROMs before this workaround: https://github.com/rovo89/XposedBridge/commit/01c324454bb0e7eba82ae56895b04fb571ba5073

Maybe a file containing the DevicePolicyManagerService isn't compiled at that time? Unfortunately, it seems that Huawei has removed some logging, so it's harder to see what's going on.

As a first step, you should install XposedInstaller 3.0 while your ROM is still booting and disable the resource APIs in the settings. This will switch off Xposed partly, but not completely as it's done when the ClassCastException is caught. Only then, the workaround above has a chance to be executed.

If we ignore the DevicePolicyManagerService error for now, there's a second one: WindowManagerService is null as well. This indicates that there was an exception before this point: https://github.com/android/platform_frameworks_base/blob/lollipop-release/services/java/com/android/server/SystemServer.java#L473 As the "content" service dies later, but not some of the other services which are started later, this might indeed be a crash while loading the content providers, like on other ROMs.

SettingsProvider.odex is scheduled for recompilation, but this isn't done in time. So once you disable the resources APIs in the settings, either the workaround above might fix it, or we'll need an additonal workaround for the HwPackageManagerService class.

paulobrien commented 9 years ago

I'm getting a boot failure on a Honor 7, also after disabling the UI hooks. Honor is basically Huawei, so the same causes as above I guess.

E/LockPatternUtils( 4631): Can't get DevicePolicyManagerService: is it running? E/LockPatternUtils( 4631): java.lang.IllegalStateException: Stack trace: E/LockPatternUtils( 4631): at com.android.internal.widget.LockPatternUtils.getDevicePolicyManager(LockPatternUtils.java:183) E/LockPatternUtils( 4631): at com.android.internal.widget.LockPatternUtils.<init>(LockPatternUtils.java:212) E/LockPatternUtils( 4631): at com.android.server.accessibility.AccessibilityManagerService.<init>(AccessibilityManagerService.java:236) E/LockPatternUtils( 4631): at com.android.server.SystemServer.startOtherServices(SystemServer.java:683) E/LockPatternUtils( 4631): at com.android.server.SystemServer.run(SystemServer.java:317) E/LockPatternUtils( 4631): at com.android.server.SystemServer.main(SystemServer.java:218) E/LockPatternUtils( 4631): at java.lang.reflect.Method.invoke(Native Method) E/LockPatternUtils( 4631): at java.lang.reflect.Method.invoke(Method.java:372) E/LockPatternUtils( 4631): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960) E/LockPatternUtils( 4631): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) E/LockPatternUtils( 4631): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:115) E/HwCustLockPatternUtils( 4631): init the HwCustLockPatternUtils failed because mDevicePolicyManager is null E/AndroidRuntime( 4631): *** FATAL EXCEPTION IN SYSTEM PROCESS: main E/AndroidRuntime( 4631): java.lang.NullPointerException: Attempt to invoke virtual method 'void com.android.server.wm.WindowManagerService.showBootMessage(java.lang.CharSequence, boolean)' on a null object reference E/AndroidRuntime( 4631): at com.android.server.am.ActivityManagerService.showBootMessage(ActivityManagerService.java:6886) E/AndroidRuntime( 4631): at com.android.server.SystemServer.startOtherServices(SystemServer.java:721) E/AndroidRuntime( 4631): at com.android.server.SystemServer.run(SystemServer.java:317) E/AndroidRuntime( 4631): at com.android.server.SystemServer.main(SystemServer.java:218) E/AndroidRuntime( 4631): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 4631): at java.lang.reflect.Method.invoke(Method.java:372) E/AndroidRuntime( 4631): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960) E/AndroidRuntime( 4631): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) E/AndroidRuntime( 4631): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:115) I/Process ( 4631): Sending signal. PID: 4631 SIG: 9

Anything I can do to help solve this?

Cheers!

P

rovo89 commented 9 years ago

@paulobrien Did you try to disable the resource hooks as I suggested above?

paulobrien commented 9 years ago

Hi!

Yes, I did (using the Xposed APK), I also disabled hwtheme in the device build.prop to see if that would help. No dice sadly.

P

tallavi commented 8 years ago

Hi, Another stack trace, maybe it will help somehow...

Reproducing on HTC m8 using ARHD 43.0 and latest sense toolbox. The sense toolbox is definitely causing it, and 100% of the times it is caused when the device changes orientation to landscape.

10-19 23:27:06.873: E/AndroidRuntime(25202): FATAL EXCEPTION: main 10-19 23:27:06.873: E/AndroidRuntime(25202): Process: com.android.systemui, PID: 25202 10-19 23:27:06.873: E/AndroidRuntime(25202): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get()' on a null object reference 10-19 23:27:06.873: E/AndroidRuntime(25202): at android.app.ResourcesManager.applyConfigurationToResourcesLocked(ResourcesManager.java:293) 10-19 23:27:06.873: E/AndroidRuntime(25202): at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:4457) 10-19 23:27:06.873: E/AndroidRuntime(25202): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482) 10-19 23:27:06.873: E/AndroidRuntime(25202): at android.os.Handler.dispatchMessage(Handler.java:102) 10-19 23:27:06.873: E/AndroidRuntime(25202): at android.os.Looper.loop(Looper.java:155) 10-19 23:27:06.873: E/AndroidRuntime(25202): at android.app.ActivityThread.main(ActivityThread.java:5696) 10-19 23:27:06.873: E/AndroidRuntime(25202): at java.lang.reflect.Method.invoke(Native Method) 10-19 23:27:06.873: E/AndroidRuntime(25202): at java.lang.reflect.Method.invoke(Method.java:372) 10-19 23:27:06.873: E/AndroidRuntime(25202): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028) 10-19 23:27:06.873: E/AndroidRuntime(25202): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823) 10-19 23:27:06.873: E/AndroidRuntime(25202): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:117) 10-19 23:27:06.893: E/ActivityManager(1093): App crashed! Process: com.android.systemui

Mikanoshi commented 8 years ago

@tallavi Use this module, it fixes the crash. Contains my code above. http://mikanoshi.name/share/FixRandomReboot.apk I don't add this to Sense Toolbox because the module itself is not causing the problem directly. Something is wrong with the way Xposed replaces resources.

huweinwu commented 8 years ago

Hi, I also meet the same exception as below, I am not a module for Xposed, just a common apk, How can i slove the problem without dependency Xposed. thanks

jjava.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get()' on a null object reference at android.app.ResourcesManager.applyConfigurationToResourcesLocked(ResourcesManager.java:494) at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:4130) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1431) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5294) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:115)

rovo89 commented 8 years ago

@Mikanoshi Are you saying that with Sense Toolbox, the likelyhood of triggering this bug increases? If so, that might help to find out the root cause. I assume that this is a synchronization problem. Are you modifying ActivityThread/ResourcesManager.mActiveResources yourself? Or do you call AndroidAppHelper.addActiveResource() or XModuleResources.createInstance() rather frequently? Details about these calls would be helpful.

Mikanoshi commented 8 years ago

Stack trace just doesn't have anything that points to a particular module. I don't modify mActiveResources and don't use AndroidAppHelper, createInstance() on the other hand is used in a lot of mods. How frequent is too frequent? :)

If all mods are active, it is called every time toast appears (1 call), incoming caller photo is displayed (2-4 calls), app transitions to or from HTC launcher (1 call), 6 calls for every app detailed page in Apps, every time system theme or accent color changes (1 call), 1 call for every app thumbnail in recents (in AsyncTask), 1 call every second if system monitor mod is active, every time network name changes or when switching to airplane mode (1 call), 2 calls on every heads up notification, 7 calls on home menu popup.

All other calls are single (resource hooking on system start and when user presses something).

bugmenot2 commented 8 years ago

Hello, reading from the logcat i'm having the same issue and that causes random 'freeze and restart during boot process' (bootanimation gets stuck and phone completely restarts itself). Testing it, it's about 3 freezes/ 10 tested boots.

I'm on Xperia Z5 Compact stock rom, MM 6.0.1, latest Xposed framework v86. Disabling resources hook solves the problem (0/10 boot process freezes) but cuts down most of my modules (i prefer let it reboot till a successful boot than cutting down resource replacement). Uninstalling/reinstalling the framework and recreating dalvik cache did not help.

Here's the log:

E/SystemServer( 3633): BOOT FAILURE making display ready
E/SystemServer( 3633): **java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get()' on a null object reference**
E/SystemServer( 3633):  at android.app.ResourcesManager.applyConfigurationToResourcesLocked(ResourcesManager.java:307)
E/SystemServer( 3633):  at android.app.ActivityThread.applyConfigurationToResources(ActivityThread.java:4289)
E/SystemServer( 3633):  at com.android.server.am.ActivityManagerService.updateConfigurationLocked(ActivityManagerService.java:18123)
E/SystemServer( 3633):  at com.android.server.am.ActivityManagerService.updateConfiguration(ActivityManagerService.java:18043)
E/SystemServer( 3633):  at com.android.server.wm.WindowManagerService.displayReady(WindowManagerService.java:7765)
E/SystemServer( 3633):  at com.android.server.SystemServer.startOtherServices(SystemServer.java:613)
E/SystemServer( 3633):  at com.android.server.SystemServer.run(SystemServer.java:281)
E/SystemServer( 3633):  at com.android.server.SystemServer.main(SystemServer.java:179)
E/SystemServer( 3633):  at java.lang.reflect.Method.invoke(Native Method)
E/SystemServer( 3633):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
E/SystemServer( 3633):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
E/SystemServer( 3633):  at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
I/SystemServiceManager( 3633): Starting com.android.server.MountService$Lifecycle
I/SystemServiceManager( 3633): Starting com.android.server.UiModeManagerService
I/ActivityManager( 3633): Config changes=200 {1.0 ?mcc?mnc it_IT ldltr sw360dp w360dp h640dp 320dpi nrml long port -touch -keyb/v/h -nav/h s.3}
D/MountService( 3633): Thinking about reset, mSystemReady=false, mDaemonConnected=true
D/MountService( 3633): Thinking about reset, mSystemReady=false, mDaemonConnected=true
D/CryptdConnector( 3633): SND -> {1 cryptfs getfield SystemLocale}
E/System  ( 3633): ******************************************
E/System  ( 3633): ************ Failure starting system services
E/System  ( 3633): **java.lang.RuntimeException: Failed to start service com.android.server.UiModeManagerService: onStart threw an exception**
E/System  ( 3633):  at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:111)
E/System  ( 3633):  at com.android.server.SystemServer.startOtherServices(SystemServer.java:637)
E/System  ( 3633):  at com.android.server.SystemServer.run(SystemServer.java:281)
E/System  ( 3633):  at com.android.server.SystemServer.main(SystemServer.java:179)
E/System  ( 3633):  at java.lang.reflect.Method.invoke(Native Method)
E/System  ( 3633):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
E/System  ( 3633):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
E/System  ( 3633):  at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
E/System  ( 3633): **Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get()' on a null object reference**
E/System  ( 3633):  at android.app.ResourcesManager.applyConfigurationToResourcesLocked(ResourcesManager.java:307)
E/System  ( 3633):  at android.app.ActivityThread.applyConfigurationToResources(ActivityThread.java:4289)
E/System  ( 3633):  at com.android.server.am.ActivityManagerService.updateConfigurationLocked(ActivityManagerService.java:18123)
E/System  ( 3633):  at com.android.server.am.ActivityManagerService.updateConfiguration(ActivityManagerService.java:18043)
E/System  ( 3633):  at com.android.server.UiModeManagerService.sendConfigurationLocked(UiModeManagerService.java:396)
E/System  ( 3633):  at com.android.server.UiModeManagerService.onStart(UiModeManagerService.java:193)
E/System  ( 3633):  at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:109)
E/System  ( 3633):  ... 7 more
D/AndroidRuntime( 3633): Shutting down VM
--------- beginning of crash
E/AndroidRuntime( 3633): *** FATAL EXCEPTION IN SYSTEM PROCESS: main
E/AndroidRuntime( 3633): java.lang.RuntimeException: Failed to start service com.android.server.UiModeManagerService: onStart threw an exception
E/AndroidRuntime( 3633):    at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:111)
E/AndroidRuntime( 3633):    at com.android.server.SystemServer.startOtherServices(SystemServer.java:637)
E/AndroidRuntime( 3633):    at com.android.server.SystemServer.run(SystemServer.java:281)
E/AndroidRuntime( 3633):    at com.android.server.SystemServer.main(SystemServer.java:179)
E/AndroidRuntime( 3633):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 3633):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
E/AndroidRuntime( 3633):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
E/AndroidRuntime( 3633):    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
E/AndroidRuntime( 3633): **Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get()' on a null object reference**
E/AndroidRuntime( 3633):    at android.app.ResourcesManager.applyConfigurationToResourcesLocked(ResourcesManager.java:307)
E/AndroidRuntime( 3633):    at android.app.ActivityThread.applyConfigurationToResources(ActivityThread.java:4289)
E/AndroidRuntime( 3633):    at com.android.server.am.ActivityManagerService.updateConfigurationLocked(ActivityManagerService.java:18123)
E/AndroidRuntime( 3633):    at com.android.server.am.ActivityManagerService.updateConfiguration(ActivityManagerService.java:18043)
E/AndroidRuntime( 3633):    at com.android.server.UiModeManagerService.sendConfigurationLocked(UiModeManagerService.java:396)
E/AndroidRuntime( 3633):    at com.android.server.UiModeManagerService.onStart(UiModeManagerService.java:193)
E/AndroidRuntime( 3633):    at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:109)
E/AndroidRuntime( 3633)

Tried @Mikanoshi fix .apk but could not solve, probably because it's not made for Sony and Marshmallow

Mikanoshi commented 8 years ago

I guess it's because mActiveResources var was changed to mResourceImpls. This version should work on both 5.x and 6.x: http://mikanoshi.name/share/FixRandomReboots.apk

bugmenot2 commented 8 years ago

Thanks a lot for the try! but unfortunately it makes the phone bootloop (bootanimation endless) instead of freezing-and-reboot. It seems you managed to avoid the Fatal System Crash but leaving the phone in a bootanimation loop without getting to the user interface. This still occurs randomly like the crashes, if I manually reboot the phone a few times I can get a successful boot. I've attached the new log using your fix.apk: liveboot-copy.log.txt

Sorry, it's quite big because I let it bootloop for some minutes

Mikanoshi commented 8 years ago

Did you try to disable XUIMod/VolumePanel and Greenify? They throw errors in system class, it can crash system server, OS will try to recover and soft reboot again and again. But I don't see any crashes in that log, so possibly it's not a bootloop, maybe some daemon fails to start and system is waiting for it, e.g. atfwd. At least there is no initial error :) If adb is still working, you can stop boot animation service and see what's going on (but most likely there will be nothing): adb shell su setprop ctl.stop bootanim

aviraxp commented 8 years ago

Such a coincidence that I encountered this random boot when I was reading this issue. I am on DirtyUnicorns.

10-05 21:12:26.711  4669  4669 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main

10-05 21:12:26.711  4669  4669 E AndroidRuntime: java.lang.RuntimeException: Failed to start service com.android.server.UiModeManagerService: onStart threw an exception

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:111)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at com.android.server.SystemServer.startOtherServices(SystemServer.java:617)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at com.android.server.SystemServer.run(SystemServer.java:294)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at com.android.server.SystemServer.main(SystemServer.java:192)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)

10-05 21:12:26.711  4669  4669 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get()' on a null object reference

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at android.app.ResourcesManager.applyConfigurationToResourcesLocked(ResourcesManager.java:494)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at android.app.ActivityThread.applyConfigurationToResources(ActivityThread.java:4218)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at com.android.server.am.ActivityManagerService.updateConfigurationLocked(ActivityManagerService.java:17540)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at com.android.server.am.ActivityManagerService.updateConfiguration(ActivityManagerService.java:17474)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at com.android.server.UiModeManagerService.sendConfigurationLocked(UiModeManagerService.java:396)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at com.android.server.UiModeManagerService.onStart(UiModeManagerService.java:193)

10-05 21:12:26.711  4669  4669 E AndroidRuntime:    at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:109)

@Mikanoshi Your fix works well.

aviraxp commented 8 years ago

Ouch, seems I experienced something like @bugmenot2 ..... t.txt

bugmenot2 commented 7 years ago

@Mikanoshi I made a lot of tests activating and deactivating modules to understand if there's a guilty one. I identified 1 module (Serajr Blurred System UI) that seems to kick in consistently the crash during bootanimation and reboot problem. Tests:

so it seems the bug is not caused by a specific module but by the conflict between modules or some synchronization conflict. I don't know if my installed modules are defective or if there's a bug related to my rom/vendor or the Xposed framework itself. Unfortunately it's a very confusing issue and happens randomly.

I'm here if i can help further, i see that Rovo is busy with Nougat which is obviously more important. Happy new year all!

Mikanoshi commented 7 years ago

@bugmenot2 Reboot problems are caused by resource hooks, the more hooks module does, the more it contributes to the problem. With my fix I had zero random reboots for the past 1.5 years, I no longer update Xposed framework or test new versions, so had no reason to disable the fix and test if it's still required.