DO NOT MERGE Create KeyguardViewController that extracts view-related logic in KeyguardViewMediator and re-wire Dagger accordingly. am: 198b5dc318

Change-Id: I3ccbe4a0557992a8e17f7abc624a25ea85dd449c
This commit is contained in:
Automerger Merge Worker
2020-03-06 20:57:59 +00:00
6 changed files with 252 additions and 58 deletions

View File

@@ -21,6 +21,7 @@ import static com.android.systemui.Dependency.LEAK_REPORT_EMAIL_NAME;
import android.content.Context; import android.content.Context;
import com.android.keyguard.KeyguardViewController;
import com.android.systemui.car.CarDeviceProvisionedControllerImpl; import com.android.systemui.car.CarDeviceProvisionedControllerImpl;
import com.android.systemui.car.CarNotificationInterruptionStateProvider; import com.android.systemui.car.CarNotificationInterruptionStateProvider;
import com.android.systemui.dagger.SystemUIRootComponent; import com.android.systemui.dagger.SystemUIRootComponent;
@@ -135,6 +136,10 @@ abstract class CarSystemUIModule {
abstract StatusBarKeyguardViewManager bindStatusBarKeyguardViewManager( abstract StatusBarKeyguardViewManager bindStatusBarKeyguardViewManager(
CarStatusBarKeyguardViewManager keyguardViewManager); CarStatusBarKeyguardViewManager keyguardViewManager);
@Binds
abstract KeyguardViewController bindKeyguardViewController(
CarStatusBarKeyguardViewManager keyguardViewManager);
@Binds @Binds
abstract DeviceProvisionedController bindDeviceProvisionedController( abstract DeviceProvisionedController bindDeviceProvisionedController(
CarDeviceProvisionedControllerImpl deviceProvisionedController); CarDeviceProvisionedControllerImpl deviceProvisionedController);

View File

@@ -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);
}

View File

@@ -23,6 +23,7 @@ import android.content.Context;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.android.keyguard.KeyguardViewController;
import com.android.systemui.dock.DockManager; import com.android.systemui.dock.DockManager;
import com.android.systemui.dock.DockManagerImpl; import com.android.systemui.dock.DockManagerImpl;
import com.android.systemui.plugins.statusbar.StatusBarStateController; 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.NotificationGroupManager;
import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.ShadeControllerImpl; 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.ConfigurationController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl; import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl;
@@ -117,4 +119,8 @@ public abstract class SystemUIDefaultModule {
@Binds @Binds
abstract DeviceProvisionedController bindDeviceProvisionedController( abstract DeviceProvisionedController bindDeviceProvisionedController(
DeviceProvisionedControllerImpl deviceProvisionedController); DeviceProvisionedControllerImpl deviceProvisionedController);
@Binds
abstract KeyguardViewController bindKeyguardViewController(
StatusBarKeyguardViewManager statusBarKeyguardViewManager);
} }

View File

