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

Commit 0c77bfee authored by Pawit Pornkitprasan's avatar Pawit Pornkitprasan
Browse files

Fix force close from PREVENT_POWER_KEY permission being checked even when not requested.

This happens because the permission check occurs without checking the mask. Applications which calls setFlags with a negative flag to remove flags would then force close because the check thinks that the application is requesting the PREVENT_POWER_KEY permission

Change-Id: I645b4f90cd48624ea078eb676fdbf0a766fe13c4
parent 7724d343
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -687,7 +687,7 @@ public abstract class Window {
     * @param mask Which of the window flag bits to modify.
     */
    public void setFlags(int flags, int mask) {
        if ((flags & WindowManager.LayoutParams.PREVENT_POWER_KEY) != 0){
        if ((flags & mask & WindowManager.LayoutParams.PREVENT_POWER_KEY) != 0){
            mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_POWER_KEY", "No permission to prevent power key");
        }
        final WindowManager.LayoutParams attrs = getAttributes();