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

Commit 44e91e0e authored by Scott Mertz's avatar Scott Mertz
Browse files

fw: reintroduce PRIVATE_FLAG_PREVENT_POWER_KEY

Switching the PREVENT_SYSTEM_KEYS forces the application to handle
every system key.  Some apps may not want to handle every single key,
so allow them to just handle the power key.

CYNGNOS-2958
Change-Id: I43fd65e67b909e6d52548f110ff9997b829b3e15
parent 70d2082f
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -869,7 +869,10 @@ public abstract class Window {
    }

    private void setPrivateFlags(int flags, int mask) {
        if ((flags & mask & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_SYSTEM_KEYS) != 0){
        int preventFlags = WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_POWER_KEY |
                WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_SYSTEM_KEYS;

        if ((flags & mask & preventFlags) != 0) {
            mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_SYSTEM_KEYS",
                    "No permission to prevent system key");
        }
+7 −1
Original line number Diff line number Diff line
@@ -1157,7 +1157,13 @@ public interface WindowManager extends ViewManager {
         * Window flag: Overrides default system key behavior.
         * {@hide}
         */
        public static final int PRIVATE_FLAG_PREVENT_SYSTEM_KEYS = 0x20000000;
        public static final int PRIVATE_FLAG_PREVENT_SYSTEM_KEYS = 0x10000000;

        /**
         * Window flag: Overrides default system key behavior.
         * {@hide}
         */
        public static final int PRIVATE_FLAG_PREVENT_POWER_KEY = 0x20000000;

        /**
         * Window flag: adding additional blur layer and set this as masking layer
+2 −1
Original line number Diff line number Diff line
@@ -3265,7 +3265,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {

            if (mTopFullscreenOpaqueWindowState != null &&
                    (mTopFullscreenOpaqueWindowState.getAttrs().privateFlags
                            & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_SYSTEM_KEYS) != 0
                            & (WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_SYSTEM_KEYS |
                                WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_POWER_KEY)) != 0
                    && mScreenOnFully) {
                return 0;
            }