diff options
author | Sam Mortimer <sam@mortimer.me.uk> | 2017-01-17 00:19:12 -0800 |
---|---|---|
committer | Dan Pasanen <dan.pasanen@gmail.com> | 2017-02-08 23:42:08 +0000 |
commit | dc0c974e6a904dc637b8c49ed67d34f17fea5532 (patch) | |
tree | ec0500a3855b5be6bb8cb3a488ebeb7121ed66c6 | |
parent | dd7a317ab78ee88d8987cf708b64e847b11f3e1b (diff) | |
download | android_frameworks_base-dc0c974e6a904dc637b8c49ed67d34f17fea5532.tar.gz android_frameworks_base-dc0c974e6a904dc637b8c49ed67d34f17fea5532.tar.bz2 android_frameworks_base-dc0c974e6a904dc637b8c49ed67d34f17fea5532.zip |
PhoneWindowManager: add mTopFullscreenOpaqueWindowState null check to fix exception
Discovered through extensive testing with double press power for camera combined
with long press power for torch (though these features are not required to
trigger the issue), lack of null check here can occasionally result in either of:
1) screen is off, power press will NOT turn the screen on (needs to be woken
via fingerprint, power cable connect or leave device for a minute or
so and it will eventually wake on power press again).
OR
2) screen is on, power press will not turn the screen off
It requires pressing power shortly after screen off or screen on at just
the right time to trigger. Issue is reproducible on angler.
E InputManager-JNI: An exception was thrown by callback 'interceptKeyBeforeQueueing'.
E InputManager-JNI: java.lang.NullPointerException: Attempt to invoke interface method
'android.view.WindowManager$LayoutParams android.view.WindowManagerPolicy$WindowState.getAttrs()'
on a null object reference
E InputManager-JNI: at com.android.server.policy.PhoneWindowManager.interceptKeyBeforeQueueing(PhoneWindowManager.java:6647)
E InputManager-JNI: at com.android.server.wm.InputMonitor.interceptKeyBeforeQueueing(InputMonitor.java:399)
E InputManager-JNI: at com.android.server.input.InputManagerService.interceptKeyBeforeQueueing(InputManagerService.java:1979)
Change-Id: I77d094130d58b152fdfa515f53661543976b33bf
-rw-r--r-- | services/core/java/com/android/server/policy/PhoneWindowManager.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index e6f6828f59b..45ba4f0c333 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -6624,8 +6624,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { } case KeyEvent.KEYCODE_POWER: { - if ((mTopFullscreenOpaqueWindowState.getAttrs().privateFlags - & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_POWER_KEY) != 0 + if (mTopFullscreenOpaqueWindowState != null + && (mTopFullscreenOpaqueWindowState.getAttrs().privateFlags + & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_POWER_KEY) != 0 && mScreenOnFully) { return result; } |