@@ -80,6 +80,7 @@ import com.android.keyguard.KeyguardDisplayManager;
import com.android.keyguard.KeyguardSecurityView; import com.android.keyguard.KeyguardSecurityView;
import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.KeyguardViewController;
import com.android.keyguard.ViewMediatorCallback; import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.Dumpable; import com.android.systemui.Dumpable;
import com.android.systemui.R; 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.NotificationPanelViewController;
import com.android.systemui.statusbar.phone.NotificationShadeWindowController; import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.StatusBar; 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.DeviceConfigProxy;
import com.android.systemui.util.InjectionInflationController; import com.android.systemui.util.InjectionInflationController;
@@ -236,7 +236,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
*/ */
private PowerManager.WakeLock mShowKeyguardWakeLock; private PowerManager.WakeLock mShowKeyguardWakeLock;
private final Lazy<StatusBarKeyguardViewManager> mStatusBarKeyguardViewManagerLazy; private final Lazy<KeyguardViewController> mKeyguardViewControllerLazy;
// these are protected by synchronized (this) // these are protected by synchronized (this)
@@ -601,7 +601,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
@Override @Override
public void setNeedsInput(boolean needsInput) { public void setNeedsInput(boolean needsInput) {
mStatusBarKeyguardViewManagerLazy.get().setNeedsInput(needsInput); mKeyguardViewControllerLazy.get().setNeedsInput(needsInput);
} }
@Override @Override
@@ -615,7 +615,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
mKeyguardDonePending = true; mKeyguardDonePending = true;
mHideAnimationRun = true; mHideAnimationRun = true;
mHideAnimationRunning = true; mHideAnimationRunning = true;
mStatusBarKeyguardViewManagerLazy.get() mKeyguardViewControllerLazy.get()
.startPreHideAnimation(mHideAnimationFinishedRunnable); .startPreHideAnimation(mHideAnimationFinishedRunnable);
mHandler.sendEmptyMessageDelayed(KEYGUARD_DONE_PENDING_TIMEOUT, mHandler.sendEmptyMessageDelayed(KEYGUARD_DONE_PENDING_TIMEOUT,
KEYGUARD_DONE_PENDING_TIMEOUT_MS); KEYGUARD_DONE_PENDING_TIMEOUT_MS);
@@ -647,7 +647,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
@Override @Override
public void onCancelClicked() { public void onCancelClicked() {
mStatusBarKeyguardViewManagerLazy.get().onCancelClicked(); mKeyguardViewControllerLazy.get().onCancelClicked();
} }
@Override @Override
@@ -715,7 +715,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
LockPatternUtils lockPatternUtils, LockPatternUtils lockPatternUtils,
BroadcastDispatcher broadcastDispatcher, BroadcastDispatcher broadcastDispatcher,
NotificationShadeWindowController notificationShadeWindowController, NotificationShadeWindowController notificationShadeWindowController,
Lazy<StatusBarKeyguardViewManager> statusBarKeyguardViewManagerLazy, Lazy<KeyguardViewController> statusBarKeyguardViewManagerLazy,
DismissCallbackRegistry dismissCallbackRegistry, DismissCallbackRegistry dismissCallbackRegistry,
KeyguardUpdateMonitor keyguardUpdateMonitor, DumpManager dumpManager, KeyguardUpdateMonitor keyguardUpdateMonitor, DumpManager dumpManager,
@UiBackground Executor uiBgExecutor, PowerManager powerManager, @UiBackground Executor uiBgExecutor, PowerManager powerManager,
@@ -726,7 +726,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
mLockPatternUtils = lockPatternUtils; mLockPatternUtils = lockPatternUtils;
mBroadcastDispatcher = broadcastDispatcher; mBroadcastDispatcher = broadcastDispatcher;
mNotificationShadeWindowController = notificationShadeWindowController; mNotificationShadeWindowController = notificationShadeWindowController;
mStatusBarKeyguardViewManagerLazy = statusBarKeyguardViewManagerLazy; mKeyguardViewControllerLazy = statusBarKeyguardViewManagerLazy;
mDismissCallbackRegistry = dismissCallbackRegistry; mDismissCallbackRegistry = dismissCallbackRegistry;
mUiBgExecutor = uiBgExecutor; mUiBgExecutor = uiBgExecutor;
mUpdateMonitor = keyguardUpdateMonitor; mUpdateMonitor = keyguardUpdateMonitor;
@@ -1288,7 +1288,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
if (mOccluded != isOccluded) { if (mOccluded != isOccluded) {
mOccluded = isOccluded; mOccluded = isOccluded;
mUpdateMonitor.setKeyguardOccluded(isOccluded); mUpdateMonitor.setKeyguardOccluded(isOccluded);
mStatusBarKeyguardViewManagerLazy.get().setOccluded(isOccluded, animate mKeyguardViewControllerLazy.get().setOccluded(isOccluded, animate
&& mDeviceInteractive); && mDeviceInteractive);
adjustStatusBarLocked(); adjustStatusBarLocked();
} }
@@ -1359,7 +1359,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
} }
// if the keyguard is already showing, don't bother // 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"); if (DEBUG) Log.d(TAG, "doKeyguard: not showing because it is already showing");
resetStateLocked(); resetStateLocked();
return; return;
@@ -1423,7 +1423,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
mDismissCallbackRegistry.addCallback(callback); mDismissCallbackRegistry.addCallback(callback);
} }
mCustomMessage = message; mCustomMessage = message;
mStatusBarKeyguardViewManagerLazy.get().dismissAndCollapse(); mKeyguardViewControllerLazy.get().dismissAndCollapse();
} else if (callback != null) { } else if (callback != null) {
new DismissCallbackWrapper(callback).notifyDismissError(); new DismissCallbackWrapper(callback).notifyDismissError();
} }
@@ -1690,7 +1690,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
} else if (!mHideAnimationRun) { } else if (!mHideAnimationRun) {
mHideAnimationRun = true; mHideAnimationRun = true;
mHideAnimationRunning = true; mHideAnimationRunning = true;
mStatusBarKeyguardViewManagerLazy.get() mKeyguardViewControllerLazy.get()
.startPreHideAnimation(mHideAnimationFinishedRunnable); .startPreHideAnimation(mHideAnimationFinishedRunnable);
} }
} }
@@ -1847,7 +1847,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
mHiding = false; mHiding = false;
mWakeAndUnlocking = false; mWakeAndUnlocking = false;
setShowingLocked(true); setShowingLocked(true);
mStatusBarKeyguardViewManagerLazy.get().show(options); mKeyguardViewControllerLazy.get().show(options);
resetKeyguardDonePendingLocked(); resetKeyguardDonePendingLocked();
mHideAnimationRun = false; mHideAnimationRun = false;
adjustStatusBarLocked(); adjustStatusBarLocked();
@@ -1872,22 +1872,22 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
public void run() { public void run() {
Trace.beginSection("KeyguardViewMediator.mKeyGuardGoingAwayRunnable"); Trace.beginSection("KeyguardViewMediator.mKeyGuardGoingAwayRunnable");
if (DEBUG) Log.d(TAG, "keyguardGoingAway"); if (DEBUG) Log.d(TAG, "keyguardGoingAway");
mStatusBarKeyguardViewManagerLazy.get().keyguardGoingAway(); mKeyguardViewControllerLazy.get().keyguardGoingAway();
int flags = 0; int flags = 0;
if (mStatusBarKeyguardViewManagerLazy.get().shouldDisableWindowAnimationsForUnlock() if (mKeyguardViewControllerLazy.get().shouldDisableWindowAnimationsForUnlock()
|| (mWakeAndUnlocking && !mPulsing)) { || (mWakeAndUnlocking && !mPulsing)) {
flags |= WindowManagerPolicyConstants flags |= WindowManagerPolicyConstants
.KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS; .KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS;
} }
if (mStatusBarKeyguardViewManagerLazy.get().isGoingToNotificationShade() if (mKeyguardViewControllerLazy.get().isGoingToNotificationShade()
|| (mWakeAndUnlocking && mPulsing)) { || (mWakeAndUnlocking && mPulsing)) {
flags |= WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE; flags |= WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE;
} }
if (mStatusBarKeyguardViewManagerLazy.get().isUnlockWithWallpaper()) { if (mKeyguardViewControllerLazy.get().isUnlockWithWallpaper()) {
flags |= WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER; flags |= WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER;
} }
if (mStatusBarKeyguardViewManagerLazy.get().shouldSubtleWindowAnimationsForUnlock()) { if (mKeyguardViewControllerLazy.get().shouldSubtleWindowAnimationsForUnlock()) {
flags |= WindowManagerPolicyConstants flags |= WindowManagerPolicyConstants
.KEYGUARD_GOING_AWAY_FLAG_SUBTLE_WINDOW_ANIMATIONS; .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 // 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 // the next draw from here so we don't have to wait for window manager to signal
// this to our ViewRootImpl. // this to our ViewRootImpl.
mStatusBarKeyguardViewManagerLazy.get().getViewRootImpl().setReportNextDraw(); mKeyguardViewControllerLazy.get().getViewRootImpl().setReportNextDraw();
notifyDrawn(mDrawnCallback); notifyDrawn(mDrawnCallback);
mDrawnCallback = null; mDrawnCallback = null;
} }
@@ -1987,7 +1987,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
setShowingLocked(false); setShowingLocked(false);
mWakeAndUnlocking = false; mWakeAndUnlocking = false;
mDismissCallbackRegistry.notifyDismissSucceeded(); mDismissCallbackRegistry.notifyDismissSucceeded();
mStatusBarKeyguardViewManagerLazy.get().hide(startTime, fadeoutDuration); mKeyguardViewControllerLazy.get().hide(startTime, fadeoutDuration);
resetKeyguardDonePendingLocked(); resetKeyguardDonePendingLocked();
mHideAnimationRun = false; mHideAnimationRun = false;
adjustStatusBarLocked(); adjustStatusBarLocked();
@@ -2036,7 +2036,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
private void handleReset() { private void handleReset() {
synchronized (KeyguardViewMediator.this) { synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleReset"); 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) { synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleVerifyUnlock"); if (DEBUG) Log.d(TAG, "handleVerifyUnlock");
setShowingLocked(true); setShowingLocked(true);
mStatusBarKeyguardViewManagerLazy.get().dismissAndCollapse(); mKeyguardViewControllerLazy.get().dismissAndCollapse();
} }
Trace.endSection(); Trace.endSection();
} }
@@ -2057,7 +2057,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
private void handleNotifyStartedGoingToSleep() { private void handleNotifyStartedGoingToSleep() {
synchronized (KeyguardViewMediator.this) { synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleNotifyStartedGoingToSleep"); 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() { private void handleNotifyFinishedGoingToSleep() {
synchronized (KeyguardViewMediator.this) { synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleNotifyFinishedGoingToSleep"); 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"); Trace.beginSection("KeyguardViewMediator#handleMotifyStartedWakingUp");
synchronized (KeyguardViewMediator.this) { synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleNotifyWakingUp"); if (DEBUG) Log.d(TAG, "handleNotifyWakingUp");
mStatusBarKeyguardViewManagerLazy.get().onStartedWakingUp(); mKeyguardViewControllerLazy.get().onStartedWakingUp();
} }
Trace.endSection(); Trace.endSection();
} }
@@ -2085,7 +2085,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
Trace.beginSection("KeyguardViewMediator#handleNotifyScreenTurningOn"); Trace.beginSection("KeyguardViewMediator#handleNotifyScreenTurningOn");
synchronized (KeyguardViewMediator.this) { synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleNotifyScreenTurningOn"); if (DEBUG) Log.d(TAG, "handleNotifyScreenTurningOn");
mStatusBarKeyguardViewManagerLazy.get().onScreenTurningOn(); mKeyguardViewControllerLazy.get().onScreenTurningOn();
if (callback != null) { if (callback != null) {
if (mWakeAndUnlocking) { if (mWakeAndUnlocking) {
mDrawnCallback = callback; mDrawnCallback = callback;
@@ -2104,7 +2104,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
} }
synchronized (this) { synchronized (this) {
if (DEBUG) Log.d(TAG, "handleNotifyScreenTurnedOn"); if (DEBUG) Log.d(TAG, "handleNotifyScreenTurnedOn");
mStatusBarKeyguardViewManagerLazy.get().onScreenTurnedOn(); mKeyguardViewControllerLazy.get().onScreenTurnedOn();
} }
Trace.endSection(); Trace.endSection();
} }
@@ -2148,14 +2148,26 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
Trace.endSection(); 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, ViewGroup container, NotificationPanelViewController panelView,
BiometricUnlockController biometricUnlockController, ViewGroup lockIconContainer, BiometricUnlockController biometricUnlockController, ViewGroup lockIconContainer,
View notificationContainer, KeyguardBypassController bypassController) { View notificationContainer, KeyguardBypassController bypassController) {
mStatusBarKeyguardViewManagerLazy.get().registerStatusBar(statusBar, container, panelView, mKeyguardViewControllerLazy.get().registerStatusBar(statusBar, container, panelView,
biometricUnlockController, mDismissCallbackRegistry, lockIconContainer, biometricUnlockController, mDismissCallbackRegistry, lockIconContainer,
notificationContainer, bypassController, mFalsingManager); notificationContainer, bypassController, mFalsingManager);
return mStatusBarKeyguardViewManagerLazy.get(); return mKeyguardViewControllerLazy.get();
} }
public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) { public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) {

View File

@@ -22,6 +22,7 @@ import android.os.PowerManager;
import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardViewController;
import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.qualifiers.UiBackground; import com.android.systemui.dagger.qualifiers.UiBackground;
import com.android.systemui.dump.DumpManager; 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.plugins.FalsingManager;
import com.android.systemui.statusbar.phone.NotificationShadeWindowController; import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.StatusBar; 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.DeviceConfigProxy;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
@@ -57,7 +57,7 @@ public class KeyguardModule {
LockPatternUtils lockPatternUtils, LockPatternUtils lockPatternUtils,
BroadcastDispatcher broadcastDispatcher, BroadcastDispatcher broadcastDispatcher,
NotificationShadeWindowController notificationShadeWindowController, NotificationShadeWindowController notificationShadeWindowController,
Lazy<StatusBarKeyguardViewManager> statusBarKeyguardViewManagerLazy, Lazy<KeyguardViewController> statusBarKeyguardViewManagerLazy,
DismissCallbackRegistry dismissCallbackRegistry, DismissCallbackRegistry dismissCallbackRegistry,
KeyguardUpdateMonitor updateMonitor, KeyguardUpdateMonitor updateMonitor,
DumpManager dumpManager, DumpManager dumpManager,

View File

@@ -42,6 +42,7 @@ import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.KeyguardViewController;
import com.android.keyguard.ViewMediatorCallback; import com.android.keyguard.ViewMediatorCallback;
import com.android.settingslib.animation.AppearAnimationUtils; import com.android.settingslib.animation.AppearAnimationUtils;
import com.android.systemui.DejankUtils; import com.android.systemui.DejankUtils;
@@ -77,7 +78,8 @@ import javax.inject.Singleton;
@Singleton @Singleton
public class StatusBarKeyguardViewManager implements RemoteInputController.Callback, public class StatusBarKeyguardViewManager implements RemoteInputController.Callback,
StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener, 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. // When hiding the Keyguard with timing supplied from WindowManager, better be early than late.
private static final long HIDE_TIMING_CORRECTION_MS = - 16 * 3; private static final long HIDE_TIMING_CORRECTION_MS = - 16 * 3;
@@ -221,6 +223,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mDockManager = dockManager; mDockManager = dockManager;
} }
@Override
public void registerStatusBar(StatusBar statusBar, public void registerStatusBar(StatusBar statusBar,
ViewGroup container, ViewGroup container,
NotificationPanelViewController notificationPanelViewController, NotificationPanelViewController notificationPanelViewController,
@@ -326,6 +329,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
* Show the keyguard. Will handle creating and attaching to the view manager * Show the keyguard. Will handle creating and attaching to the view manager
* lazily. * lazily.
*/ */
@Override
public void show(Bundle options) { public void show(Bundle options) {
mShowing = true; mShowing = true;
mNotificationShadeWindowController.setKeyguardShowing(true); mNotificationShadeWindowController.setKeyguardShowing(true);
@@ -430,9 +434,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mAfterKeyguardGoneRunnables.add(runnable); mAfterKeyguardGoneRunnables.add(runnable);
} }
/** @Override
* Reset the state of the view.
*/
public void reset(boolean hideBouncerWhenShowing) { public void reset(boolean hideBouncerWhenShowing) {
if (mShowing) { if (mShowing) {
if (mOccluded && !mDozing) { if (mOccluded && !mDozing) {
@@ -452,23 +454,28 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
return mGoingToSleepVisibleNotOccluded; return mGoingToSleepVisibleNotOccluded;
} }
@Override
public void onStartedGoingToSleep() { public void onStartedGoingToSleep() {
mGoingToSleepVisibleNotOccluded = isShowing() && !isOccluded(); mGoingToSleepVisibleNotOccluded = isShowing() && !isOccluded();
} }
@Override
public void onFinishedGoingToSleep() { public void onFinishedGoingToSleep() {
mGoingToSleepVisibleNotOccluded = false; mGoingToSleepVisibleNotOccluded = false;
mBouncer.onScreenTurnedOff(); mBouncer.onScreenTurnedOff();
} }
@Override
public void onStartedWakingUp() { public void onStartedWakingUp() {
// TODO: remove // TODO: remove
} }
@Override
public void onScreenTurningOn() { public void onScreenTurningOn() {
// TODO: remove // TODO: remove
} }
@Override
public void onScreenTurnedOn() { public void onScreenTurnedOn() {
// TODO: remove // TODO: remove
} }
@@ -503,14 +510,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
} }
} }
@Override
public void setNeedsInput(boolean needsInput) { public void setNeedsInput(boolean needsInput) {
mNotificationShadeWindowController.setKeyguardNeedsInput(needsInput); mNotificationShadeWindowController.setKeyguardNeedsInput(needsInput);
} }
@Override
public boolean isUnlockWithWallpaper() { public boolean isUnlockWithWallpaper() {
return mNotificationShadeWindowController.isShowingWallpaper(); return mNotificationShadeWindowController.isShowingWallpaper();
} }
@Override
public void setOccluded(boolean occluded, boolean animate) { public void setOccluded(boolean occluded, boolean animate) {
mStatusBar.setOccluded(occluded); mStatusBar.setOccluded(occluded);
if (occluded && !mOccluded && mShowing) { if (occluded && !mOccluded && mShowing) {
@@ -554,13 +564,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
return mOccluded; return mOccluded;
} }
/** @Override
* 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
*/
public void startPreHideAnimation(Runnable finishRunnable) { public void startPreHideAnimation(Runnable finishRunnable) {
if (mBouncer.isShowing()) { if (mBouncer.isShowing()) {
mBouncer.startPreHideAnimation(finishRunnable); mBouncer.startPreHideAnimation(finishRunnable);
@@ -572,9 +576,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
updateLockIcon(); updateLockIcon();
} }
/** @Override
* Hides the keyguard view
*/
public void hide(long startTime, long fadeoutDuration) { public void hide(long startTime, long fadeoutDuration) {
mShowing = false; mShowing = false;
mKeyguardStateController.notifyKeyguardState(mShowing, mKeyguardStateController.notifyKeyguardState(mShowing,
@@ -728,9 +730,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mAfterKeyguardGoneRunnables.clear(); mAfterKeyguardGoneRunnables.clear();
} }
/** @Override
* Dismisses the keyguard by going to the next screen or making it gone.
*/
public void dismissAndCollapse() { public void dismissAndCollapse() {
mStatusBar.executeRunnableDismissingKeyguard(null, null, true, false, true); mStatusBar.executeRunnableDismissingKeyguard(null, null, true, false, true);
} }
@@ -742,9 +742,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
return mBouncer.isSecure(); return mBouncer.isSecure();
} }
/** @Override
* @return Whether the keyguard is showing
*/
public boolean isShowing() { public boolean isShowing() {
return mShowing; return mShowing;
} }
@@ -921,18 +919,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mViewMediatorCallback.readyForKeyguardDone(); mViewMediatorCallback.readyForKeyguardDone();
} }
@Override
public boolean shouldDisableWindowAnimationsForUnlock() { public boolean shouldDisableWindowAnimationsForUnlock() {
return mStatusBar.isInLaunchTransition(); return mStatusBar.isInLaunchTransition();
} }
@Override
/**
* @return Whether subtle animation should be used for unlocking the device.
*/
public boolean shouldSubtleWindowAnimationsForUnlock() { public boolean shouldSubtleWindowAnimationsForUnlock() {
return needsBypassFading(); return needsBypassFading();
} }
@Override
public boolean isGoingToNotificationShade() { public boolean isGoingToNotificationShade() {
return mStatusBarStateController.leaveOpenOnKeyguardHide(); return mStatusBarStateController.leaveOpenOnKeyguardHide();
} }
@@ -941,13 +938,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
return mBouncer.isSecure() || mLockPatternUtils.isSecure(userId); return mBouncer.isSecure() || mLockPatternUtils.isSecure(userId);
} }
@Override
public void keyguardGoingAway() { public void keyguardGoingAway() {
mStatusBar.keyguardGoingAway(); mStatusBar.keyguardGoingAway();
} }
/** @Override
* Called when cancel button in bouncer is pressed.
*/
public void onCancelClicked() { public void onCancelClicked() {
// No-op // No-op
} }
@@ -964,6 +960,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mBouncer.showMessage(message, colorState); mBouncer.showMessage(message, colorState);
} }
@Override
public ViewRootImpl getViewRootImpl() { public ViewRootImpl getViewRootImpl() {
return mStatusBar.getStatusBarView().getViewRootImpl(); return mStatusBar.getStatusBarView().getViewRootImpl();
} }