Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8607b580 authored by Jorge Ruesga's avatar Jorge Ruesga Committed by Michael Bestas
Browse files

PhoneWindowPolicy: Fix NPE race condition by excessive screen on delay



When screen on has an excessive delay mTopFullscreenOpaqueWindowState could
not be initialized. This derives in a NPE from a Power key press. If
mTopFullscreenOpaqueWindowState = null then PREVENT_POWER_KEY can be safelly
ignored

Change-Id: I04ce5d88f6f9abf02b2bbcdce4a2acad2f6451fa
Signed-off-by: default avatarJorge Ruesga <jorge@ruesga.com>
parent 0ec77895
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -5174,7 +5174,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            }
            }


            case KeyEvent.KEYCODE_POWER: {
            case KeyEvent.KEYCODE_POWER: {
                if ((mTopFullscreenOpaqueWindowState.getAttrs().privateFlags
                if (mTopFullscreenOpaqueWindowState != null &&
                        (mTopFullscreenOpaqueWindowState.getAttrs().privateFlags
                        & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_POWER_KEY) != 0){
                        & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_POWER_KEY) != 0){
                    return result;
                    return result;
                }
                }