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

Commit 5cf17879 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Reuse KeyguardViewMediator for new Keyguard implementation.

This change reuses KeyguardViewMediator for the new Keyguard
implementation in status bar. KeyguardViewManager is replaced by
StatusBarKeyguardManager which handles adding the view, setting the
state etc. StatusBarWindowManager is introduced to managed the window
of the status bar, which has the logic of both the old Keyguard window
and the old status bar window. In the current implementation, Keyguard
gets displayed like it would be in the bouncer state, but that's likely
to change in the future. Also, setHidden in IKeyguardService is also
renamed to setOccluded, as the word hidden interferes with the
terminology when dismissing the Keyguard.

Bug: 13635952
Change-Id: I1c5d5a49d810d8532089f464cb2efe35e577f517
parent 085226c4
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -25,22 +25,23 @@ import android.os.Bundle;
interface IKeyguardService {
    boolean isShowing();
    boolean isSecure();
    boolean isShowingAndNotHidden();
    boolean isShowingAndNotOccluded();
    boolean isInputRestricted();
    boolean isDismissable();
    oneway void verifyUnlock(IKeyguardExitCallback callback);
    oneway void keyguardDone(boolean authenticated, boolean wakeup);

    /**
     * Hides the Keyguard when a window dismisses the Keyguard with flag FLAG_SHOW_ON_LOCK_SCREEN.
     * Sets the Keyguard as occluded when a window dismisses 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
     * @param isOccluded Whether the Keyguard is occluded by another window.
     * @return See IKeyguardServiceConstants.KEYGUARD_SERVICE_SET_OCCLUDED_*. 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);
    int setOccluded(boolean isOccluded);

    oneway void dismiss();
    oneway void onDreamingStarted();
+3 −3
Original line number Diff line number Diff line
@@ -25,17 +25,17 @@ 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;
    public static final int KEYGUARD_SERVICE_SET_OCCLUDED_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;
    public static final int KEYGUARD_SERVICE_SET_OCCLUDED_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;
    public static final int KEYGUARD_SERVICE_SET_OCCLUDED_RESULT_UNSET_FLAGS = 2;
}
+30 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ 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
  -->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <View android:id="@+id/bouncer_background"
        android:background="#aa000000"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <include layout="@layout/keyguard_simple_host_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</FrameLayout>
+5 −3
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ import com.android.keyguard.KeyguardActivityLauncher.CameraWidgetInfo;

public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnClickListener {
    private static final String TAG = CameraWidgetFrame.class.getSimpleName();
    private static final boolean DEBUG = KeyguardHostView.DEBUG;
    private static final boolean DEBUG = KeyguardConstants.DEBUG;
    private static final int WIDGET_ANIMATION_DURATION = 250; // ms
    private static final int WIDGET_WAIT_DURATION = 400; // ms
    private static final int RECOVERY_DELAY = 1000; // ms
@@ -113,12 +113,14 @@ public class CameraWidgetFrame extends KeyguardWidgetFrame implements View.OnCli

    private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
        private boolean mShowing;
        void onKeyguardVisibilityChanged(boolean showing) {

        @Override
        public void onKeyguardVisibilityChanged(boolean showing) {
            if (mShowing == showing)
                return;
            mShowing = showing;
            CameraWidgetFrame.this.onKeyguardVisibilityChanged(mShowing);
        };
        }
    };

    private static final class FixedSizeFrameLayout extends FrameLayout {
+3 −2
Original line number Diff line number Diff line
@@ -48,10 +48,11 @@ public class EmergencyButton extends Button {
            updateEmergencyCallButton(simState, phoneState);
        }

        void onPhoneStateChanged(int phoneState) {
        @Override
        public void onPhoneStateChanged(int phoneState) {
            State simState = KeyguardUpdateMonitor.getInstance(mContext).getSimState();
            updateEmergencyCallButton(simState, phoneState);
        };
        }
    };
    private LockPatternUtils mLockPatternUtils;
    private PowerManager mPowerManager;
Loading