E AndroidRuntime: java.lang.RuntimeException: Unable to create service com.android.systemui.keyguard.KeyguardService

Oh boy! I finally got AOKP to boot up in an Engineering build for the XA2 Ultra (discovery). However, once you get through the setup pages, it crashes at the home screen. Here’s the logcat output:

——— beginning of crash
08-21 04:12:30.094 3050 3050 E AndroidRuntime: FATAL EXCEPTION: main
08-21 04:12:30.094 3050 3050 E AndroidRuntime: Process: com.android.systemui, PID: 3050
08-21 04:12:30.094 3050 3050 E AndroidRuntime: java.lang.RuntimeException: Unable to create service com.android.systemui.keyguard.KeyguardService: java.lang.NullPointerException: Attempt to invoke interface method ‘android.service.gesture.IEdgeGestureHostCallback android.service.gesture.IEdgeGestureService.registerEdgeGestureActivationListener(android.service.gesture.IEdgeGestureActivationListener)’ on a null object reference
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:3582)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.app.ActivityThread.access$1300(ActivityThread.java:200)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1672)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6718)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke interface method ‘android.service.gesture.IEdgeGestureHostCallback android.service.gesture.IEdgeGestureService.registerEdgeGestureActivationListener(android.service.gesture.IEdgeGestureActivationListener)’ on a null object reference
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.service.gesture.EdgeGestureManager.setEdgeGestureActivationListener(EdgeGestureManager.java:178)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.statusbar.pie.PieController.init(PieController.java:126)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.statusbar.phone.StatusBar.updatePieControls(StatusBar.java:6201)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.statusbar.phone.StatusBar$19.onChange(StatusBar.java:5464)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.statusbar.phone.StatusBar.start(StatusBar.java:886)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.SystemBars.createStatusBarFromConfig(SystemBars.java:71)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.SystemBars.start(SystemBars.java:42)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.SystemUIApplication.startServicesIfNeeded(SystemUIApplication.java:185)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.SystemUIApplication.startServicesIfNeeded(SystemUIApplication.java:129)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at com.android.systemui.keyguard.KeyguardService.onCreate(KeyguardService.java:48)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:3570)
08-21 04:12:30.094 3050 3050 E AndroidRuntime: … 8 more
08-21 04:12:30.100 1445 1478 V RescueParty: Disabled because of eng build

There is a lot in there, but here is the important part:

Caused by: java.lang.NullPointerException: Attempt to invoke interface method ‘android.service.gesture.IEdgeGestureHostCallback android.service.gesture.IEdgeGestureService.registerEdgeGestureActivationListener(android.service.gesture.IEdgeGestureActivationListener)’ on a null object reference

08-21 04:12:30.094 3050 3050 E AndroidRuntime: at android.service.gesture.EdgeGestureManager.setEdgeGestureActivationListener(EdgeGestureManager.java:178)

So, I took a look at EdgeGestureManager.java, around line 178, which is reportedly the problem:

public boolean setEdgeGestureActivationListener(EdgeGestureActivationListener listener) {
if (DEBUG) {
Slog.d(TAG, “Set edge gesture activation listener”);
}
try {
IEdgeGestureHostCallback callback = mPs.registerEdgeGestureActivationListener(listener.mDelegator);
listener.setHostCallback(callback);
return true;
} catch (RemoteException e) {
Slog.e(TAG, “Failed to set edge gesture activation listener: ” + e.getMessage());
return false;
}
}

I took a look at Lineage and RR, and ended up adding new code to my files to fix it. Here’s what I put in, based on what I saw in the other working ROMs:

public void updateEdgeGestureActivationListener(EdgeGestureActivationListener listener, int positions) {
if (DEBUG) {
Slog.d(TAG, “Update edge gesture activation listener: 0x” + Integer.toHexString(positions));
}
if (mPs == null) {
Slog.e(TAG, “Failed to update edge gesture activation listener: Service not present”);
return;
}
try {
mPs.updateEdgeGestureActivationListener(listener.mDelegator.asBinder(), positions);
} catch (RemoteException e) {
Slog.e(TAG, “Failed to update edge gesture activation listener: ” + e.getMessage());
}
}

So now it will check if it is “null” or empty before trying to use it. If it is empty, it exits rather than crashing because it is empty. If it’s not empty, it will use it instead. Praise God! This even worked! After fixing this last piece of the puzzle, AOKP Pie finally booted and worked on my XA2 Ultra!

Linux – keep it simple.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s