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

Commit 380ecb81 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Make Keyguard a library and make StatusBar the new Keyguard.

This change achieves a couple of things:
- Let Keyguard be a library, so we can use it in SystemUI.
- Introduce FLAG_KEYGUARD for windows and deprecate TYPE_KEYGUARD. Make
all the TYPE_KEYGUARD behaviour dependant on the flag.
- Implement a new KeyguardService in SystemUI, and bind that service
from PhoneWindowManager.
- Introduce BaseStatusBar.setKeyguardState and inflate
KeyguardSimpleHostView there and use FLAG_KEYGUARD for the window, such
that the status bar window essentially gets the Keyguard.

Bug: 13635952
Change-Id: I059d80d8b9b9818a778ab685f4672ea2694def63
parent ca476166
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ import android.util.Log;
public interface WindowManager extends ViewManager {
    /**
     * Exception that is thrown when trying to add view whose
     * {@link WindowManager.LayoutParams} {@link WindowManager.LayoutParams#token}
     * {@link LayoutParams} {@link LayoutParams#token}
     * is invalid.
     */
    public static class BadTokenException extends RuntimeException {
@@ -173,7 +173,6 @@ public interface WindowManager extends ViewManager {
         * @see #TYPE_SEARCH_BAR
         * @see #TYPE_PHONE
         * @see #TYPE_SYSTEM_ALERT
         * @see #TYPE_KEYGUARD
         * @see #TYPE_TOAST
         * @see #TYPE_SYSTEM_OVERLAY
         * @see #TYPE_PRIORITY_PHONE
@@ -197,7 +196,6 @@ public interface WindowManager extends ViewManager {
            @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
            @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
            @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
            @ViewDebug.IntToString(from = TYPE_KEYGUARD, to = "TYPE_KEYGUARD"),
            @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"),
            @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"),
            @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"),
@@ -913,7 +911,6 @@ public interface WindowManager extends ViewManager {
         */
        public static final int FLAG_NEEDS_MENU_KEY = 0x40000000;


        /**
         * Various behavioral options/flags.  Default is none.
         * 
@@ -1086,6 +1083,14 @@ public interface WindowManager extends ViewManager {
         * {@hide} */
        public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;

        /**
         * Flag whether the current window is a keyguard window, meaning that it will hide all other
         * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
         * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
         * {@hide}
         */
        public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;

        /**
         * Control flags that are private to the platform.
         * @hide
+13 −1
Original line number Diff line number Diff line
@@ -30,7 +30,19 @@ interface IKeyguardService {
    boolean isDismissable();
    oneway void verifyUnlock(IKeyguardExitCallback callback);
    oneway void keyguardDone(boolean authenticated, boolean wakeup);
    oneway void setHidden(boolean isHidden);

    /**
     * Hides the Keyguard when a window comes on top of the Keyguard with flag
     * FLAG_SHOW_ON_LOCK_SCREEN.
     *
     * @param isHidden Whether the Keyguard should be hidden.
     * @return See IKeyguardServiceConstants.KEYGUARD_SERVICE_HIDE_*. This is needed because
     *         PhoneWindowManager needs to set these flags immediately and can't wait for the
     *         Keyguard thread to pick it up. In the hidden case, PhoneWindowManager is solely
     *         responsible to make sure that the flags are unset.
     */
    int setHidden(boolean isHidden);

    oneway void dismiss();
    oneway void onDreamingStarted();
    oneway void onDreamingStopped();
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */

package com.android.internal.policy;

/**
 * @hide
 */
public class IKeyguardServiceConstants {

    /**
     * Constant for {@link com.android.internal.policy.IKeyguardService#setHidden(boolean)}:
     * Don't change the keyguard window flags.
     */
    public static final int KEYGUARD_SERVICE_HIDE_RESULT_NONE = 0;

    /**
     * Constant for {@link com.android.internal.policy.IKeyguardService#setHidden(boolean)}:
     * Set the keyguard window flags to FLAG_SHOW_WALLPAPER and PRIVATE_FLAG_KEYGUARD.
     */
    public static final int KEYGUARD_SERVICE_HIDE_RESULT_SET_FLAGS = 1;

    /**
     * Constant for {@link com.android.internal.policy.IKeyguardService#setHidden(boolean)}:
     * Unset the keyguard window flags to FLAG_SHOW_WALLPAPER and PRIVATE_FLAG_KEYGUARD.
     */
    public static final int KEYGUARD_SERVICE_HIDE_RESULT_UNSET_FLAGS = 2;
}
+5 −3
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-subdir-Iaidl-files) \
                   $(call all-proto-files-under,src)

LOCAL_PACKAGE_NAME := Keyguard
LOCAL_MODULE := Keyguard

LOCAL_CERTIFICATE := platform

@@ -30,6 +30,8 @@ LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := optional_field_style=accessors

include $(BUILD_PACKAGE)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res

include $(BUILD_STATIC_JAVA_LIBRARY)

#include $(call all-makefiles-under,$(LOCAL_PATH))
 No newline at end of file
+0 −3
Original line number Diff line number Diff line
@@ -45,8 +45,5 @@
        android:persistent="true"
        android:supportsRtl="true">

        <service android:name=".KeyguardService"
            android:exported="true" />

    </application>
</manifest>
Loading