summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Youngjun Kwak <kwaky@google.com> 2020-03-06 20:55:29 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-03-06 20:55:29 +0000
commit91b4f26c5b40292eac5a00e477eb747f1f859ba3 (patch)
tree6fb6960e7650ec7790f5b9179400b9f3d2834b4d
parente2e7cd5d4c2b45fa288f37b8a16f59429a5f9aae (diff)
parent198b5dc318106f066f7b5af5ed22b97cb4db0d1f (diff)
Merge "DO NOT MERGE Create KeyguardViewController that extracts view-related logic in KeyguardViewMediator and re-wire Dagger accordingly." into rvc-dev
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java5
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java174
-rw-r--r--packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java70
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java51
6 files changed, 252 insertions, 58 deletions
diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
index a0d5a1bf6978..7cc4257f26a5 100644
--- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
+++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
@@ -21,6 +21,7 @@ import static com.android.systemui.Dependency.LEAK_REPORT_EMAIL_NAME;
import android.content.Context;
+import com.android.keyguard.KeyguardViewController;
import com.android.systemui.car.CarDeviceProvisionedControllerImpl;
import com.android.systemui.car.CarNotificationInterruptionStateProvider;
import com.android.systemui.dagger.SystemUIRootComponent;
@@ -136,6 +137,10 @@ abstract class CarSystemUIModule {
CarStatusBarKeyguardViewManager keyguardViewManager);
@Binds
+ abstract KeyguardViewController bindKeyguardViewController(
+ CarStatusBarKeyguardViewManager keyguardViewManager);
+
+ @Binds
abstract DeviceProvisionedController bindDeviceProvisionedController(
CarDeviceProvisionedControllerImpl deviceProvisionedController);
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java
new file mode 100644
index 000000000000..fc29f5cddb26
--- /dev/null
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2020 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.keyguard;
+
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewRootImpl;
+
+import com.android.systemui.keyguard.DismissCallbackRegistry;
+import com.android.systemui.keyguard.KeyguardViewMediator;
+import com.android.systemui.plugins.FalsingManager;
+import com.android.systemui.statusbar.phone.BiometricUnlockController;
+import com.android.systemui.statusbar.phone.KeyguardBypassController;
+import com.android.systemui.statusbar.phone.NotificationPanelViewController;
+import com.android.systemui.statusbar.phone.StatusBar;
+
+/**
+ * Interface to control Keyguard View. It should be implemented by KeyguardViewManagers, which
+ * should, in turn, be injected into {@link KeyguardViewMediator}.
+ */
+public interface KeyguardViewController {
+ /**
+ * Shows Keyguard.
+ * @param options
+ */
+ void show(Bundle options);
+
+ /**
+ * Hides Keyguard with the fade-out animation as configured by the parameters provided.
+ *
+ * @param startTime
+ * @param fadeoutDuration
+ */
+ void hide(long startTime, long fadeoutDuration);
+
+ /**
+ * Resets the state of Keyguard View.
+ * @param hideBouncerWhenShowing
+ */
+ void reset(boolean hideBouncerWhenShowing);
+
+ /**
+ * Called when the device started going to sleep.
+ */
+ void onStartedGoingToSleep();
+
+ /**
+ * Called when the device has finished going to sleep.
+ */
+ void onFinishedGoingToSleep();
+
+ /**
+ * Called when the device started waking up.
+ */
+ void onStartedWakingUp();
+
+ /**
+ * Called when the device started turning on.
+ */
+ void onScreenTurningOn();
+
+ /**
+ * Called when the device has finished turning on.
+ */
+ void onScreenTurnedOn();
+
+ /**
+ * Sets whether the Keyguard needs input.
+ * @param needsInput
+ */
+ void setNeedsInput(boolean needsInput);
+
+ /**
+ * Called when cancel button in bouncer is pressed.
+ */
+ void onCancelClicked();
+
+ /**
+ * Sets whether the keyguard is occluded by another window.
+ *
+ * @param occluded
+ * @param animate
+ */
+ void setOccluded(boolean occluded, boolean animate);
+
+ /**
+ * @return Whether the keyguard is showing
+ */
+ boolean isShowing();
+
+ /**
+ * Dismisses the keyguard by going to the next screen or making it gone.
+ */
+ void dismissAndCollapse();
+
+ /**
+ * Notifies that Keyguard is just about to go away.
+ */
+ void keyguardGoingAway();
+
+ /**
+ * @return Whether window animation for unlock should be disabled.
+ */
+ boolean shouldDisableWindowAnimationsForUnlock();
+
+ /**
+ * @return Whether the keyguard is going to notification shade.
+ */
+ boolean isGoingToNotificationShade();
+
+ /**
+ * @return Whether subtle animation should be used for unlocking the device.
+ */
+ boolean isUnlockWithWallpaper();
+
+ /**
+ * @return Whether subtle animation should be used for unlocking the device.
+ */
+ boolean shouldSubtleWindowAnimationsForUnlock();
+
+ /**
+ * Starts the animation before we dismiss Keyguard, i.e. an disappearing animation on the
+ * security view of the bouncer.
+ *
+ * @param finishRunnable the runnable to be run after the animation finished, or {@code null} if
+ * no action should be run
+ */
+ void startPreHideAnimation(Runnable finishRunnable);
+
+ /**
+ * @return the ViewRootImpl of the View where the Keyguard is mounted.
+ */
+ ViewRootImpl getViewRootImpl();
+
+ // TODO: Deprecate registerStatusBar in KeyguardViewController interface. It is currently
+ // only used for testing purposes in StatusBarKeyguardViewManager, and it prevents us from
+ // achieving complete abstraction away from where the Keyguard View is mounted.
+
+ /**
+ * Registers the StatusBar to which this Keyguard View is mounted.
+ *
+ * @param statusBar
+ * @param container
+ * @param notificationPanelViewController
+ * @param biometricUnlockController
+ * @param dismissCallbackRegistry
+ * @param lockIconContainer
+ * @param notificationContainer
+ * @param bypassController
+ * @param falsingManager
+ */
+ void registerStatusBar(StatusBar statusBar,
+ ViewGroup container,
+ NotificationPanelViewController notificationPanelViewController,
+ BiometricUnlockController biometricUnlockController,
+ DismissCallbackRegistry dismissCallbackRegistry,
+ ViewGroup lockIconContainer, View notificationContainer,
+ KeyguardBypassController bypassController, FalsingManager falsingManager);
+}
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java
index 3e257b6173eb..b4e51258763c 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java
@@ -23,6 +23,7 @@ import android.content.Context;
import androidx.annotation.Nullable;
+import com.android.keyguard.KeyguardViewController;
import com.android.systemui.dock.DockManager;
import com.android.systemui.dock.DockManagerImpl;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -41,6 +42,7 @@ import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.ShadeControllerImpl;
+import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl;
@@ -117,4 +119,8 @@ public abstract class SystemUIDefaultModule {
@Binds
abstract DeviceProvisionedController bindDeviceProvisionedController(
DeviceProvisionedControllerImpl deviceProvisionedController);
+
+ @Binds
+ abstract KeyguardViewController bindKeyguardViewController(
+ StatusBarKeyguardViewManager statusBarKeyguardViewManager);
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index c129035e66a7..3d708a91dbf0 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -80,6 +80,7 @@ import com.android.keyguard.KeyguardDisplayManager;
import com.android.keyguard.KeyguardSecurityView;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
+import com.android.keyguard.KeyguardViewController;
import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
@@ -95,7 +96,6 @@ import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationPanelViewController;
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.StatusBar;
-import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.util.DeviceConfigProxy;
import com.android.systemui.util.InjectionInflationController;
@@ -236,7 +236,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
*/
private PowerManager.WakeLock mShowKeyguardWakeLock;
- private final Lazy<StatusBarKeyguardViewManager> mStatusBarKeyguardViewManagerLazy;
+ private final Lazy<KeyguardViewController> mKeyguardViewControllerLazy;
// these are protected by synchronized (this)
@@ -601,7 +601,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
@Override
public void setNeedsInput(boolean needsInput) {
- mStatusBarKeyguardViewManagerLazy.get().setNeedsInput(needsInput);
+ mKeyguardViewControllerLazy.get().setNeedsInput(needsInput);
}
@Override
@@ -615,7 +615,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
mKeyguardDonePending = true;
mHideAnimationRun = true;
mHideAnimationRunning = true;
- mStatusBarKeyguardViewManagerLazy.get()
+ mKeyguardViewControllerLazy.get()
.startPreHideAnimation(mHideAnimationFinishedRunnable);
mHandler.sendEmptyMessageDelayed(KEYGUARD_DONE_PENDING_TIMEOUT,
KEYGUARD_DONE_PENDING_TIMEOUT_MS);
@@ -647,7 +647,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
@Override
public void onCancelClicked() {
- mStatusBarKeyguardViewManagerLazy.get().onCancelClicked();
+ mKeyguardViewControllerLazy.get().onCancelClicked();
}
@Override
@@ -715,7 +715,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
LockPatternUtils lockPatternUtils,
BroadcastDispatcher broadcastDispatcher,
NotificationShadeWindowController notificationShadeWindowController,
- Lazy<StatusBarKeyguardViewManager> statusBarKeyguardViewManagerLazy,
+ Lazy<KeyguardViewController> statusBarKeyguardViewManagerLazy,
DismissCallbackRegistry dismissCallbackRegistry,
KeyguardUpdateMonitor keyguardUpdateMonitor, DumpManager dumpManager,
@UiBackground Executor uiBgExecutor, PowerManager powerManager,
@@ -726,7 +726,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
mLockPatternUtils = lockPatternUtils;
mBroadcastDispatcher = broadcastDispatcher;
mNotificationShadeWindowController = notificationShadeWindowController;
- mStatusBarKeyguardViewManagerLazy = statusBarKeyguardViewManagerLazy;
+ mKeyguardViewControllerLazy = statusBarKeyguardViewManagerLazy;
mDismissCallbackRegistry = dismissCallbackRegistry;
mUiBgExecutor = uiBgExecutor;
mUpdateMonitor = keyguardUpdateMonitor;
@@ -1288,7 +1288,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
if (mOccluded != isOccluded) {
mOccluded = isOccluded;
mUpdateMonitor.setKeyguardOccluded(isOccluded);
- mStatusBarKeyguardViewManagerLazy.get().setOccluded(isOccluded, animate
+ mKeyguardViewControllerLazy.get().setOccluded(isOccluded, animate
&& mDeviceInteractive);
adjustStatusBarLocked();
}
@@ -1359,7 +1359,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
}
// if the keyguard is already showing, don't bother
- if (mStatusBarKeyguardViewManagerLazy.get().isShowing()) {
+ if (mKeyguardViewControllerLazy.get().isShowing()) {
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because it is already showing");
resetStateLocked();
return;
@@ -1423,7 +1423,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
mDismissCallbackRegistry.addCallback(callback);
}
mCustomMessage = message;
- mStatusBarKeyguardViewManagerLazy.get().dismissAndCollapse();
+ mKeyguardViewControllerLazy.get().dismissAndCollapse();
} else if (callback != null) {
new DismissCallbackWrapper(callback).notifyDismissError();
}
@@ -1690,7 +1690,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
} else if (!mHideAnimationRun) {
mHideAnimationRun = true;
mHideAnimationRunning = true;
- mStatusBarKeyguardViewManagerLazy.get()
+ mKeyguardViewControllerLazy.get()
.startPreHideAnimation(mHideAnimationFinishedRunnable);
}
}
@@ -1847,7 +1847,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
mHiding = false;
mWakeAndUnlocking = false;
setShowingLocked(true);
- mStatusBarKeyguardViewManagerLazy.get().show(options);
+ mKeyguardViewControllerLazy.get().show(options);
resetKeyguardDonePendingLocked();
mHideAnimationRun = false;
adjustStatusBarLocked();
@@ -1872,22 +1872,22 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
public void run() {
Trace.beginSection("KeyguardViewMediator.mKeyGuardGoingAwayRunnable");
if (DEBUG) Log.d(TAG, "keyguardGoingAway");
- mStatusBarKeyguardViewManagerLazy.get().keyguardGoingAway();
+ mKeyguardViewControllerLazy.get().keyguardGoingAway();
int flags = 0;
- if (mStatusBarKeyguardViewManagerLazy.get().shouldDisableWindowAnimationsForUnlock()
+ if (mKeyguardViewControllerLazy.get().shouldDisableWindowAnimationsForUnlock()
|| (mWakeAndUnlocking && !mPulsing)) {
flags |= WindowManagerPolicyConstants
.KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS;
}
- if (mStatusBarKeyguardViewManagerLazy.get().isGoingToNotificationShade()
+ if (mKeyguardViewControllerLazy.get().isGoingToNotificationShade()
|| (mWakeAndUnlocking && mPulsing)) {
flags |= WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE;
}
- if (mStatusBarKeyguardViewManagerLazy.get().isUnlockWithWallpaper()) {
+ if (mKeyguardViewControllerLazy.get().isUnlockWithWallpaper()) {
flags |= WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER;
}
- if (mStatusBarKeyguardViewManagerLazy.get().shouldSubtleWindowAnimationsForUnlock()) {
+ if (mKeyguardViewControllerLazy.get().shouldSubtleWindowAnimationsForUnlock()) {
flags |= WindowManagerPolicyConstants
.KEYGUARD_GOING_AWAY_FLAG_SUBTLE_WINDOW_ANIMATIONS;
}
@@ -1973,7 +1973,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
// Hack level over 9000: To speed up wake-and-unlock sequence, force it to report
// the next draw from here so we don't have to wait for window manager to signal
// this to our ViewRootImpl.
- mStatusBarKeyguardViewManagerLazy.get().getViewRootImpl().setReportNextDraw();
+ mKeyguardViewControllerLazy.get().getViewRootImpl().setReportNextDraw();
notifyDrawn(mDrawnCallback);
mDrawnCallback = null;
}
@@ -1987,7 +1987,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
setShowingLocked(false);
mWakeAndUnlocking = false;
mDismissCallbackRegistry.notifyDismissSucceeded();
- mStatusBarKeyguardViewManagerLazy.get().hide(startTime, fadeoutDuration);
+ mKeyguardViewControllerLazy.get().hide(startTime, fadeoutDuration);
resetKeyguardDonePendingLocked();
mHideAnimationRun = false;
adjustStatusBarLocked();
@@ -2036,7 +2036,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
private void handleReset() {
synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleReset");
- mStatusBarKeyguardViewManagerLazy.get().reset(true /* hideBouncerWhenShowing */);
+ mKeyguardViewControllerLazy.get().reset(true /* hideBouncerWhenShowing */);
}
}
@@ -2049,7 +2049,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleVerifyUnlock");
setShowingLocked(true);
- mStatusBarKeyguardViewManagerLazy.get().dismissAndCollapse();
+ mKeyguardViewControllerLazy.get().dismissAndCollapse();
}
Trace.endSection();
}
@@ -2057,7 +2057,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
private void handleNotifyStartedGoingToSleep() {
synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleNotifyStartedGoingToSleep");
- mStatusBarKeyguardViewManagerLazy.get().onStartedGoingToSleep();
+ mKeyguardViewControllerLazy.get().onStartedGoingToSleep();
}
}
@@ -2068,7 +2068,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
private void handleNotifyFinishedGoingToSleep() {
synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleNotifyFinishedGoingToSleep");
- mStatusBarKeyguardViewManagerLazy.get().onFinishedGoingToSleep();
+ mKeyguardViewControllerLazy.get().onFinishedGoingToSleep();
}
}
@@ -2076,7 +2076,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
Trace.beginSection("KeyguardViewMediator#handleMotifyStartedWakingUp");
synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleNotifyWakingUp");
- mStatusBarKeyguardViewManagerLazy.get().onStartedWakingUp();
+ mKeyguardViewControllerLazy.get().onStartedWakingUp();
}
Trace.endSection();
}
@@ -2085,7 +2085,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
Trace.beginSection("KeyguardViewMediator#handleNotifyScreenTurningOn");
synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleNotifyScreenTurningOn");
- mStatusBarKeyguardViewManagerLazy.get().onScreenTurningOn();
+ mKeyguardViewControllerLazy.get().onScreenTurningOn();
if (callback != null) {
if (mWakeAndUnlocking) {
mDrawnCallback = callback;
@@ -2104,7 +2104,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
}
synchronized (this) {
if (DEBUG) Log.d(TAG, "handleNotifyScreenTurnedOn");
- mStatusBarKeyguardViewManagerLazy.get().onScreenTurnedOn();
+ mKeyguardViewControllerLazy.get().onScreenTurnedOn();
}
Trace.endSection();
}
@@ -2148,14 +2148,26 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
Trace.endSection();
}
- public StatusBarKeyguardViewManager registerStatusBar(StatusBar statusBar,
+ /**
+ * Registers the StatusBar to which the Keyguard View is mounted.
+ *
+ * @param statusBar
+ * @param container
+ * @param panelView
+ * @param biometricUnlockController
+ * @param lockIconContainer
+ * @param notificationContainer
+ * @param bypassController
+ * @return the View Controller for the Keyguard View this class is mediating.
+ */
+ public KeyguardViewController registerStatusBar(StatusBar statusBar,
ViewGroup container, NotificationPanelViewController panelView,
BiometricUnlockController biometricUnlockController, ViewGroup lockIconContainer,
View notificationContainer, KeyguardBypassController bypassController) {
- mStatusBarKeyguardViewManagerLazy.get().registerStatusBar(statusBar, container, panelView,
+ mKeyguardViewControllerLazy.get().registerStatusBar(statusBar, container, panelView,
biometricUnlockController, mDismissCallbackRegistry, lockIconContainer,
notificationContainer, bypassController, mFalsingManager);
- return mStatusBarKeyguardViewManagerLazy.get();
+ return mKeyguardViewControllerLazy.get();
}
public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) {
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java b/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java
index 367f46406ee8..9be478639ed8 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java
@@ -22,6 +22,7 @@ import android.os.PowerManager;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
+import com.android.keyguard.KeyguardViewController;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.qualifiers.UiBackground;
import com.android.systemui.dump.DumpManager;
@@ -30,7 +31,6 @@ import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.StatusBar;
-import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.util.DeviceConfigProxy;
import java.util.concurrent.Executor;
@@ -57,7 +57,7 @@ public class KeyguardModule {
LockPatternUtils lockPatternUtils,
BroadcastDispatcher broadcastDispatcher,
NotificationShadeWindowController notificationShadeWindowController,
- Lazy<StatusBarKeyguardViewManager> statusBarKeyguardViewManagerLazy,
+ Lazy<KeyguardViewController> statusBarKeyguardViewManagerLazy,
DismissCallbackRegistry dismissCallbackRegistry,
KeyguardUpdateMonitor updateMonitor,
DumpManager dumpManager,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index 0644a42202d5..31db8eb404a9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -42,6 +42,7 @@ import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
+import com.android.keyguard.KeyguardViewController;
import com.android.keyguard.ViewMediatorCallback;
import com.android.settingslib.animation.AppearAnimationUtils;
import com.android.systemui.DejankUtils;
@@ -77,7 +78,8 @@ import javax.inject.Singleton;
@Singleton
public class StatusBarKeyguardViewManager implements RemoteInputController.Callback,
StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener,
- PanelExpansionListener, NavigationModeController.ModeChangedListener {
+ PanelExpansionListener, NavigationModeController.ModeChangedListener,
+ KeyguardViewController {
// When hiding the Keyguard with timing supplied from WindowManager, better be early than late.
private static final long HIDE_TIMING_CORRECTION_MS = - 16 * 3;
@@ -221,6 +223,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mDockManager = dockManager;
}
+ @Override
public void registerStatusBar(StatusBar statusBar,
ViewGroup container,
NotificationPanelViewController notificationPanelViewController,
@@ -326,6 +329,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
* Show the keyguard. Will handle creating and attaching to the view manager
* lazily.
*/
+ @Override
public void show(Bundle options) {
mShowing = true;
mNotificationShadeWindowController.setKeyguardShowing(true);
@@ -430,9 +434,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mAfterKeyguardGoneRunnables.add(runnable);
}
- /**
- * Reset the state of the view.
- */
+ @Override
public void reset(boolean hideBouncerWhenShowing) {
if (mShowing) {
if (mOccluded && !mDozing) {
@@ -452,23 +454,28 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
return mGoingToSleepVisibleNotOccluded;
}
+ @Override
public void onStartedGoingToSleep() {
mGoingToSleepVisibleNotOccluded = isShowing() && !isOccluded();
}
+ @Override
public void onFinishedGoingToSleep() {
mGoingToSleepVisibleNotOccluded = false;
mBouncer.onScreenTurnedOff();
}
+ @Override
public void onStartedWakingUp() {
// TODO: remove
}
+ @Override
public void onScreenTurningOn() {
// TODO: remove
}
+ @Override
public void onScreenTurnedOn() {
// TODO: remove
}
@@ -503,14 +510,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
}
}
+ @Override
public void setNeedsInput(boolean needsInput) {
mNotificationShadeWindowController.setKeyguardNeedsInput(needsInput);
}
+ @Override
public boolean isUnlockWithWallpaper() {
return mNotificationShadeWindowController.isShowingWallpaper();
}
+ @Override
public void setOccluded(boolean occluded, boolean animate) {
mStatusBar.setOccluded(occluded);
if (occluded && !mOccluded && mShowing) {
@@ -554,13 +564,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
return mOccluded;
}
- /**
- * Starts the animation before we dismiss Keyguard, i.e. an disappearing animation on the
- * security view of the bouncer.
- *
- * @param finishRunnable the runnable to be run after the animation finished, or {@code null} if
- * no action should be run
- */
+ @Override
public void startPreHideAnimation(Runnable finishRunnable) {
if (mBouncer.isShowing()) {
mBouncer.startPreHideAnimation(finishRunnable);
@@ -572,9 +576,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
updateLockIcon();
}
- /**
- * Hides the keyguard view
- */
+ @Override
public void hide(long startTime, long fadeoutDuration) {
mShowing = false;
mKeyguardStateController.notifyKeyguardState(mShowing,
@@ -728,9 +730,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mAfterKeyguardGoneRunnables.clear();
}
- /**
- * Dismisses the keyguard by going to the next screen or making it gone.
- */
+ @Override
public void dismissAndCollapse() {
mStatusBar.executeRunnableDismissingKeyguard(null, null, true, false, true);
}
@@ -742,9 +742,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
return mBouncer.isSecure();
}
- /**
- * @return Whether the keyguard is showing
- */
+ @Override
public boolean isShowing() {
return mShowing;
}
@@ -921,18 +919,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mViewMediatorCallback.readyForKeyguardDone();
}
+ @Override
public boolean shouldDisableWindowAnimationsForUnlock() {
return mStatusBar.isInLaunchTransition();
}
-
- /**
- * @return Whether subtle animation should be used for unlocking the device.
- */
+ @Override
public boolean shouldSubtleWindowAnimationsForUnlock() {
return needsBypassFading();
}
+ @Override
public boolean isGoingToNotificationShade() {
return mStatusBarStateController.leaveOpenOnKeyguardHide();
}
@@ -941,13 +938,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
return mBouncer.isSecure() || mLockPatternUtils.isSecure(userId);
}
+ @Override
public void keyguardGoingAway() {
mStatusBar.keyguardGoingAway();
}
- /**
- * Called when cancel button in bouncer is pressed.
- */
+ @Override
public void onCancelClicked() {
// No-op
}
@@ -964,6 +960,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mBouncer.showMessage(message, colorState);
}
+ @Override
public ViewRootImpl getViewRootImpl() {
return mStatusBar.getStatusBarView().getViewRootImpl();
}