Fix random systemui crashes during boot
When trying to boot android in emulator, systemui may crash due to an uninitialized value of mNavigationBar probably because of some race condition during initialization caused by emulation performance issues: 08-24 16:28:43.722 1947 1947 E AndroidRuntime: FATAL EXCEPTION: main 08-24 16:28:43.722 1947 1947 E AndroidRuntime: Process: com.android.systemui, PID: 1947 08-24 16:28:43.722 1947 1947 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.app.Fragment.getView()' on a null object reference 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at com.android.systemui.statusbar.phone.StatusBar.getNavigationBarView(StatusBar.java:4636) 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.updateStates(StatusBarKeyguardViewManager.java:537) 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.reset(StatusBarKeyguardViewManager.java:207) 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.show(StatusBarKeyguardViewManager.java:145) 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at com.android.systemui.keyguard.KeyguardViewMediator.handleShow(KeyguardViewMediator.java:1721) 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at com.android.systemui.keyguard.KeyguardViewMediator.access$2900(KeyguardViewMediator.java:138) 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at com.android.systemui.keyguard.KeyguardViewMediator$4.handleMessage(KeyguardViewMediator.java:1482) 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:105) 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164) 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6510) 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) 08-24 16:28:43.722 1947 1947 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771) This patches adds an explicit checks for (mNavigationBar != null) everywhere it is used. Test: Boot ARM & MIPS emulators to homescreen. Change-Id: I3af868b9da565c7eb6c6882f65fbda4a34d802c8 Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
This commit is contained in:
committed by
Luca Stefani
parent
a90205492f
commit
81e684b76b
@@ -3842,7 +3842,9 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
}
|
||||
|
||||
public void onKeyguardOccludedChanged(boolean keyguardOccluded) {
|
||||
mNavigationBar.onKeyguardOccludedChanged(keyguardOccluded);
|
||||
if (mNavigationBar != null) {
|
||||
mNavigationBar.onKeyguardOccludedChanged(keyguardOccluded);
|
||||
}
|
||||
}
|
||||
|
||||
// State logging
|
||||
@@ -4633,7 +4635,8 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
|
||||
// TODO: Figure out way to remove this.
|
||||
public NavigationBarView getNavigationBarView() {
|
||||
return (NavigationBarView) mNavigationBar.getView();
|
||||
return (mNavigationBar != null) ?
|
||||
(NavigationBarView) mNavigationBar.getView() : null;
|
||||
}
|
||||
|
||||
// ---------------------- DragDownHelper.OnDragDownListener ------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user