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

Unverified Commit 39f38c09 authored by d34d's avatar d34d Committed by Michael Bestas
Browse files

Lockscreen: Introduce window type TYPE_KEYGUARD_PANEL

This window type will be used by third party keyguard components
so that they can be layered within the keyguard while running in
their own process.  This window type will use the same Z ordering
as TYPE_STATUS_BAR_SUB_PANEL, which is currently unused.

Note from SHM:
 * This also fixes the following errors while compiling for the emulator:

ERROR: vendor/cmsdk/tests/src/org/cyanogenmod/tests/externalviews/keyguardexternalviews/KeyguardExternalProviderTest.java:199: TYPE_KEYGUARD_PANEL cannot be resolved or is not a field
ERROR: vendor/cmsdk/tests/src/org/cyanogenmod/tests/externalviews/keyguardexternalviews/KeyguardExternalProviderTest.java:200: TYPE_KEYGUARD_PANEL cannot be resolved or is not a field

Change-Id: Ie18caf12a55ba79a5c56a36ca79b3a6e377d7529
parent 840acea4
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -240,6 +240,7 @@ public interface WindowManager extends ViewManager {
         * @see #TYPE_SYSTEM_ERROR
         * @see #TYPE_INPUT_METHOD
         * @see #TYPE_INPUT_METHOD_DIALOG
         * @see #TYPE_KEYGUARD_PANEL
         */
        @ViewDebug.ExportedProperty(mapping = {
            @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
@@ -283,7 +284,8 @@ public interface WindowManager extends ViewManager {
            @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING, to = "TYPE_VOICE_INTERACTION_STARTING"),
            @ViewDebug.IntToString(from = TYPE_DOCK_DIVIDER, to = "TYPE_DOCK_DIVIDER"),
            @ViewDebug.IntToString(from = TYPE_QS_DIALOG, to = "TYPE_QS_DIALOG"),
            @ViewDebug.IntToString(from = TYPE_SCREENSHOT, to = "TYPE_SCREENSHOT")
            @ViewDebug.IntToString(from = TYPE_SCREENSHOT, to = "TYPE_SCREENSHOT"),
            @ViewDebug.IntToString(from = TYPE_KEYGUARD_PANEL, to = "TYPE_KEYGUARD_PANEL"),
        })
        public int type;

@@ -650,6 +652,13 @@ public interface WindowManager extends ViewManager {
         */
        public static final int TYPE_SCREENSHOT = FIRST_SYSTEM_WINDOW + 36;

        /**
         * Window type: Windows that are layered within the keyguard
         * This type is LAST_SYSTEM_WINDOW-1 to avoid future conflicts with AOSP
         * @hide
         */
        public static final int TYPE_KEYGUARD_PANEL = FIRST_SYSTEM_WINDOW+998;

        /**
         * End of types of system windows.
         */
+24 −2
Original line number Diff line number Diff line
@@ -435,6 +435,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    boolean mNavigationBarLeftInLandscape = false; // Navigation bar left handed?

    boolean mBootMessageNeedsHiding;

    WindowState mKeyguardPanel;


    KeyguardServiceDelegate mKeyguardDelegate;
    final Runnable mWindowManagerDrawCallback = new Runnable() {
        @Override
@@ -2499,6 +2503,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                permission = android.Manifest.permission.SYSTEM_ALERT_WINDOW;
                outAppOp[0] = AppOpsManager.OP_SYSTEM_ALERT_WINDOW;
                break;
            case TYPE_KEYGUARD_PANEL:
                permission =
                        org.cyanogenmod.platform.internal.Manifest.permission.THIRD_PARTY_KEYGUARD;
                break;
            default:
                permission = android.Manifest.permission.INTERNAL_SYSTEM_WINDOW;
        }
@@ -2592,6 +2600,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            case TYPE_VOLUME_OVERLAY:
            case TYPE_PRIVATE_PRESENTATION:
            case TYPE_DOCK_DIVIDER:
            case TYPE_KEYGUARD_PANEL:
                break;
        }

@@ -2799,6 +2808,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            // the safety window that shows behind keyguard while keyguard is starting
            return 14;
        case TYPE_STATUS_BAR_SUB_PANEL:
        case TYPE_KEYGUARD_PANEL:
            return 15;
        case TYPE_STATUS_BAR:
            return 16;
@@ -3166,6 +3176,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                        android.Manifest.permission.STATUS_BAR_SERVICE,
                        "PhoneWindowManager");
                break;
            case TYPE_KEYGUARD_PANEL:
                mContext.enforceCallingOrSelfPermission(
                        org.cyanogenmod.platform.internal.Manifest.permission.THIRD_PARTY_KEYGUARD,
                        "PhoneWindowManager");
                if (mKeyguardPanel != null) {
                    return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON;
                }
                mKeyguardPanel = win;
                break;
            case TYPE_KEYGUARD_SCRIM:
                if (mKeyguardScrim != null) {
                    return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON;
@@ -3186,9 +3205,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        } else if (mKeyguardScrim == win) {
            Log.v(TAG, "Removing keyguard scrim");
            mKeyguardScrim = null;
        } if (mNavigationBar == win) {
        } else if (mNavigationBar == win) {
            mNavigationBar = null;
            mNavigationBarController.setWindow(null);
        } else if (mKeyguardPanel == win) {
            mKeyguardPanel = null;
        }
    }

@@ -5208,7 +5229,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                // gets everything, period.
                if (attrs.type == TYPE_STATUS_BAR_PANEL
                        || attrs.type == TYPE_STATUS_BAR_SUB_PANEL
                        || attrs.type == TYPE_VOLUME_OVERLAY) {
                        || attrs.type == TYPE_VOLUME_OVERLAY
                        || attrs.type == TYPE_KEYGUARD_PANEL) {
                    pf.left = df.left = of.left = cf.left = hasNavBar
                            ? mDockLeft : mUnrestrictedScreenLeft;
                    pf.top = df.top = of.top = cf.top = mUnrestrictedScreenTop;
+3 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import android.util.TimeUtils;
import android.view.Choreographer;
import android.view.Display;
import android.view.SurfaceControl;
import android.view.WindowManager;
import android.view.WindowManagerPolicy;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
@@ -256,6 +257,8 @@ public class WindowAnimator {
        allowWhenLocked |= (win.mIsImWindow || imeTarget == win) && showImeOverKeyguard;
        // Show SHOW_WHEN_LOCKED windows that turn on the screen
        allowWhenLocked |= (win.mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0 && win.mTurnOnScreen;
        // Show windows that use TYPE_STATUS_BAR_SUB_PANEL when locked
        allowWhenLocked |= win.mAttrs.type == WindowManager.LayoutParams.TYPE_KEYGUARD_PANEL;

        if (appShowWhenLocked != null) {
            allowWhenLocked |= appShowWhenLocked == win.mAppToken