Merge "Single source of truth for auth state"
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
index 35eb272..8d167e8 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -49,7 +49,7 @@
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.SystemUIFactory;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.InjectionInflationController;
public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSecurityView {
@@ -94,7 +94,7 @@
private final SpringAnimation mSpringAnimation;
private final VelocityTracker mVelocityTracker = VelocityTracker.obtain();
private final KeyguardUpdateMonitor mUpdateMonitor;
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class);
private float mLastTouchY = -1;
@@ -134,8 +134,8 @@
mSpringAnimation = new SpringAnimation(this, DynamicAnimation.Y);
mInjectionInflationController = new InjectionInflationController(
SystemUIFactory.getInstance().getRootComponent());
- mUnlockMethodCache = UnlockMethodCache.getInstance(context);
mViewConfiguration = ViewConfiguration.get(context);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
}
public void setSecurityCallback(SecurityCallback callback) {
@@ -272,7 +272,7 @@
*/
private void updateBiometricRetry() {
SecurityMode securityMode = getSecurityMode();
- mSwipeUpToRetry = mUnlockMethodCache.isFaceAuthEnabled()
+ mSwipeUpToRetry = mKeyguardStateController.isFaceAuthEnabled()
&& securityMode != SecurityMode.SimPin
&& securityMode != SecurityMode.SimPuk
&& securityMode != SecurityMode.None;
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index 7771f86..37bb54c 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -97,7 +97,7 @@
import com.android.systemui.statusbar.policy.ExtensionController;
import com.android.systemui.statusbar.policy.FlashlightController;
import com.android.systemui.statusbar.policy.HotspotController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.NextAlarmController;
@@ -221,7 +221,7 @@
@Inject Lazy<FlashlightController> mFlashlightController;
@Inject Lazy<UserSwitcherController> mUserSwitcherController;
@Inject Lazy<UserInfoController> mUserInfoController;
- @Inject Lazy<KeyguardMonitor> mKeyguardMonitor;
+ @Inject Lazy<KeyguardStateController> mKeyguardMonitor;
@Inject Lazy<KeyguardUpdateMonitor> mKeyguardUpdateMonitor;
@Inject Lazy<BatteryController> mBatteryController;
@Inject Lazy<NightDisplayListener> mNightDisplayListener;
@@ -355,7 +355,7 @@
mProviders.put(FlashlightController.class, mFlashlightController::get);
- mProviders.put(KeyguardMonitor.class, mKeyguardMonitor::get);
+ mProviders.put(KeyguardStateController.class, mKeyguardMonitor::get);
mProviders.put(KeyguardUpdateMonitor.class, mKeyguardUpdateMonitor::get);
diff --git a/packages/SystemUI/src/com/android/systemui/DependencyBinder.java b/packages/SystemUI/src/com/android/systemui/DependencyBinder.java
index 4df7f0d..818b5e1 100644
--- a/packages/SystemUI/src/com/android/systemui/DependencyBinder.java
+++ b/packages/SystemUI/src/com/android/systemui/DependencyBinder.java
@@ -48,8 +48,8 @@
import com.android.systemui.statusbar.policy.FlashlightControllerImpl;
import com.android.systemui.statusbar.policy.HotspotController;
import com.android.systemui.statusbar.policy.HotspotControllerImpl;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
-import com.android.systemui.statusbar.policy.KeyguardMonitorImpl;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
+import com.android.systemui.statusbar.policy.KeyguardStateControllerImpl;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.LocationControllerImpl;
import com.android.systemui.statusbar.policy.NetworkController;
@@ -146,7 +146,8 @@
/**
*/
@Binds
- public abstract KeyguardMonitor provideKeyguardMonitor(KeyguardMonitorImpl controllerImpl);
+ public abstract KeyguardStateController provideKeyguardMonitor(
+ KeyguardStateControllerImpl controllerImpl);
/**
*/
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
index 8e69318..530dcdc 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
@@ -47,8 +47,7 @@
import com.android.systemui.statusbar.phone.ScrimState;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.volume.VolumeDialogComponent;
import java.util.function.Consumer;
@@ -136,10 +135,11 @@
LockPatternUtils lockPatternUtils, ViewGroup container,
DismissCallbackRegistry dismissCallbackRegistry,
KeyguardBouncer.BouncerExpansionCallback expansionCallback,
- FalsingManager falsingManager, KeyguardBypassController bypassController) {
+ KeyguardStateController keyguardStateController, FalsingManager falsingManager,
+ KeyguardBypassController bypassController) {
return new KeyguardBouncer(context, callback, lockPatternUtils, container,
dismissCallbackRegistry, falsingManager,
- expansionCallback, UnlockMethodCache.getInstance(context),
+ expansionCallback, keyguardStateController,
Dependency.get(KeyguardUpdateMonitor.class), bypassController,
new Handler(Looper.getMainLooper()));
}
@@ -149,9 +149,9 @@
LockscreenWallpaper lockscreenWallpaper,
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
- AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
+ AlarmManager alarmManager, KeyguardStateController keyguardStateController) {
return new ScrimController(scrimBehind, scrimInFront, scrimForBubble, scrimStateListener,
- scrimVisibleListener, dozeParameters, alarmManager, keyguardMonitor);
+ scrimVisibleListener, dozeParameters, alarmManager, keyguardStateController);
}
public NotificationIconAreaController createNotificationIconAreaController(Context context,
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index 8eeb629..57a5ae635 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -96,8 +96,8 @@
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.StatusBarWindowController;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
import com.android.systemui.statusbar.policy.ConfigurationController;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.EmergencyDialerConstants;
import com.android.systemui.util.leak.RotationUtils;
import com.android.systemui.volume.SystemUIInterpolators.LogAccelerateInterpolator;
@@ -213,14 +213,17 @@
Dependency.get(ConfigurationController.class).addCallback(this);
mActivityStarter = Dependency.get(ActivityStarter.class);
- UnlockMethodCache unlockMethodCache = UnlockMethodCache.getInstance(context);
- unlockMethodCache.addListener(
- () -> {
- if (mDialog != null && mDialog.mPanelController != null) {
- boolean locked = !unlockMethodCache.canSkipBouncer();
- mDialog.mPanelController.onDeviceLockStateChanged(locked);
- }
- });
+ KeyguardStateController keyguardStateController =
+ Dependency.get(KeyguardStateController.class);
+ keyguardStateController.addCallback(new KeyguardStateController.Callback() {
+ @Override
+ public void onUnlockedChanged() {
+ if (mDialog != null && mDialog.mPanelController != null) {
+ boolean locked = !keyguardStateController.canDismissLockScreen();
+ mDialog.mPanelController.onDeviceLockStateChanged(locked);
+ }
+ }
+ });
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
index 6f8665a8..b9fe827 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
@@ -40,14 +40,14 @@
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.ExtensionController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
public class GlobalActionsImpl implements GlobalActions, CommandQueue.Callbacks {
private static final float SHUTDOWN_SCRIM_ALPHA = 0.95f;
private final Context mContext;
- private final KeyguardMonitor mKeyguardMonitor;
+ private final KeyguardStateController mKeyguardStateController;
private final DeviceProvisionedController mDeviceProvisionedController;
private final ExtensionController.Extension<GlobalActionsPanelPlugin> mPanelExtension;
private GlobalActionsDialog mGlobalActions;
@@ -55,7 +55,7 @@
public GlobalActionsImpl(Context context) {
mContext = context;
- mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class);
SysUiServiceProvider.getComponent(context, CommandQueue.class).addCallback(this);
mPanelExtension = Dependency.get(ExtensionController.class)
@@ -79,7 +79,7 @@
if (mGlobalActions == null) {
mGlobalActions = new GlobalActionsDialog(mContext, manager);
}
- mGlobalActions.showDialog(mKeyguardMonitor.isShowing(),
+ mGlobalActions.showDialog(mKeyguardStateController.isShowing(),
mDeviceProvisionedController.isDeviceProvisioned(),
mPanelExtension.get());
Dependency.get(KeyguardUpdateMonitor.class).requestFaceAuth();
diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
index 38153ec..7fb5207 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java
@@ -46,8 +46,8 @@
import com.android.systemui.qs.QSTileHost;
import com.android.systemui.statusbar.phone.LightBarController;
import com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
-import com.android.systemui.statusbar.policy.KeyguardMonitor.Callback;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
+import com.android.systemui.statusbar.policy.KeyguardStateController.Callback;
import java.util.ArrayList;
import java.util.List;
@@ -68,7 +68,7 @@
private final QSDetailClipper mClipper;
private final LightBarController mLightBarController;
- private KeyguardMonitor mKeyguardMonitor;
+ private KeyguardStateController mKeyguardStateController;
private final ScreenLifecycle mScreenLifecycle;
private final TileQueryHelper mTileQueryHelper;
private final View mTransparentView;
@@ -89,7 +89,7 @@
@Inject
public QSCustomizer(Context context, AttributeSet attrs,
LightBarController lightBarController,
- KeyguardMonitor keyguardMonitor,
+ KeyguardStateController keyguardStateController,
ScreenLifecycle screenLifecycle) {
super(new ContextThemeWrapper(context, R.style.edit_theme), attrs);
@@ -124,7 +124,7 @@
animator.setMoveDuration(TileAdapter.MOVE_DURATION);
mRecyclerView.setItemAnimator(animator);
mLightBarController = lightBarController;
- mKeyguardMonitor = keyguardMonitor;
+ mKeyguardStateController = keyguardStateController;
mScreenLifecycle = screenLifecycle;
updateNavBackDrop(getResources().getConfiguration());
}
@@ -187,7 +187,7 @@
queryTiles();
mNotifQsContainer.setCustomizerAnimating(true);
mNotifQsContainer.setCustomizerShowing(true);
- mKeyguardMonitor.addCallback(mKeyguardCallback);
+ mKeyguardStateController.addCallback(mKeyguardCallback);
updateNavColors();
}
}
@@ -203,7 +203,7 @@
queryTiles();
mNotifQsContainer.setCustomizerAnimating(false);
mNotifQsContainer.setCustomizerShowing(true);
- mKeyguardMonitor.addCallback(mKeyguardCallback);
+ mKeyguardStateController.addCallback(mKeyguardCallback);
updateNavColors();
}
}
@@ -227,7 +227,7 @@
}
mNotifQsContainer.setCustomizerAnimating(animate);
mNotifQsContainer.setCustomizerShowing(false);
- mKeyguardMonitor.removeCallback(mKeyguardCallback);
+ mKeyguardStateController.removeCallback(mKeyguardCallback);
updateNavColors();
}
}
@@ -283,7 +283,7 @@
public void saveInstanceState(Bundle outState) {
if (isShown) {
- mKeyguardMonitor.removeCallback(mKeyguardCallback);
+ mKeyguardStateController.removeCallback(mKeyguardCallback);
}
outState.putBoolean(EXTRA_QS_CUSTOMIZING, mCustomizing);
}
@@ -315,7 +315,7 @@
@Override
public void onKeyguardShowingChanged() {
if (!isAttachedToWindow()) return;
- if (mKeyguardMonitor.isShowing() && !mOpening) {
+ if (mKeyguardStateController.isShowing() && !mOpening) {
hide();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java b/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java
index 23f36e9..13cfa78 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java
@@ -39,7 +39,7 @@
import com.android.systemui.Dependency;
import com.android.systemui.qs.QSTileHost;
import com.android.systemui.statusbar.phone.StatusBarIconController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.util.ArrayList;
import java.util.Collections;
@@ -296,14 +296,16 @@
@Override
public boolean isLocked() {
- KeyguardMonitor keyguardMonitor = Dependency.get(KeyguardMonitor.class);
- return keyguardMonitor.isShowing();
+ KeyguardStateController keyguardStateController =
+ Dependency.get(KeyguardStateController.class);
+ return keyguardStateController.isShowing();
}
@Override
public boolean isSecure() {
- KeyguardMonitor keyguardMonitor = Dependency.get(KeyguardMonitor.class);
- return keyguardMonitor.isSecure() && keyguardMonitor.isShowing();
+ KeyguardStateController keyguardStateController =
+ Dependency.get(KeyguardStateController.class);
+ return keyguardStateController.isMethodSecure() && keyguardStateController.isShowing();
}
private CustomTile getTileForToken(IBinder token) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
index b1dfbb5..0e813d1 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CastTile.java
@@ -45,7 +45,7 @@
import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.statusbar.policy.CastController;
import com.android.systemui.statusbar.policy.CastController.CastDevice;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.NetworkController;
import java.util.ArrayList;
@@ -61,7 +61,7 @@
private final CastController mController;
private final CastDetailAdapter mDetailAdapter;
- private final KeyguardMonitor mKeyguard;
+ private final KeyguardStateController mKeyguard;
private final NetworkController mNetworkController;
private final Callback mCallback = new Callback();
private final ActivityStarter mActivityStarter;
@@ -69,12 +69,13 @@
private boolean mWifiConnected;
@Inject
- public CastTile(QSHost host, CastController castController, KeyguardMonitor keyguardMonitor,
- NetworkController networkController, ActivityStarter activityStarter) {
+ public CastTile(QSHost host, CastController castController,
+ KeyguardStateController keyguardStateController, NetworkController networkController,
+ ActivityStarter activityStarter) {
super(host);
mController = castController;
mDetailAdapter = new CastDetailAdapter();
- mKeyguard = keyguardMonitor;
+ mKeyguard = keyguardStateController;
mNetworkController = networkController;
mActivityStarter = activityStarter;
mController.observe(this, mCallback);
@@ -257,7 +258,8 @@
}
};
- private final class Callback implements CastController.Callback, KeyguardMonitor.Callback {
+ private final class Callback implements CastController.Callback,
+ KeyguardStateController.Callback {
@Override
public void onCastDevicesChanged() {
refreshState();
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
index 837ea9f..fbdca3b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
@@ -28,7 +28,7 @@
import com.android.systemui.plugins.qs.QSTile.BooleanState;
import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.tileimpl.QSTileImpl;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.LocationController.LocationChangeCallback;
@@ -40,16 +40,16 @@
private final Icon mIcon = ResourceIcon.get(R.drawable.ic_location);
private final LocationController mController;
- private final KeyguardMonitor mKeyguard;
+ private final KeyguardStateController mKeyguard;
private final ActivityStarter mActivityStarter;
private final Callback mCallback = new Callback();
@Inject
public LocationTile(QSHost host, LocationController locationController,
- KeyguardMonitor keyguardMonitor, ActivityStarter activityStarter) {
+ KeyguardStateController keyguardStateController, ActivityStarter activityStarter) {
super(host);
mController = locationController;
- mKeyguard = keyguardMonitor;
+ mKeyguard = keyguardStateController;
mActivityStarter = activityStarter;
mController.observe(this, mCallback);
mKeyguard.observe(this, mCallback);
@@ -71,7 +71,7 @@
@Override
protected void handleClick() {
- if (mKeyguard.isSecure() && mKeyguard.isShowing()) {
+ if (mKeyguard.isMethodSecure() && mKeyguard.isShowing()) {
mActivityStarter.postQSRunnableDismissingKeyguard(() -> {
final boolean wasEnabled = mState.value;
mHost.openPanels();
@@ -97,7 +97,7 @@
// Work around for bug 15916487: don't show location tile on top of lock screen. After the
// bug is fixed, this should be reverted to only hiding it on secure lock screens:
- // state.visible = !(mKeyguard.isSecure() && mKeyguard.isShowing());
+ // state.visible = !(mKeyguard.isMethodSecure() && mKeyguard.isShowing());
state.value = locationEnabled;
checkIfRestrictionEnforcedByAdminOnly(state, UserManager.DISALLOW_SHARE_LOCATION);
if (state.disabledByPolicy == false) {
@@ -133,7 +133,7 @@
}
private final class Callback implements LocationChangeCallback,
- KeyguardMonitor.Callback {
+ KeyguardStateController.Callback {
@Override
public void onLocationSettingsChanged(boolean enabled) {
refreshState();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 156e3c0..681f3ab 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -57,8 +57,8 @@
import com.android.systemui.statusbar.phone.LockscreenGestureLogger;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
import com.android.systemui.statusbar.policy.AccessibilityController;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.UserInfoController;
import com.android.systemui.util.wakelock.SettableWakeLock;
import com.android.systemui.util.wakelock.WakeLock;
@@ -72,7 +72,7 @@
* Controls the indications and error messages shown on the Keyguard
*/
public class KeyguardIndicationController implements StateListener,
- UnlockMethodCache.OnUnlockMethodChangedListener {
+ KeyguardStateController.Callback {
private static final String TAG = "KeyguardIndication";
private static final boolean DEBUG_CHARGING_SPEED = false;
@@ -86,7 +86,7 @@
private final Context mContext;
private final ShadeController mShadeController;
private final AccessibilityController mAccessibilityController;
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
private final StatusBarStateController mStatusBarStateController;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private ViewGroup mIndicationArea;
@@ -137,7 +137,7 @@
WakeLock.createPartial(context, "Doze:KeyguardIndication"),
Dependency.get(ShadeController.class),
Dependency.get(AccessibilityController.class),
- UnlockMethodCache.getInstance(context),
+ Dependency.get(KeyguardStateController.class),
Dependency.get(StatusBarStateController.class),
Dependency.get(KeyguardUpdateMonitor.class));
}
@@ -148,14 +148,15 @@
@VisibleForTesting
KeyguardIndicationController(Context context, ViewGroup indicationArea, LockIcon lockIcon,
LockPatternUtils lockPatternUtils, WakeLock wakeLock, ShadeController shadeController,
- AccessibilityController accessibilityController, UnlockMethodCache unlockMethodCache,
+ AccessibilityController accessibilityController,
+ KeyguardStateController keyguardStateController,
StatusBarStateController statusBarStateController,
KeyguardUpdateMonitor keyguardUpdateMonitor) {
mContext = context;
mLockIcon = lockIcon;
mShadeController = shadeController;
mAccessibilityController = accessibilityController;
- mUnlockMethodCache = unlockMethodCache;
+ mKeyguardStateController = keyguardStateController;
mStatusBarStateController = statusBarStateController;
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
// lock icon is not used on all form factors.
@@ -181,7 +182,7 @@
mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback());
mKeyguardUpdateMonitor.registerCallback(mTickReceiver);
mStatusBarStateController.addCallback(this);
- mUnlockMethodCache.addListener(this);
+ mKeyguardStateController.addCallback(this);
}
public void setIndicationArea(ViewGroup indicationArea) {
@@ -583,7 +584,7 @@
}
@Override
- public void onUnlockMethodStateChanged() {
+ public void onUnlockedChanged() {
updateIndication(!mDozing);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java
index f782fab..4ba1114 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationLockscreenUserManagerImpl.java
@@ -54,7 +54,7 @@
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -76,7 +76,8 @@
private final DeviceProvisionedController mDeviceProvisionedController =
Dependency.get(DeviceProvisionedController.class);
- private final KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ private final KeyguardStateController mKeyguardStateController = Dependency.get(
+ KeyguardStateController.class);
// Lazy
private NotificationEntryManager mEntryManager;
@@ -507,8 +508,8 @@
// asking if the keyguard is showing. We still need to check it though because showing the
// camera on the keyguard has a state of SHADE but the keyguard is still showing.
final boolean showingKeyguard = mState != StatusBarState.SHADE
- || mKeyguardMonitor.isShowing();
- final boolean devicePublic = showingKeyguard && isSecure(getCurrentUserId());
+ || mKeyguardStateController.isShowing();
+ final boolean devicePublic = showingKeyguard && mKeyguardStateController.isMethodSecure();
// Look for public mode users. Users are considered public in either case of:
@@ -523,7 +524,7 @@
boolean needsSeparateChallenge = whitelistIpcs(() ->
mLockPatternUtils.isSeparateProfileChallengeEnabled(userId));
if (!devicePublic && userId != getCurrentUserId()
- && needsSeparateChallenge && isSecure(userId)) {
+ && needsSeparateChallenge && mLockPatternUtils.isSecure(userId)) {
// Keyguard.isDeviceLocked is updated asynchronously, assume that all profiles
// with separate challenge are locked when keyguard is visible to avoid race.
isProfilePublic = showingKeyguard || mKeyguardManager.isDeviceLocked(userId);
@@ -545,7 +546,7 @@
// // asking if the keyguard is showing. We still need to check it though because showing the
// // camera on the keyguard has a state of SHADE but the keyguard is still showing.
// final boolean showingKeyguard = mState != StatusBarState.SHADE
-// || mKeyguardMonitor.isShowing();
+// || mKeyguardStateController.isShowing();
// final boolean devicePublic = showingKeyguard && isSecure(getCurrentUserId());
//
//
@@ -570,10 +571,6 @@
// }
// }
- private boolean isSecure(int userId) {
- return mKeyguardMonitor.isSecure() || mLockPatternUtils.isSecure(userId);
- }
-
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("NotificationLockscreenUserManager state:");
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
index 00a12a9..c50fb3d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMediaManager.java
@@ -17,10 +17,6 @@
import static com.android.systemui.Dependency.MAIN_HANDLER;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
-import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_UNLOCK_FADING;
-import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
-import static com.android.systemui.statusbar.phone.BiometricUnlockController
- .MODE_WAKE_AND_UNLOCK_PULSING;
import static com.android.systemui.statusbar.phone.StatusBar.DEBUG_MEDIA_FAKE_ARTWORK;
import static com.android.systemui.statusbar.phone.StatusBar.ENABLE_LOCKSCREEN_WALLPAPER;
import static com.android.systemui.statusbar.phone.StatusBar.SHOW_LOCKSCREEN_MEDIA_ARTWORK;
@@ -67,7 +63,7 @@
import com.android.systemui.statusbar.phone.ScrimState;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBarWindowController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -94,7 +90,8 @@
private final StatusBarStateController mStatusBarStateController
= Dependency.get(StatusBarStateController.class);
private final SysuiColorExtractor mColorExtractor = Dependency.get(SysuiColorExtractor.class);
- private final KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ private final KeyguardStateController mKeyguardStateController = Dependency.get(
+ KeyguardStateController.class);
private final KeyguardBypassController mKeyguardBypassController;
private static final HashSet<Integer> PAUSED_MEDIA_STATES = new HashSet<>();
static {
@@ -461,7 +458,7 @@
boolean wakeAndUnlock = mBiometricUnlockController != null
&& mBiometricUnlockController.isWakeAndUnlock();
- if (mKeyguardMonitor.isLaunchTransitionFadingAway() || wakeAndUnlock) {
+ if (mKeyguardStateController.isLaunchTransitionFadingAway() || wakeAndUnlock) {
mBackdrop.setVisibility(View.INVISIBLE);
Trace.endSection();
return;
@@ -599,7 +596,7 @@
boolean cannotAnimateDoze = shadeController != null
&& shadeController.isDozing()
&& !ScrimState.AOD.getAnimateChange();
- boolean needsBypassFading = mKeyguardMonitor.isBypassFadingAnimation();
+ boolean needsBypassFading = mKeyguardStateController.isBypassFadingAnimation();
if (((mBiometricUnlockController != null && mBiometricUnlockController.getMode()
== BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING
|| cannotAnimateDoze) && !needsBypassFading)
@@ -626,10 +623,12 @@
mBackdropBack.setImageDrawable(null);
mHandler.post(mHideBackdropFront);
});
- if (mKeyguardMonitor.isKeyguardFadingAway()) {
+ if (mKeyguardStateController.isKeyguardFadingAway()) {
mBackdrop.animate()
- .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
- .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
+ .setDuration(
+ mKeyguardStateController.getShortenedFadingAwayDuration())
+ .setStartDelay(
+ mKeyguardStateController.getKeyguardFadingAwayDelay())
.setInterpolator(Interpolators.LINEAR)
.start();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java
index e4bd4fa..a0b144b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/DynamicPrivacyController.java
@@ -16,16 +16,13 @@
package com.android.systemui.statusbar.notification;
-import android.content.Context;
import android.util.ArraySet;
-import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -34,12 +31,11 @@
* A controller which dynamically controls the visibility of Notification content
*/
@Singleton
-public class DynamicPrivacyController implements UnlockMethodCache.OnUnlockMethodChangedListener {
+public class DynamicPrivacyController implements KeyguardStateController.Callback {
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
private final NotificationLockscreenUserManager mLockscreenUserManager;
private final StatusBarStateController mStateController;
- private final KeyguardMonitor mKeyguardMonitor;
private ArraySet<Listener> mListeners = new ArraySet<>();
private boolean mLastDynamicUnlocked;
@@ -47,30 +43,18 @@
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@Inject
- DynamicPrivacyController(Context context,
- KeyguardMonitor keyguardMonitor,
- NotificationLockscreenUserManager notificationLockscreenUserManager,
- StatusBarStateController stateController) {
- this(notificationLockscreenUserManager, keyguardMonitor,
- UnlockMethodCache.getInstance(context),
- stateController);
- }
-
- @VisibleForTesting
DynamicPrivacyController(NotificationLockscreenUserManager notificationLockscreenUserManager,
- KeyguardMonitor keyguardMonitor,
- UnlockMethodCache unlockMethodCache,
+ KeyguardStateController keyguardStateController,
StatusBarStateController stateController) {
mLockscreenUserManager = notificationLockscreenUserManager;
mStateController = stateController;
- mUnlockMethodCache = unlockMethodCache;
- mKeyguardMonitor = keyguardMonitor;
- mUnlockMethodCache.addListener(this);
+ mKeyguardStateController = keyguardStateController;
+ mKeyguardStateController.addCallback(this);
mLastDynamicUnlocked = isDynamicallyUnlocked();
}
@Override
- public void onUnlockMethodStateChanged() {
+ public void onUnlockedChanged() {
if (isDynamicPrivacyEnabled()) {
// We only want to notify our listeners if dynamic privacy is actually active
boolean dynamicallyUnlocked = isDynamicallyUnlocked();
@@ -92,8 +76,9 @@
}
public boolean isDynamicallyUnlocked() {
- return (mUnlockMethodCache.canSkipBouncer() || mKeyguardMonitor.isKeyguardGoingAway()
- || mKeyguardMonitor.isKeyguardFadingAway())
+ return (mKeyguardStateController.canDismissLockScreen()
+ || mKeyguardStateController.isKeyguardGoingAway()
+ || mKeyguardStateController.isKeyguardFadingAway())
&& isDynamicPrivacyEnabled();
}
@@ -107,7 +92,7 @@
*/
public boolean isInLockedDownShade() {
if (!mStatusBarKeyguardViewManager.isShowing()
- || !mUnlockMethodCache.isMethodSecure()) {
+ || !mKeyguardStateController.isMethodSecure()) {
return false;
}
int state = mStateController.getState();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
index f3201ec..a5b7fa7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
@@ -55,7 +55,7 @@
import com.android.systemui.SystemUI;
import com.android.systemui.UiOffloadThread;
import com.android.systemui.statusbar.CommandQueue;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.NotificationChannels;
import java.util.List;
@@ -64,7 +64,7 @@
* splitted screen.
*/
public class InstantAppNotifier extends SystemUI
- implements CommandQueue.Callbacks, KeyguardMonitor.Callback {
+ implements CommandQueue.Callbacks, KeyguardStateController.Callback {
private static final String TAG = "InstantAppNotifier";
public static final int NUM_TASKS_FOR_INSTANT_APP_INFO = 5;
@@ -72,13 +72,13 @@
private final UiOffloadThread mUiOffloadThread = Dependency.get(UiOffloadThread.class);
private final ArraySet<Pair<String, Integer>> mCurrentNotifs = new ArraySet<>();
private boolean mDockedStackExists;
- private KeyguardMonitor mKeyguardMonitor;
+ private KeyguardStateController mKeyguardStateController;
public InstantAppNotifier() {}
@Override
public void start() {
- mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
// listen for user / profile change.
try {
@@ -88,7 +88,7 @@
}
SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallback(this);
- mKeyguardMonitor.addCallback(this);
+ mKeyguardStateController.addCallback(this);
DockedStackExistsListener.register(
exists -> {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
index 2d012c9..7cbdfb0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
@@ -38,6 +38,7 @@
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.statusbar.NotificationMediaManager;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
@@ -127,7 +128,7 @@
private final KeyguardBypassController mKeyguardBypassController;
private PowerManager.WakeLock mWakeLock;
private final KeyguardUpdateMonitor mUpdateMonitor;
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
private final StatusBarWindowController mStatusBarWindowController;
private final Context mContext;
private final int mWakeUpDelay;
@@ -150,11 +151,11 @@
KeyguardViewMediator keyguardViewMediator,
ScrimController scrimController,
StatusBar statusBar,
- UnlockMethodCache unlockMethodCache, Handler handler,
+ KeyguardStateController keyguardStateController, Handler handler,
KeyguardUpdateMonitor keyguardUpdateMonitor,
KeyguardBypassController keyguardBypassController) {
this(context, dozeScrimController, keyguardViewMediator, scrimController, statusBar,
- unlockMethodCache, handler, keyguardUpdateMonitor,
+ keyguardStateController, handler, keyguardUpdateMonitor,
context.getResources()
.getInteger(com.android.internal.R.integer.config_wakeUpDelayDoze),
keyguardBypassController);
@@ -162,14 +163,11 @@
@VisibleForTesting
protected BiometricUnlockController(Context context,
- DozeScrimController dozeScrimController,
- KeyguardViewMediator keyguardViewMediator,
- ScrimController scrimController,
- StatusBar statusBar,
- UnlockMethodCache unlockMethodCache, Handler handler,
- KeyguardUpdateMonitor keyguardUpdateMonitor,
- int wakeUpDelay,
- KeyguardBypassController keyguardBypassController) {
+ DozeScrimController dozeScrimController, KeyguardViewMediator keyguardViewMediator,
+ ScrimController scrimController, StatusBar statusBar,
+ KeyguardStateController keyguardStateController, Handler handler,
+ KeyguardUpdateMonitor keyguardUpdateMonitor, int wakeUpDelay,
+ KeyguardBypassController keyguardBypassController) {
mContext = context;
mPowerManager = context.getSystemService(PowerManager.class);
mUpdateMonitor = keyguardUpdateMonitor;
@@ -182,7 +180,7 @@
mKeyguardViewMediator = keyguardViewMediator;
mScrimController = scrimController;
mStatusBar = statusBar;
- mUnlockMethodCache = unlockMethodCache;
+ mKeyguardStateController = keyguardStateController;
mHandler = handler;
mWakeUpDelay = wakeUpDelay;
mKeyguardBypassController = keyguardBypassController;
@@ -416,7 +414,7 @@
return MODE_ONLY_WAKE;
} else if (mDozeScrimController.isPulsing() && unlockingAllowed) {
return MODE_WAKE_AND_UNLOCK_PULSING;
- } else if (unlockingAllowed || !mUnlockMethodCache.isMethodSecure()) {
+ } else if (unlockingAllowed || !mKeyguardStateController.isMethodSecure()) {
return MODE_WAKE_AND_UNLOCK;
} else {
return MODE_SHOW_BOUNCER;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
index d655b2f..e78b85e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
@@ -38,7 +38,7 @@
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.phone.StatusBarIconController.DarkIconManager;
import com.android.systemui.statusbar.policy.EncryptionHelper;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
@@ -57,7 +57,7 @@
public static final int FADE_IN_DELAY = 50;
private PhoneStatusBarView mStatusBar;
private StatusBarStateController mStatusBarStateController;
- private KeyguardMonitor mKeyguardMonitor;
+ private KeyguardStateController mKeyguardStateController;
private NetworkController mNetworkController;
private LinearLayout mSystemIconArea;
private View mClockView;
@@ -79,7 +79,7 @@
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
mNetworkController = Dependency.get(NetworkController.class);
mStatusBarStateController = Dependency.get(StatusBarStateController.class);
mStatusBarComponent = SysUiServiceProvider.getComponent(getContext(), StatusBar.class);
@@ -207,8 +207,8 @@
state |= DISABLE_CLOCK;
}
- if (!mKeyguardMonitor.isLaunchTransitionFadingAway()
- && !mKeyguardMonitor.isKeyguardFadingAway()
+ if (!mKeyguardStateController.isLaunchTransitionFadingAway()
+ && !mKeyguardStateController.isKeyguardFadingAway()
&& shouldHideNotificationIcons()
&& !(mStatusBarStateController.getState() == StatusBarState.KEYGUARD
&& headsUpVisible)) {
@@ -268,7 +268,7 @@
* don't set the clock GONE otherwise it'll mess up the animation.
*/
private int clockHiddenMode() {
- if (!mStatusBar.isClosed() && !mKeyguardMonitor.isShowing()
+ if (!mStatusBar.isClosed() && !mKeyguardStateController.isShowing()
&& !mStatusBarStateController.isDozing()) {
return View.INVISIBLE;
}
@@ -345,11 +345,11 @@
.withEndAction(null);
// Synchronize the motion with the Keyguard fading if necessary.
- if (mKeyguardMonitor.isKeyguardFadingAway()) {
+ if (mKeyguardStateController.isKeyguardFadingAway()) {
v.animate()
- .setDuration(mKeyguardMonitor.getKeyguardFadingAwayDuration())
+ .setDuration(mKeyguardStateController.getKeyguardFadingAwayDuration())
.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN)
- .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
+ .setStartDelay(mKeyguardStateController.getKeyguardFadingAwayDelay())
.start();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
index f53c4e8..da62d9b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
@@ -39,7 +39,7 @@
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import java.util.function.BiConsumer;
@@ -89,7 +89,7 @@
};
private boolean mAnimationsEnabled = true;
Point mPoint;
- private KeyguardMonitor mKeyguardMonitor;
+ private KeyguardStateController mKeyguardStateController;
public HeadsUpAppearanceController(
@@ -160,7 +160,7 @@
mWakeUpCoordinator = wakeUpCoordinator;
wakeUpCoordinator.addListener(this);
mCommandQueue = getComponent(headsUpStatusBarView.getContext(), CommandQueue.class);
- mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
}
@@ -378,7 +378,7 @@
boolean canShow = !mIsExpanded && notificationsShown;
if (mBypassController.getBypassEnabled() &&
(mStatusBarStateController.getState() == StatusBarState.KEYGUARD
- || mKeyguardMonitor.isKeyguardGoingAway())
+ || mKeyguardStateController.isKeyguardGoingAway())
&& notificationsShown) {
canShow = true;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index 83ecb55..68eca8d6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -80,6 +80,7 @@
import com.android.systemui.statusbar.policy.ExtensionController;
import com.android.systemui.statusbar.policy.ExtensionController.Extension;
import com.android.systemui.statusbar.policy.FlashlightController;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.PreviewInflater;
import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory;
import com.android.systemui.tuner.TunerService;
@@ -89,7 +90,7 @@
* text.
*/
public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickListener,
- UnlockMethodCache.OnUnlockMethodChangedListener,
+ KeyguardStateController.Callback,
AccessibilityController.AccessibilityStateChangedCallback {
final static String TAG = "StatusBar/KeyguardBottomAreaView";
@@ -116,7 +117,6 @@
private static final int DOZE_ANIMATION_STAGGER_DELAY = 48;
private static final int DOZE_ANIMATION_ELEMENT_DURATION = 250;
- private final UnlockMethodCache mUnlockMethodCache;
private KeyguardAffordanceView mRightAffordanceView;
private KeyguardAffordanceView mLeftAffordanceView;
private ViewGroup mIndicationArea;
@@ -128,6 +128,7 @@
private View mCameraPreview;
private ActivityStarter mActivityStarter;
+ private KeyguardStateController mKeyguardStateController;
private LockPatternUtils mLockPatternUtils;
private FlashlightController mFlashlightController;
private PreviewInflater mPreviewInflater;
@@ -183,7 +184,6 @@
public KeyguardBottomAreaView(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
- mUnlockMethodCache = UnlockMethodCache.getInstance(getContext());
}
private AccessibilityDelegate mAccessibilityDelegate = new AccessibilityDelegate() {
@@ -239,6 +239,8 @@
mBurnInYOffset = getResources().getDimensionPixelSize(
R.dimen.default_burn_in_prevention_offset);
updateCameraVisibility();
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
+ mKeyguardStateController.addCallback(this);
setClipChildren(false);
setClipToPadding(false);
inflateCameraPreview();
@@ -276,13 +278,13 @@
getContext().registerReceiverAsUser(mDevicePolicyReceiver,
UserHandle.ALL, filter, null, null);
Dependency.get(KeyguardUpdateMonitor.class).registerCallback(mUpdateMonitorCallback);
- mUnlockMethodCache.addListener(this);
+ mKeyguardStateController.addCallback(this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
- mUnlockMethodCache.removeListener(this);
+ mKeyguardStateController.removeCallback(this);
mAccessibilityController.removeStateChangedCallback(this);
mRightExtension.destroy();
mLeftExtension.destroy();
@@ -544,7 +546,7 @@
mAssistManager.launchVoiceAssistFromKeyguard();
}
};
- if (mStatusBar.isKeyguardCurrentlySecure()) {
+ if (!mKeyguardStateController.canDismissLockScreen()) {
AsyncTask.execute(runnable);
} else {
boolean dismissShade = !TextUtils.isEmpty(mRightButtonStr)
@@ -609,7 +611,7 @@
}
@Override
- public void onUnlockMethodStateChanged() {
+ public void onUnlockedChanged() {
updateCameraVisibility();
}
@@ -811,11 +813,9 @@
@Override
public Intent getIntent() {
- KeyguardUpdateMonitor updateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
- boolean canSkipBouncer = updateMonitor.getUserCanSkipBouncer(
- KeyguardUpdateMonitor.getCurrentUser());
- boolean secure = mUnlockMethodCache.isMethodSecure();
- return (secure && !canSkipBouncer) ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT;
+ boolean canDismissLs = mKeyguardStateController.canDismissLockScreen();
+ boolean secure = mKeyguardStateController.isMethodSecure();
+ return (secure && !canDismissLs) ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
index d7f67ce..c3de843 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -46,6 +46,7 @@
import com.android.systemui.R;
import com.android.systemui.keyguard.DismissCallbackRegistry;
import com.android.systemui.plugins.FalsingManager;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.PrintWriter;
@@ -69,7 +70,7 @@
private final Handler mHandler;
private final BouncerExpansionCallback mExpansionCallback;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
new KeyguardUpdateMonitorCallback() {
@Override
@@ -97,7 +98,8 @@
public KeyguardBouncer(Context context, ViewMediatorCallback callback,
LockPatternUtils lockPatternUtils, ViewGroup container,
DismissCallbackRegistry dismissCallbackRegistry, FalsingManager falsingManager,
- BouncerExpansionCallback expansionCallback, UnlockMethodCache unlockMethodCache,
+ BouncerExpansionCallback expansionCallback,
+ KeyguardStateController keyguardStateController,
KeyguardUpdateMonitor keyguardUpdateMonitor,
KeyguardBypassController keyguardBypassController, Handler handler) {
mContext = context;
@@ -109,7 +111,7 @@
mDismissCallbackRegistry = dismissCallbackRegistry;
mExpansionCallback = expansionCallback;
mHandler = handler;
- mUnlockMethodCache = unlockMethodCache;
+ mKeyguardStateController = keyguardStateController;
mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback);
mKeyguardBypassController = keyguardBypassController;
}
@@ -173,7 +175,7 @@
// Split up the work over multiple frames.
DejankUtils.removeCallbacks(mResetRunnable);
- if (mUnlockMethodCache.isFaceAuthEnabled() && !needsFullscreenBouncer()
+ if (mKeyguardStateController.isFaceAuthEnabled() && !needsFullscreenBouncer()
&& !mKeyguardUpdateMonitor.userNeedsStrongAuth()
&& !mKeyguardBypassController.getBypassEnabled()) {
mHandler.postDelayed(mShowRunnable, BOUNCER_FACE_DELAY);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt
index 832ea9e..aca7f44 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt
@@ -23,6 +23,7 @@
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.statusbar.NotificationLockscreenUserManager
import com.android.systemui.statusbar.StatusBarState
+import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.tuner.TunerService
import java.io.PrintWriter
import javax.inject.Inject
@@ -31,7 +32,7 @@
@Singleton
class KeyguardBypassController {
- private val unlockMethodCache: UnlockMethodCache
+ private val mKeyguardStateController: KeyguardStateController
private val statusBarStateController: StatusBarStateController
private var hasFaceFeature: Boolean
@@ -47,7 +48,7 @@
* If face unlock dismisses the lock screen or keeps user on keyguard for the current user.
*/
var bypassEnabled: Boolean = false
- get() = field && unlockMethodCache.isFaceAuthEnabled
+ get() = field && mKeyguardStateController.isFaceAuthEnabled
private set
var bouncerShowing: Boolean = false
@@ -66,9 +67,10 @@
context: Context,
tunerService: TunerService,
statusBarStateController: StatusBarStateController,
- lockscreenUserManager: NotificationLockscreenUserManager
+ lockscreenUserManager: NotificationLockscreenUserManager,
+ keyguardStateController: KeyguardStateController
) {
- unlockMethodCache = UnlockMethodCache.getInstance(context)
+ this.mKeyguardStateController = keyguardStateController
this.statusBarStateController = statusBarStateController
hasFaceFeature = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java
index d709730..de660ce1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java
@@ -31,7 +31,7 @@
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.CommandQueue.Callbacks;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -47,7 +47,7 @@
private final Handler mHandler;
private final DarkIntensityApplier mApplier;
- private final KeyguardMonitor mKeyguardMonitor;
+ private final KeyguardStateController mKeyguardStateController;
private final StatusBarStateController mStatusBarStateController;
private boolean mTransitionDeferring;
@@ -73,7 +73,7 @@
public LightBarTransitionsController(Context context, DarkIntensityApplier applier) {
mApplier = applier;
mHandler = new Handler();
- mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
mStatusBarStateController = Dependency.get(StatusBarStateController.class);
SysUiServiceProvider.getComponent(context, CommandQueue.class)
.addCallback(this);
@@ -101,7 +101,7 @@
@Override
public void appTransitionPending(int displayId, boolean forced) {
- if (mDisplayId != displayId || mKeyguardMonitor.isKeyguardGoingAway() && !forced) {
+ if (mDisplayId != displayId || mKeyguardStateController.isKeyguardGoingAway() && !forced) {
return;
}
mTransitionPending = true;
@@ -123,7 +123,7 @@
@Override
public void appTransitionStarting(int displayId, long startTime, long duration,
boolean forced) {
- if (mDisplayId != displayId || mKeyguardMonitor.isKeyguardGoingAway() && !forced) {
+ if (mDisplayId != displayId || mKeyguardStateController.isKeyguardGoingAway() && !forced) {
return;
}
if (mTransitionPending && mTintChangePending) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index 6781073..4927ec8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -53,7 +53,7 @@
import com.android.systemui.statusbar.phone.ScrimController.ScrimVisibility;
import com.android.systemui.statusbar.policy.AccessibilityController;
import com.android.systemui.statusbar.policy.ConfigurationController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.statusbar.policy.UserInfoController.OnUserInfoChangedListener;
@@ -68,9 +68,8 @@
*/
public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChangedListener,
StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener,
- UnlockMethodCache.OnUnlockMethodChangedListener,
- NotificationWakeUpCoordinator.WakeUpListener, ViewTreeObserver.OnPreDrawListener,
- OnHeadsUpChangedListener {
+ KeyguardStateController.Callback, NotificationWakeUpCoordinator.WakeUpListener,
+ ViewTreeObserver.OnPreDrawListener, OnHeadsUpChangedListener {
private static final int STATE_LOCKED = 0;
private static final int STATE_LOCK_OPEN = 1;
@@ -78,11 +77,10 @@
private static final int STATE_BIOMETRICS_ERROR = 3;
private final ConfigurationController mConfigurationController;
private final StatusBarStateController mStatusBarStateController;
- private final UnlockMethodCache mUnlockMethodCache;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private final AccessibilityController mAccessibilityController;
private final DockManager mDockManager;
- private final KeyguardMonitor mKeyguardMonitor;
+ private final KeyguardStateController mKeyguardStateController;
private final KeyguardBypassController mBypassController;
private final NotificationWakeUpCoordinator mWakeUpCoordinator;
private final HeadsUpManagerPhone mHeadsUpManager;
@@ -107,13 +105,13 @@
private boolean mUpdatePending;
private boolean mBouncerPreHideAnimation;
- private final KeyguardMonitor.Callback mKeyguardMonitorCallback =
- new KeyguardMonitor.Callback() {
+ private final KeyguardStateController.Callback mKeyguardMonitorCallback =
+ new KeyguardStateController.Callback() {
@Override
public void onKeyguardShowingChanged() {
boolean force = false;
boolean wasShowing = mKeyguardShowing;
- mKeyguardShowing = mKeyguardMonitor.isShowing();
+ mKeyguardShowing = mKeyguardStateController.isShowing();
if (!wasShowing && mKeyguardShowing && mBlockUpdates) {
mBlockUpdates = false;
force = true;
@@ -126,7 +124,7 @@
@Override
public void onKeyguardFadingAwayChanged() {
- if (!mKeyguardMonitor.isKeyguardFadingAway()) {
+ if (!mKeyguardStateController.isKeyguardFadingAway()) {
mBouncerPreHideAnimation = false;
if (mBlockUpdates) {
mBlockUpdates = false;
@@ -134,6 +132,11 @@
}
}
}
+
+ @Override
+ public void onUnlockedChanged() {
+ update();
+ }
};
private final DockManager.DockEventListener mDockEventListener =
new DockManager.DockEventListener() {
@@ -181,19 +184,18 @@
AccessibilityController accessibilityController,
KeyguardBypassController bypassController,
NotificationWakeUpCoordinator wakeUpCoordinator,
- KeyguardMonitor keyguardMonitor,
+ KeyguardStateController keyguardStateController,
@Nullable DockManager dockManager,
HeadsUpManagerPhone headsUpManager) {
super(context, attrs);
mContext = context;
- mUnlockMethodCache = UnlockMethodCache.getInstance(context);
mKeyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
mAccessibilityController = accessibilityController;
mConfigurationController = configurationController;
mStatusBarStateController = statusBarStateController;
mBypassController = bypassController;
mWakeUpCoordinator = wakeUpCoordinator;
- mKeyguardMonitor = keyguardMonitor;
+ mKeyguardStateController = keyguardStateController;
mDockManager = dockManager;
mHeadsUpManager = headsUpManager;
}
@@ -203,9 +205,8 @@
super.onAttachedToWindow();
mStatusBarStateController.addCallback(this);
mConfigurationController.addCallback(this);
- mKeyguardMonitor.addCallback(mKeyguardMonitorCallback);
+ mKeyguardStateController.addCallback(mKeyguardMonitorCallback);
mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback);
- mUnlockMethodCache.addListener(this);
mWakeUpCoordinator.addListener(this);
mSimLocked = mKeyguardUpdateMonitor.isSimPinSecure();
if (mDockManager != null) {
@@ -221,9 +222,8 @@
mStatusBarStateController.removeCallback(this);
mConfigurationController.removeCallback(this);
mKeyguardUpdateMonitor.removeCallback(mUpdateMonitorCallback);
- mKeyguardMonitor.removeCallback(mKeyguardMonitorCallback);
+ mKeyguardStateController.removeCallback(mKeyguardMonitorCallback);
mWakeUpCoordinator.removeListener(this);
- mUnlockMethodCache.removeListener(this);
if (mDockManager != null) {
mDockManager.removeListener(mDockEventListener);
}
@@ -370,15 +370,15 @@
}
private boolean canBlockUpdates() {
- return mKeyguardShowing || mKeyguardMonitor.isKeyguardFadingAway();
+ return mKeyguardShowing || mKeyguardStateController.isKeyguardFadingAway();
}
private void updateClickability() {
if (mAccessibilityController == null) {
return;
}
- boolean canLock = mUnlockMethodCache.isMethodSecure()
- && mUnlockMethodCache.canSkipBouncer();
+ boolean canLock = mKeyguardStateController.isMethodSecure()
+ && mKeyguardStateController.canDismissLockScreen();
boolean clickToUnlock = mAccessibilityController.isAccessibilityEnabled();
setClickable(clickToUnlock);
setLongClickable(canLock && !clickToUnlock);
@@ -523,8 +523,8 @@
private int getState() {
KeyguardUpdateMonitor updateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
- if ((mUnlockMethodCache.canSkipBouncer() || !mKeyguardShowing || mBouncerPreHideAnimation
- || mKeyguardMonitor.isKeyguardGoingAway()) && !mSimLocked) {
+ if ((mKeyguardStateController.canDismissLockScreen() || !mKeyguardShowing
+ || mKeyguardStateController.isKeyguardGoingAway()) && !mSimLocked) {
return STATE_LOCK_OPEN;
} else if (mTransientBiometricsError) {
return STATE_BIOMETRICS_ERROR;
@@ -582,11 +582,6 @@
update(true /* force */);
}
- @Override
- public void onUnlockMethodStateChanged() {
- update();
- }
-
/**
* We need to hide the lock whenever there's a fingerprint unlock, otherwise you'll see the
* icon on top of the black front scrim.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index ea113df..86da10a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -102,7 +102,7 @@
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.notification.stack.StackStateAnimator;
import com.android.systemui.statusbar.policy.ConfigurationController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.statusbar.policy.ZenModeController;
@@ -205,11 +205,11 @@
mDelayShowingKeyguardStatusBar = false;
}
};
- private final KeyguardMonitor.Callback mKeyguardMonitorCallback =
- new KeyguardMonitor.Callback() {
+ private final KeyguardStateController.Callback mKeyguardMonitorCallback =
+ new KeyguardStateController.Callback() {
@Override
public void onKeyguardFadingAwayChanged() {
- if (!mKeyguardMonitor.isKeyguardFadingAway()) {
+ if (!mKeyguardStateController.isKeyguardFadingAway()) {
mFirstBypassAttempt = false;
mDelayShowingKeyguardStatusBar = false;
}
@@ -482,7 +482,7 @@
mKeyguardBypassController = bypassController;
mUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
mFirstBypassAttempt = mKeyguardBypassController.getBypassEnabled();
- mKeyguardMonitor.addCallback(mKeyguardMonitorCallback);
+ mKeyguardStateController.addCallback(mKeyguardMonitorCallback);
dynamicPrivacyController.addListener(this);
mBottomAreaShadeAlphaAnimator = ValueAnimator.ofFloat(1f, 0);
@@ -1683,7 +1683,7 @@
@Override
public void onStateChanged(int statusBarState) {
boolean goingToFullShade = mStatusBarStateController.goingToFullShade();
- boolean keyguardFadingAway = mKeyguardMonitor.isKeyguardFadingAway();
+ boolean keyguardFadingAway = mKeyguardStateController.isKeyguardFadingAway();
int oldState = mBarState;
boolean keyguardShowing = statusBarState == StatusBarState.KEYGUARD;
setKeyguardStatusViewVisibility(statusBarState, keyguardFadingAway, goingToFullShade);
@@ -1701,7 +1701,7 @@
&& (goingToFullShade || statusBarState == StatusBarState.SHADE_LOCKED)) {
animateKeyguardStatusBarOut();
long delay = mBarState == StatusBarState.SHADE_LOCKED
- ? 0 : mKeyguardMonitor.calculateGoingToFullShadeDelay();
+ ? 0 : mKeyguardStateController.calculateGoingToFullShadeDelay();
mQs.animateHeaderSlidingIn(delay);
} else if (oldState == StatusBarState.SHADE_LOCKED
&& statusBarState == StatusBarState.KEYGUARD) {
@@ -1778,13 +1778,13 @@
private void animateKeyguardStatusBarOut() {
ValueAnimator anim = ValueAnimator.ofFloat(mKeyguardStatusBar.getAlpha(), 0f);
anim.addUpdateListener(mStatusBarAnimateAlphaListener);
- anim.setStartDelay(mKeyguardMonitor.isKeyguardFadingAway()
- ? mKeyguardMonitor.getKeyguardFadingAwayDelay()
+ anim.setStartDelay(mKeyguardStateController.isKeyguardFadingAway()
+ ? mKeyguardStateController.getKeyguardFadingAwayDelay()
: 0);
long duration;
- if (mKeyguardMonitor.isKeyguardFadingAway()) {
- duration = mKeyguardMonitor.getShortenedFadingAwayDuration();
+ if (mKeyguardStateController.isKeyguardFadingAway()) {
+ duration = mKeyguardStateController.getShortenedFadingAwayDuration();
} else {
duration = StackStateAnimator.ANIMATION_DURATION_STANDARD;
}
@@ -1831,8 +1831,8 @@
if (goingToFullShade) {
mKeyguardBottomArea.animate()
.alpha(0f)
- .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
- .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
+ .setStartDelay(mKeyguardStateController.getKeyguardFadingAwayDelay())
+ .setDuration(mKeyguardStateController.getShortenedFadingAwayDuration())
.setInterpolator(Interpolators.ALPHA_OUT)
.withEndAction(mAnimateKeyguardBottomAreaInvisibleEndRunnable)
.start();
@@ -1860,8 +1860,8 @@
.withEndAction(mAnimateKeyguardStatusViewGoneEndRunnable);
if (keyguardFadingAway) {
mKeyguardStatusView.animate()
- .setStartDelay(mKeyguardMonitor.getKeyguardFadingAwayDelay())
- .setDuration(mKeyguardMonitor.getShortenedFadingAwayDuration())
+ .setStartDelay(mKeyguardStateController.getKeyguardFadingAwayDelay())
+ .setDuration(mKeyguardStateController.getShortenedFadingAwayDuration())
.start();
}
} else if (mBarState == StatusBarState.SHADE_LOCKED
@@ -2556,7 +2556,7 @@
@Override
protected void onTrackingStarted() {
- mFalsingManager.onTrackingStarted(mStatusBar.isKeyguardCurrentlySecure());
+ mFalsingManager.onTrackingStarted(!mKeyguardStateController.canDismissLockScreen());
super.onTrackingStarted();
if (mQsFullyExpanded) {
mQsExpandImmediate = true;
@@ -2846,7 +2846,7 @@
@Override
protected boolean shouldUseDismissingAnimation() {
return mBarState != StatusBarState.SHADE
- && (!mStatusBar.isKeyguardCurrentlySecure() || !isTracking());
+ && (mKeyguardStateController.canDismissLockScreen() || !isTracking());
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 31600e3..ffaf3d5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -49,7 +49,7 @@
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.VibratorHelper;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -143,7 +143,8 @@
private boolean mGestureWaitForTouchSlop;
private boolean mIgnoreXTouchSlop;
private boolean mExpandLatencyTracking;
- protected final KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ protected final KeyguardStateController mKeyguardStateController = Dependency.get(
+ KeyguardStateController.class);
protected final SysuiStatusBarStateController mStatusBarStateController =
(SysuiStatusBarStateController) Dependency.get(StatusBarStateController.class);
@@ -495,7 +496,8 @@
mUpdateFlingVelocity = vel;
}
} else if (mPanelClosedOnDown && !mHeadsUpManager.hasPinnedHeadsUp() && !mTracking
- && !mStatusBar.isBouncerShowing() && !mKeyguardMonitor.isKeyguardFadingAway()) {
+ && !mStatusBar.isBouncerShowing()
+ && !mKeyguardStateController.isKeyguardFadingAway()) {
long timePassed = SystemClock.uptimeMillis() - mDownTime;
if (timePassed < ViewConfiguration.getLongPressTimeout()) {
// Lets show the user that he can actually expand the panel
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index ee438795..294111c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -57,7 +57,7 @@
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
import com.android.systemui.statusbar.policy.HotspotController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NextAlarmController;
import com.android.systemui.statusbar.policy.RotationLockController;
@@ -82,7 +82,7 @@
Listener,
ZenModeController.Callback,
DeviceProvisionedListener,
- KeyguardMonitor.Callback,
+ KeyguardStateController.Callback,
PrivacyItemController.Callback,
LocationController.LocationChangeCallback {
private static final String TAG = "PhoneStatusBarPolicy";
@@ -119,7 +119,7 @@
private final DataSaverController mDataSaver;
private final ZenModeController mZenController;
private final DeviceProvisionedController mProvisionedController;
- private final KeyguardMonitor mKeyguardMonitor;
+ private final KeyguardStateController mKeyguardStateController;
private final LocationController mLocationController;
private final PrivacyItemController mPrivacyItemController;
private final UiOffloadThread mUiOffloadThread = Dependency.get(UiOffloadThread.class);
@@ -152,7 +152,7 @@
mDataSaver = Dependency.get(DataSaverController.class);
mZenController = Dependency.get(ZenModeController.class);
mProvisionedController = Dependency.get(DeviceProvisionedController.class);
- mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ mKeyguardStateController = Dependency.get(KeyguardStateController.class);
mLocationController = Dependency.get(LocationController.class);
mPrivacyItemController = Dependency.get(PrivacyItemController.class);
mSensorPrivacyController = Dependency.get(SensorPrivacyController.class);
@@ -256,7 +256,7 @@
mHotspot.addCallback(mHotspotCallback);
mNextAlarmController.addCallback(mNextAlarmCallback);
mDataSaver.addCallback(this);
- mKeyguardMonitor.addCallback(this);
+ mKeyguardStateController.addCallback(this);
mPrivacyItemController.addCallback(this);
mSensorPrivacyController.addCallback(mSensorPrivacyListener);
mLocationController.addCallback(this);
@@ -472,8 +472,8 @@
boolean isManagedProfile = mUserManager.isManagedProfile(userId);
mHandler.post(() -> {
final boolean showIcon;
- if (isManagedProfile &&
- (!mKeyguardMonitor.isShowing() || mKeyguardMonitor.isOccluded())) {
+ if (isManagedProfile && (!mKeyguardStateController.isShowing()
+ || mKeyguardStateController.isOccluded())) {
showIcon = true;
mIconController.setIcon(mSlotManagedProfile,
R.drawable.stat_sys_managed_profile_status,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 8c92779..bd9ce3a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -47,7 +47,7 @@
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.statusbar.ScrimView;
import com.android.systemui.statusbar.notification.stack.ViewState;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.AlarmTimeout;
import com.android.systemui.util.wakelock.DelayedWakeLock;
import com.android.systemui.util.wakelock.WakeLock;
@@ -129,7 +129,7 @@
protected final ScrimView mScrimBehind;
protected final ScrimView mScrimForBubble;
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private final DozeParameters mDozeParameters;
private final AlarmTimeout mTimeTicker;
@@ -187,7 +187,7 @@
public ScrimController(ScrimView scrimBehind, ScrimView scrimInFront, ScrimView scrimForBubble,
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
- AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
+ AlarmManager alarmManager, KeyguardStateController keyguardStateController) {
mScrimBehind = scrimBehind;
mScrimInFront = scrimInFront;
mScrimForBubble = scrimForBubble;
@@ -196,8 +196,8 @@
mScrimVisibleListener = scrimVisibleListener;
mContext = scrimBehind.getContext();
- mUnlockMethodCache = UnlockMethodCache.getInstance(mContext);
- mDarkenWhileDragging = !mUnlockMethodCache.canSkipBouncer();
+ mKeyguardStateController = keyguardStateController;
+ mDarkenWhileDragging = !mKeyguardStateController.canDismissLockScreen();
mKeyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
mKeyguardVisibilityCallback = new KeyguardVisibilityCallback();
mKeyguardUpdateMonitor.registerCallback(mKeyguardVisibilityCallback);
@@ -210,11 +210,11 @@
// to make sure that text on top of it is legible.
mScrimBehindAlpha = mScrimBehindAlphaResValue;
mDozeParameters = dozeParameters;
- keyguardMonitor.addCallback(new KeyguardMonitor.Callback() {
+ keyguardStateController.addCallback(new KeyguardStateController.Callback() {
@Override
public void onKeyguardFadingAwayChanged() {
- setKeyguardFadingAway(keyguardMonitor.isKeyguardFadingAway(),
- keyguardMonitor.getKeyguardFadingAwayDuration());
+ setKeyguardFadingAway(keyguardStateController.isKeyguardFadingAway(),
+ keyguardStateController.getKeyguardFadingAwayDuration());
}
});
@@ -367,7 +367,7 @@
public void onTrackingStarted() {
mTracking = true;
- mDarkenWhileDragging = !mUnlockMethodCache.canSkipBouncer();
+ mDarkenWhileDragging = !mKeyguardStateController.canDismissLockScreen();
}
public void onExpandingFinished() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 7bc849d..f06fbbd8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -212,7 +212,6 @@
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
-import com.android.systemui.statusbar.phone.UnlockMethodCache.OnUnlockMethodChangedListener;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback;
import com.android.systemui.statusbar.policy.BrightnessMirrorController;
@@ -222,7 +221,8 @@
import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
import com.android.systemui.statusbar.policy.ExtensionController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
+import com.android.systemui.statusbar.policy.KeyguardStateControllerImpl;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
@@ -246,7 +246,7 @@
import dagger.Subcomponent;
public class StatusBar extends SystemUI implements DemoMode,
- ActivityStarter, OnUnlockMethodChangedListener,
+ ActivityStarter, KeyguardStateController.Callback,
OnHeadsUpChangedListener, CommandQueue.Callbacks, ZenModeController.Callback,
ColorExtractor.OnColorsChangedListener, ConfigurationListener,
StatusBarStateController.StateListener, ShadeController,
@@ -358,7 +358,6 @@
protected PhoneStatusBarView mStatusBarView;
private int mStatusBarWindowState = WINDOW_STATE_SHOWING;
protected StatusBarWindowController mStatusBarWindowController;
- protected UnlockMethodCache mUnlockMethodCache;
@VisibleForTesting
KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@VisibleForTesting
@@ -378,6 +377,8 @@
@Inject
KeyguardBypassController mKeyguardBypassController;
@Inject
+ KeyguardStateController mKeyguardStateController;
+ @Inject
protected HeadsUpManagerPhone mHeadsUpManager;
@Inject
DynamicPrivacyController mDynamicPrivacyController;
@@ -545,7 +546,7 @@
+ "mStatusBarKeyguardViewManager was null");
return;
}
- if (mKeyguardMonitor.isKeyguardFadingAway()) {
+ if (mKeyguardStateController.isKeyguardFadingAway()) {
mStatusBarKeyguardViewManager.onKeyguardFadedAway();
}
}
@@ -559,7 +560,6 @@
private KeyguardUserSwitcher mKeyguardUserSwitcher;
protected UserSwitcherController mUserSwitcherController;
private NetworkController mNetworkController;
- private KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
private BatteryController mBatteryController;
protected boolean mPanelExpanded;
private UiModeManager mUiModeManager;
@@ -786,8 +786,7 @@
mIconPolicy = new PhoneStatusBarPolicy(mContext, mIconController);
mSignalPolicy = new StatusBarSignalPolicy(mContext, mIconController);
- mUnlockMethodCache = UnlockMethodCache.getInstance(mContext);
- mUnlockMethodCache.addListener(this);
+ mKeyguardStateController.addCallback(this);
startKeyguard();
mKeyguardUpdateMonitor.registerCallback(mUpdateCallback);
@@ -959,7 +958,7 @@
}
}, DozeParameters.getInstance(mContext),
mContext.getSystemService(AlarmManager.class),
- mKeyguardMonitor);
+ mKeyguardStateController);
mNotificationPanel.initDependencies(this, mGroupManager, mNotificationShelf,
mHeadsUpManager, mNotificationIconAreaController, mScrimController);
mDozeScrimController = new DozeScrimController(DozeParameters.getInstance(context));
@@ -1116,7 +1115,7 @@
mHeadsUpManager, activityStarter, mActivityLaunchAnimator,
mBarService, mStatusBarStateController, mKeyguardManager, mDreamManager,
mRemoteInputManager, mStatusBarRemoteInputCallback, mGroupManager,
- mLockscreenUserManager, mShadeController, mKeyguardMonitor,
+ mLockscreenUserManager, mShadeController, mKeyguardStateController,
mNotificationInterruptionStateProvider, mMetricsLogger,
new LockPatternUtils(mContext), Dependency.get(MAIN_HANDLER),
Dependency.get(BG_HANDLER), mActivityIntentHelper, mBubbleController);
@@ -1257,8 +1256,8 @@
KeyguardViewMediator keyguardViewMediator = getComponent(KeyguardViewMediator.class);
mBiometricUnlockController = new BiometricUnlockController(mContext,
mDozeScrimController, keyguardViewMediator,
- mScrimController, this, UnlockMethodCache.getInstance(mContext),
- new Handler(), mKeyguardUpdateMonitor, mKeyguardBypassController);
+ mScrimController, this, mKeyguardStateController, new Handler(),
+ mKeyguardUpdateMonitor, mKeyguardBypassController);
putComponent(BiometricUnlockController.class, mBiometricUnlockController);
mStatusBarKeyguardViewManager = keyguardViewMediator.registerStatusBar(this,
getBouncerContainer(), mNotificationPanel, mBiometricUnlockController,
@@ -1374,7 +1373,7 @@
* Asks {@link KeyguardUpdateMonitor} to run face auth.
*/
public void requestFaceAuth() {
- if (!mUnlockMethodCache.canSkipBouncer()) {
+ if (!mKeyguardStateController.canDismissLockScreen()) {
mKeyguardUpdateMonitor.requestFaceAuth();
}
}
@@ -1558,9 +1557,8 @@
logStateToEventlog();
}
- @Override // UnlockMethodCache.OnUnlockMethodChangedListener
- public void onUnlockMethodStateChanged() {
- // Unlock method state changed. Notify KeguardMonitor
+ @Override
+ public void onUnlockedChanged() {
updateKeyguardState();
logStateToEventlog();
}
@@ -1623,10 +1621,6 @@
}
}
- public boolean isKeyguardCurrentlySecure() {
- return !mUnlockMethodCache.canSkipBouncer();
- }
-
public void setPanelExpanded(boolean isExpanded) {
mPanelExpanded = isExpanded;
updateHideIconsForBouncer(false /* animate */);
@@ -1818,8 +1812,8 @@
@Override
public void handleSystemKey(int key) {
if (SPEW) Log.d(TAG, "handleNavigationKey: " + key);
- if (!mCommandQueue.panelsEnabled() || !mKeyguardMonitor.isDeviceInteractive()
- || mKeyguardMonitor.isShowing() && !mKeyguardMonitor.isOccluded()) {
+ if (!mCommandQueue.panelsEnabled() || !mKeyguardUpdateMonitor.isDeviceInteractive()
+ || mKeyguardStateController.isShowing() && !mKeyguardStateController.isOccluded()) {
return;
}
@@ -2428,10 +2422,6 @@
mLightBarController.dump(fd, pw, args);
}
- if (mUnlockMethodCache != null) {
- mUnlockMethodCache.dump(pw);
- }
-
if (mKeyguardBypassController != null) {
mKeyguardBypassController.dump(pw);
}
@@ -2684,7 +2674,7 @@
public void dismissKeyguardThenExecute(OnDismissAction action, Runnable cancelAction,
boolean afterKeyguardGone) {
if (mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_ASLEEP
- && mUnlockMethodCache.canSkipBouncer()
+ && mKeyguardStateController.canDismissLockScreen()
&& !mStatusBarStateController.leaveOpenOnKeyguardHide()
&& isPulsing()) {
// Reuse the biometric wake-and-unlock transition if we dismiss keyguard from a pulse.
@@ -2827,14 +2817,14 @@
boolean isShowing = mStatusBarKeyguardViewManager.isShowing();
boolean isOccluded = mStatusBarKeyguardViewManager.isOccluded();
boolean isBouncerShowing = mStatusBarKeyguardViewManager.isBouncerShowing();
- boolean isSecure = mUnlockMethodCache.isMethodSecure();
- boolean canSkipBouncer = mUnlockMethodCache.canSkipBouncer();
+ boolean isSecure = mKeyguardStateController.isMethodSecure();
+ boolean unlocked = mKeyguardStateController.canDismissLockScreen();
int stateFingerprint = getLoggingFingerprint(mState,
isShowing,
isOccluded,
isBouncerShowing,
isSecure,
- canSkipBouncer);
+ unlocked);
if (stateFingerprint != mLastLoggedStateFingerprint) {
if (mStatusBarStateLog == null) {
mStatusBarStateLog = new LogMaker(MetricsEvent.VIEW_UNKNOWN);
@@ -2848,7 +2838,7 @@
isOccluded ? 1 : 0,
isBouncerShowing ? 1 : 0,
isSecure ? 1 : 0,
- canSkipBouncer ? 1 : 0);
+ unlocked ? 1 : 0);
mLastLoggedStateFingerprint = stateFingerprint;
}
}
@@ -3048,7 +3038,7 @@
public void showKeyguardImpl() {
mIsKeyguard = true;
- if (mKeyguardMonitor.isLaunchTransitionFadingAway()) {
+ if (mKeyguardStateController.isLaunchTransitionFadingAway()) {
mNotificationPanel.animate().cancel();
onLaunchTransitionFadingEnded();
}
@@ -3080,7 +3070,7 @@
mNotificationPanel.onAffordanceLaunchEnded();
releaseGestureWakeLock();
runLaunchTransitionEndRunnable();
- mKeyguardMonitor.setLaunchTransitionFadingAway(false);
+ mKeyguardStateController.setLaunchTransitionFadingAway(false);
mPresenter.updateMediaMetaData(true /* metaDataChanged */, true);
}
@@ -3105,7 +3095,7 @@
mHandler.removeMessages(MSG_LAUNCH_TRANSITION_TIMEOUT);
mLaunchTransitionEndRunnable = endRunnable;
Runnable hideRunnable = () -> {
- mKeyguardMonitor.setLaunchTransitionFadingAway(true);
+ mKeyguardStateController.setLaunchTransitionFadingAway(true);
if (beforeFading != null) {
beforeFading.run();
}
@@ -3198,7 +3188,7 @@
if (!mStatusBarStateController.isKeyguardRequested()) {
mStatusBarStateController.setLeaveOpenOnKeyguardHide(false);
}
- long delay = mKeyguardMonitor.calculateGoingToFullShadeDelay();
+ long delay = mKeyguardStateController.calculateGoingToFullShadeDelay();
mNotificationPanel.animateToFullShade(delay);
if (mDraggedDownEntry != null) {
mDraggedDownEntry.setUserLocked(false);
@@ -3240,7 +3230,7 @@
public void keyguardGoingAway() {
// Treat Keyguard exit animation as an app transition to achieve nice transition for status
// bar.
- mKeyguardMonitor.notifyKeyguardGoingAway(true);
+ mKeyguardStateController.notifyKeyguardGoingAway(true);
mCommandQueue.appTransitionPending(mDisplayId, true /* forced */);
}
@@ -3260,14 +3250,14 @@
mCommandQueue.appTransitionStarting(mDisplayId,
startTime - LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION,
LightBarTransitionsController.DEFAULT_TINT_ANIMATION_DURATION, true);
- mKeyguardMonitor.notifyKeyguardFadingAway(delay, fadeoutDuration, isBypassFading);
+ mKeyguardStateController.notifyKeyguardFadingAway(delay, fadeoutDuration, isBypassFading);
}
/**
* Notifies that the Keyguard fading away animation is done.
*/
public void finishKeyguardFadingAway() {
- mKeyguardMonitor.notifyKeyguardDoneFading();
+ mKeyguardStateController.notifyKeyguardDoneFading();
mScrimController.setExpansionAffectsAlpha(true);
}
@@ -3513,8 +3503,8 @@
}
private void updateKeyguardState() {
- mKeyguardMonitor.notifyKeyguardState(mStatusBarKeyguardViewManager.isShowing(),
- mUnlockMethodCache.isMethodSecure(),
+ mKeyguardStateController.notifyKeyguardState(mStatusBarKeyguardViewManager.isShowing(),
+ mKeyguardStateController.isMethodSecure(),
mStatusBarKeyguardViewManager.isOccluded());
}
@@ -3562,7 +3552,7 @@
public void onTrackingStopped(boolean expand) {
if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) {
- if (!expand && !mUnlockMethodCache.canSkipBouncer()) {
+ if (!expand && !mKeyguardStateController.canDismissLockScreen()) {
showBouncer(false /* scrimmed */);
}
}
@@ -3786,7 +3776,7 @@
@Override
public void showScreenPinningRequest(int taskId) {
- if (mKeyguardMonitor.isShowing()) {
+ if (mKeyguardStateController.isShowing()) {
// Don't allow apps to trigger this from keyguard.
return;
}
@@ -3909,7 +3899,7 @@
// We don't want to end up in KEYGUARD state when we're unlocking with
// fingerprint from doze. We should cross fade directly from black.
boolean unlocking = mBiometricUnlockController.isWakeAndUnlock()
- || mKeyguardMonitor.isKeyguardFadingAway();
+ || mKeyguardStateController.isKeyguardFadingAway();
// Do not animate the scrim expansion when triggered by the fingerprint sensor.
mScrimController.setExpansionAffectsAlpha(
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 bb8ba05..df23f8ca 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -56,8 +56,7 @@
import com.android.systemui.statusbar.notification.ViewGroupFadeHelper;
import com.android.systemui.statusbar.phone.KeyguardBouncer.BouncerExpansionCallback;
import com.android.systemui.statusbar.policy.ConfigurationController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
-import com.android.systemui.statusbar.policy.KeyguardMonitorImpl;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -165,8 +164,8 @@
// Dismiss action to be launched when we stop dozing or the keyguard is gone.
private DismissWithActionRequest mPendingWakeupAction;
- private final KeyguardMonitorImpl mKeyguardMonitor =
- (KeyguardMonitorImpl) Dependency.get(KeyguardMonitor.class);
+ private final KeyguardStateController mKeyguardStateController = Dependency.get(
+ KeyguardStateController.class);
private final NotificationMediaManager mMediaManager =
Dependency.get(NotificationMediaManager.class);
private final SysuiStatusBarStateController mStatusBarStateController =
@@ -221,7 +220,7 @@
mBiometricUnlockController = biometricUnlockController;
mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext,
mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry,
- mExpansionCallback, falsingManager, bypassController);
+ mExpansionCallback, mKeyguardStateController, falsingManager, bypassController);
mNotificationPanelView = notificationPanelView;
notificationPanelView.addExpansionListener(this);
mBypassController = bypassController;
@@ -245,7 +244,7 @@
mBouncer.setExpansion(expansion);
}
if (expansion != KeyguardBouncer.EXPANSION_HIDDEN && tracking
- && mStatusBar.isKeyguardCurrentlySecure()
+ && !mKeyguardStateController.canDismissLockScreen()
&& !mBouncer.isShowing() && !mBouncer.isAnimatingAway()) {
mBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */);
}
@@ -269,7 +268,7 @@
boolean keyguardWithoutQs = mStatusBarStateController.getState() == StatusBarState.KEYGUARD
&& !mNotificationPanelView.isQsExpanded();
boolean lockVisible = (mBouncer.isShowing() || keyguardWithoutQs)
- && !mBouncer.isAnimatingAway() && !mKeyguardMonitor.isKeyguardFadingAway();
+ && !mBouncer.isAnimatingAway() && !mKeyguardStateController.isKeyguardFadingAway();
if (mLastLockVisible != lockVisible) {
mLastLockVisible = lockVisible;
@@ -299,8 +298,9 @@
public void show(Bundle options) {
mShowing = true;
mStatusBarWindowController.setKeyguardShowing(true);
- mKeyguardMonitor.notifyKeyguardState(
- mShowing, mKeyguardMonitor.isSecure(), mKeyguardMonitor.isOccluded());
+ mKeyguardStateController.notifyKeyguardState(
+ mShowing, mKeyguardStateController.isMethodSecure(),
+ mKeyguardStateController.isOccluded());
reset(true /* hideBouncerWhenShowing */);
StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED,
StatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN);
@@ -530,8 +530,8 @@
*/
public void hide(long startTime, long fadeoutDuration) {
mShowing = false;
- mKeyguardMonitor.notifyKeyguardState(
- mShowing, mKeyguardMonitor.isSecure(), mKeyguardMonitor.isOccluded());
+ mKeyguardStateController.notifyKeyguardState(mShowing,
+ mKeyguardStateController.isMethodSecure(), mKeyguardStateController.isOccluded());
launchPendingWakeupAction();
if (Dependency.get(KeyguardUpdateMonitor.class).needsSlowUnlockTransition()) {
@@ -739,8 +739,8 @@
}
private long getNavBarShowDelay() {
- if (mKeyguardMonitor.isKeyguardFadingAway()) {
- return mKeyguardMonitor.getKeyguardFadingAwayDelay();
+ if (mKeyguardStateController.isKeyguardFadingAway()) {
+ return mKeyguardStateController.getKeyguardFadingAwayDelay();
} else if (mBouncer.isShowing()) {
return NAV_BAR_SHOW_DELAY_BOUNCER;
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
index 320243b..dfec195 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -68,7 +68,7 @@
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.policy.HeadsUpUtil;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
/**
* Status bar implementation of {@link NotificationActivityStarter}.
@@ -84,7 +84,7 @@
private final NotificationRemoteInputManager mRemoteInputManager;
private final NotificationLockscreenUserManager mLockscreenUserManager;
private final ShadeController mShadeController;
- private final KeyguardMonitor mKeyguardMonitor;
+ private final KeyguardStateController mKeyguardStateController;
private final ActivityStarter mActivityStarter;
private final NotificationEntryManager mEntryManager;
private final StatusBarStateController mStatusBarStateController;
@@ -125,7 +125,7 @@
NotificationGroupManager groupManager,
NotificationLockscreenUserManager lockscreenUserManager,
ShadeController shadeController,
- KeyguardMonitor keyguardMonitor,
+ KeyguardStateController keyguardStateController,
NotificationInterruptionStateProvider notificationInterruptionStateProvider,
MetricsLogger metricsLogger,
LockPatternUtils lockPatternUtils,
@@ -145,7 +145,7 @@
mRemoteInputManager = remoteInputManager;
mLockscreenUserManager = lockscreenUserManager;
mShadeController = shadeController;
- mKeyguardMonitor = keyguardMonitor;
+ mKeyguardStateController = keyguardStateController;
mActivityStarter = activityStarter;
mEntryManager = entryManager;
mStatusBarStateController = statusBarStateController;
@@ -204,7 +204,7 @@
&& mActivityIntentHelper.wouldLaunchResolverActivity(intent.getIntent(),
mLockscreenUserManager.getCurrentUserId());
final boolean wasOccluded = mShadeController.isOccluded();
- boolean showOverLockscreen = mKeyguardMonitor.isShowing() && intent != null
+ boolean showOverLockscreen = mKeyguardStateController.isShowing() && intent != null
&& mActivityIntentHelper.wouldShowOverLockscreen(intent.getIntent(),
mLockscreenUserManager.getCurrentUserId());
ActivityStarter.OnDismissAction postKeyguardAction =
@@ -258,7 +258,7 @@
if (showOverLockscreen) {
mShadeController.addPostCollapseAction(runnable);
mShadeController.collapsePanel(true /* animate */);
- } else if (mKeyguardMonitor.isShowing()
+ } else if (mKeyguardStateController.isShowing()
&& mShadeController.isOccluded()) {
mShadeController.addAfterKeyguardGoneRunnable(runnable);
mShadeController.collapsePanel();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
index 4732049..3e0c268 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
@@ -74,7 +74,7 @@
import com.android.systemui.statusbar.notification.row.NotificationInfo.CheckSaveListener;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.policy.ConfigurationController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.util.ArrayList;
@@ -89,7 +89,8 @@
private final ShadeController mShadeController = Dependency.get(ShadeController.class);
private final ActivityStarter mActivityStarter = Dependency.get(ActivityStarter.class);
- private final KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ private final KeyguardStateController mKeyguardStateController = Dependency.get(
+ KeyguardStateController.class);
private final NotificationViewHierarchyManager mViewHierarchyManager =
Dependency.get(NotificationViewHierarchyManager.class);
private final NotificationLockscreenUserManager mLockscreenUserManager =
@@ -123,7 +124,6 @@
private final DynamicPrivacyController mDynamicPrivacyController;
private boolean mReinflateNotificationsOnUserSwitched;
private boolean mDispatchUiModeChangeOnUserSwitched;
- private final UnlockMethodCache mUnlockMethodCache;
private TextView mNotificationPanelDebugText;
protected boolean mVrMode;
@@ -152,7 +152,6 @@
mAccessibilityManager = context.getSystemService(AccessibilityManager.class);
mDozeScrimController = dozeScrimController;
mScrimController = scrimController;
- mUnlockMethodCache = UnlockMethodCache.getInstance(mContext);
mKeyguardManager = context.getSystemService(KeyguardManager.class);
mMaxAllowedKeyguardNotifications = context.getResources().getInteger(
R.integer.keyguard_max_notification_count);
@@ -366,7 +365,7 @@
return false;
} else {
// we only allow head-up on the lockscreen if it doesn't have a fullscreen intent
- return !mKeyguardMonitor.isShowing()
+ return !mKeyguardStateController.isShowing()
|| mShadeController.isOccluded();
}
}
@@ -398,7 +397,7 @@
public void onBindRow(NotificationEntry entry, PackageManager pmUser,
StatusBarNotification sbn, ExpandableNotificationRow row) {
row.setAboveShelfChangedListener(mAboveShelfObserver);
- row.setSecureStateProvider(mUnlockMethodCache::canSkipBouncer);
+ row.setSecureStateProvider(mKeyguardStateController::canDismissLockScreen);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java
index 13d4b8e..9a281ce 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java
@@ -47,8 +47,7 @@
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
-import com.android.systemui.statusbar.policy.RemoteInputView;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -59,7 +58,8 @@
public class StatusBarRemoteInputCallback implements Callback, Callbacks,
StatusBarStateController.StateListener {
- private final KeyguardMonitor mKeyguardMonitor = Dependency.get(KeyguardMonitor.class);
+ private final KeyguardStateController mKeyguardStateController = Dependency.get(
+ KeyguardStateController.class);
private final SysuiStatusBarStateController mStatusBarStateController =
(SysuiStatusBarStateController) Dependency.get(StatusBarStateController.class);
private final NotificationLockscreenUserManager mLockscreenUserManager =
@@ -165,7 +165,7 @@
@Override
public void onMakeExpandedVisibleForRemoteInput(ExpandableNotificationRow row,
View clickedView) {
- if (mKeyguardMonitor.isShowing()) {
+ if (mKeyguardStateController.isShowing()) {
onLockedRemoteInput(row, clickedView);
} else {
if (row.isChildInGroup() && !row.areChildrenExpanded()) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java
index e61a67c..5bda34d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java
@@ -28,7 +28,7 @@
import com.android.systemui.Dependency;
import com.android.systemui.R;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
/**
@@ -100,7 +100,7 @@
}
public static void setWindowOnTop(Dialog dialog) {
- if (Dependency.get(KeyguardMonitor.class).isShowing()) {
+ if (Dependency.get(KeyguardStateController.class).isShowing()) {
dialog.getWindow().setType(LayoutParams.TYPE_STATUS_BAR_PANEL);
} else {
dialog.getWindow().setType(LayoutParams.TYPE_STATUS_BAR_SUB_PANEL);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java
deleted file mode 100644
index c76f93e..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * 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.systemui.statusbar.phone;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.hardware.biometrics.BiometricSourceType;
-import android.os.Build;
-import android.os.Trace;
-
-import com.android.internal.widget.LockPatternUtils;
-import com.android.keyguard.KeyguardUpdateMonitor;
-import com.android.keyguard.KeyguardUpdateMonitorCallback;
-import com.android.systemui.DejankUtils;
-import com.android.systemui.Dependency;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-
-/**
- * Caches whether the current unlock method is insecure, taking trust into account. This information
- * might be a little bit out of date and should not be used for actual security decisions; it should
- * be only used for visual indications.
- */
-public class UnlockMethodCache {
-
- private static UnlockMethodCache sInstance;
- private static final boolean DEBUG_AUTH_WITH_ADB = false;
- private static final String AUTH_BROADCAST_KEY = "debug_trigger_auth";
-
- private final LockPatternUtils mLockPatternUtils;
- private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
- private final ArrayList<OnUnlockMethodChangedListener> mListeners = new ArrayList<>();
- /** Whether the user configured a secure unlock method (PIN, password, etc.) */
- private boolean mSecure;
- /** Whether the unlock method is currently insecure (insecure method or trusted environment) */
- private boolean mCanSkipBouncer;
- private boolean mTrustManaged;
- private boolean mTrusted;
- private boolean mDebugUnlocked = false;
- private boolean mFaceAuthEnabled;
-
- private UnlockMethodCache(Context ctx) {
- mLockPatternUtils = new LockPatternUtils(ctx);
- mKeyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
- Dependency.get(KeyguardUpdateMonitor.class).registerCallback(mCallback);
- update(true /* updateAlways */);
- if (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB) {
- // Watch for interesting updates
- final IntentFilter filter = new IntentFilter();
- filter.addAction(AUTH_BROADCAST_KEY);
- ctx.registerReceiver(new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (DEBUG_AUTH_WITH_ADB && AUTH_BROADCAST_KEY.equals(intent.getAction())) {
- mDebugUnlocked = !mDebugUnlocked;
- update(true /* updateAlways */);
- }
- }
- }, filter, null, null);
- }
- }
-
- public static UnlockMethodCache getInstance(Context context) {
- if (sInstance == null) {
- sInstance = new UnlockMethodCache(context);
- }
- return sInstance;
- }
-
- /**
- * @return whether the user configured a secure unlock method like PIN, password, etc.
- */
- public boolean isMethodSecure() {
- return mSecure;
- }
-
- public boolean isTrusted() {
- return mTrusted;
- }
-
- /**
- * @return whether the lockscreen is currently insecure, and the bouncer won't be shown
- */
- public boolean canSkipBouncer() {
- return mCanSkipBouncer;
- }
-
- public void addListener(OnUnlockMethodChangedListener listener) {
- mListeners.add(listener);
- }
-
- public void removeListener(OnUnlockMethodChangedListener listener) {
- mListeners.remove(listener);
- }
-
- /**
- * If there are faces enrolled and user enabled face auth on keyguard.
- */
- public boolean isFaceAuthEnabled() {
- return mFaceAuthEnabled;
- }
-
- private void update(boolean updateAlways) {
- Trace.beginSection("UnlockMethodCache#update");
- int user = KeyguardUpdateMonitor.getCurrentUser();
- boolean secure = mLockPatternUtils.isSecure(user);
- boolean canSkipBouncer = !secure || mKeyguardUpdateMonitor.getUserCanSkipBouncer(user)
- || (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB && mDebugUnlocked);
- boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
- boolean trusted = mKeyguardUpdateMonitor.getUserHasTrust(user);
- boolean faceAuthEnabled = mKeyguardUpdateMonitor.isFaceAuthEnabledForUser(user);
- boolean changed = secure != mSecure || canSkipBouncer != mCanSkipBouncer
- || trustManaged != mTrustManaged
- || mFaceAuthEnabled != faceAuthEnabled;
- if (changed || updateAlways) {
- mSecure = secure;
- mCanSkipBouncer = canSkipBouncer;
- mTrusted = trusted;
- mTrustManaged = trustManaged;
- mFaceAuthEnabled = faceAuthEnabled;
- Trace.endSection();
- notifyListeners();
- } else {
- Trace.endSection();
- }
- }
-
- private void notifyListeners() {
- String tag = "UnlockMethodCache#notifyListeners";
- DejankUtils.startDetectingBlockingIpcs(tag);
- for (OnUnlockMethodChangedListener listener : mListeners) {
- listener.onUnlockMethodStateChanged();
- }
- DejankUtils.stopDetectingBlockingIpcs(tag);
- }
-
- public void dump(PrintWriter pw) {
- pw.println("UnlockMethodCache");
- pw.println(" mSecure: " + mSecure);
- pw.println(" mCanSkipBouncer: " + mCanSkipBouncer);
- pw.println(" mTrustManaged: " + mTrustManaged);
- pw.println(" mTrusted: " + mTrusted);
- pw.println(" mDebugUnlocked: " + mDebugUnlocked);
- pw.println(" mFaceAuthEnabled: " + mFaceAuthEnabled);
- }
-
- private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
- @Override
- public void onUserSwitchComplete(int userId) {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onTrustChanged(int userId) {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onTrustManagedChanged(int userId) {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onStartedWakingUp() {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onBiometricAuthenticated(int userId, BiometricSourceType biometricSourceType) {
- Trace.beginSection("KeyguardUpdateMonitorCallback#onBiometricAuthenticated");
- if (!mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed()) {
- Trace.endSection();
- return;
- }
- update(false /* updateAlways */);
- Trace.endSection();
- }
-
- @Override
- public void onFaceUnlockStateChanged(boolean running, int userId) {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onStrongAuthStateChanged(int userId) {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onScreenTurnedOff() {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onKeyguardVisibilityChanged(boolean showing) {
- update(false /* updateAlways */);
- }
-
- @Override
- public void onBiometricsCleared() {
- update(false /* alwaysUpdate */);
- }
- };
-
- public boolean isTrustManaged() {
- return mTrustManaged;
- }
-
- public static interface OnUnlockMethodChangedListener {
- void onUnlockMethodStateChanged();
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
deleted file mode 100644
index 6dc90b9..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2016 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.systemui.statusbar.policy;
-
-import com.android.systemui.statusbar.policy.KeyguardMonitor.Callback;
-
-public interface KeyguardMonitor extends CallbackController<Callback> {
-
- boolean isSecure();
- boolean isShowing();
- boolean isOccluded();
- boolean isKeyguardFadingAway();
- boolean isKeyguardGoingAway();
- boolean isLaunchTransitionFadingAway();
- long getKeyguardFadingAwayDuration();
- long getKeyguardFadingAwayDelay();
- long calculateGoingToFullShadeDelay();
-
- /**
- * @return a shortened fading away duration similar to
- * {{@link #getKeyguardFadingAwayDuration()}} which may only span half of the duration, unless
- * we're bypassing
- */
- default long getShortenedFadingAwayDuration() {
- if (isBypassFadingAnimation()) {
- return getKeyguardFadingAwayDuration();
- } else {
- return getKeyguardFadingAwayDuration() / 2;
- }
- }
-
- default boolean isDeviceInteractive() {
- return false;
- }
-
- default void setLaunchTransitionFadingAway(boolean b) {
- }
-
- default void notifyKeyguardGoingAway(boolean b) {
- }
-
- /**
- * @return {@code true} if the current fading away animation is the fast bypass fading.
- */
- default boolean isBypassFadingAnimation() {
- return false;
- }
-
- /**
- * Notifies that the Keyguard is fading away with the specified timings.
- * @param delay the precalculated animation delay in milliseconds
- * @param fadeoutDuration the duration of the exit animation, in milliseconds
- * @param isBypassFading is this a fading away animation while bypassing
- */
- default void notifyKeyguardFadingAway(long delay, long fadeoutDuration,
- boolean isBypassFading) {
- }
-
- default void notifyKeyguardDoneFading() {
- }
-
- default void notifyKeyguardState(boolean showing, boolean methodSecure, boolean occluded) {
- }
-
- interface Callback {
- default void onKeyguardShowingChanged() {}
- default void onKeyguardFadingAwayChanged() {}
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java
deleted file mode 100644
index e8b0f9b..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * 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.systemui.statusbar.policy;
-
-import android.annotation.NonNull;
-import android.content.Context;
-
-import com.android.internal.util.Preconditions;
-import com.android.keyguard.KeyguardUpdateMonitor;
-import com.android.keyguard.KeyguardUpdateMonitorCallback;
-import com.android.systemui.Dependency;
-
-import java.util.ArrayList;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-/**
- */
-@Singleton
-public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback
- implements KeyguardMonitor {
-
- private final ArrayList<Callback> mCallbacks = new ArrayList<>();
-
- private final Context mContext;
- private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
-
- private boolean mShowing;
- private boolean mSecure;
- private boolean mOccluded;
-
- private boolean mListening;
- private boolean mKeyguardFadingAway;
- private long mKeyguardFadingAwayDelay;
- private long mKeyguardFadingAwayDuration;
- private boolean mKeyguardGoingAway;
- private boolean mLaunchTransitionFadingAway;
- private boolean mBypassFadingAnimation;
-
- /**
- */
- @Inject
- public KeyguardMonitorImpl(Context context) {
- mContext = context;
- mKeyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
- }
-
- @Override
- public void addCallback(@NonNull Callback callback) {
- Preconditions.checkNotNull(callback, "Callback must not be null. b/128895449");
- mCallbacks.add(callback);
- if (mCallbacks.size() != 0 && !mListening) {
- mListening = true;
- mKeyguardUpdateMonitor.registerCallback(this);
- }
- }
-
- @Override
- public void removeCallback(@NonNull Callback callback) {
- Preconditions.checkNotNull(callback, "Callback must not be null. b/128895449");
- if (mCallbacks.remove(callback) && mCallbacks.size() == 0 && mListening) {
- mListening = false;
- mKeyguardUpdateMonitor.removeCallback(this);
- }
- }
-
- @Override
- public boolean isShowing() {
- return mShowing;
- }
-
- @Override
- public boolean isSecure() {
- return mSecure;
- }
-
- @Override
- public boolean isOccluded() {
- return mOccluded;
- }
-
- public void notifyKeyguardState(boolean showing, boolean secure, boolean occluded) {
- if (mShowing == showing && mSecure == secure && mOccluded == occluded) return;
- mShowing = showing;
- mSecure = secure;
- mOccluded = occluded;
- notifyKeyguardChanged();
- }
-
- @Override
- public void onTrustChanged(int userId) {
- notifyKeyguardChanged();
- }
-
- public boolean isDeviceInteractive() {
- return mKeyguardUpdateMonitor.isDeviceInteractive();
- }
-
- private void notifyKeyguardChanged() {
- // Copy the list to allow removal during callback.
- new ArrayList<>(mCallbacks).forEach(Callback::onKeyguardShowingChanged);
- }
-
- public void notifyKeyguardFadingAway(long delay, long fadeoutDuration, boolean isBypassFading) {
- mKeyguardFadingAwayDelay = delay;
- mKeyguardFadingAwayDuration = fadeoutDuration;
- mBypassFadingAnimation = isBypassFading;
- setKeyguardFadingAway(true);
- }
-
- private void setKeyguardFadingAway(boolean keyguardFadingAway) {
- if (mKeyguardFadingAway != keyguardFadingAway) {
- mKeyguardFadingAway = keyguardFadingAway;
- ArrayList<Callback> callbacks = new ArrayList<>(mCallbacks);
- for (int i = 0; i < callbacks.size(); i++) {
- callbacks.get(i).onKeyguardFadingAwayChanged();
- }
- }
- }
-
- public void notifyKeyguardDoneFading() {
- mKeyguardGoingAway = false;
- setKeyguardFadingAway(false);
- }
-
- @Override
- public boolean isKeyguardFadingAway() {
- return mKeyguardFadingAway;
- }
-
- @Override
- public boolean isKeyguardGoingAway() {
- return mKeyguardGoingAway;
- }
-
- @Override
- public boolean isBypassFadingAnimation() {
- return mBypassFadingAnimation;
- }
-
- @Override
- public long getKeyguardFadingAwayDelay() {
- return mKeyguardFadingAwayDelay;
- }
-
- @Override
- public long getKeyguardFadingAwayDuration() {
- return mKeyguardFadingAwayDuration;
- }
-
- @Override
- public long calculateGoingToFullShadeDelay() {
- return mKeyguardFadingAwayDelay + mKeyguardFadingAwayDuration;
- }
-
- public void notifyKeyguardGoingAway(boolean keyguardGoingAway) {
- mKeyguardGoingAway = keyguardGoingAway;
- }
-
- public void setLaunchTransitionFadingAway(boolean fadingAway) {
- mLaunchTransitionFadingAway = fadingAway;
- }
-
- @Override
- public boolean isLaunchTransitionFadingAway() {
- return mLaunchTransitionFadingAway;
- }
-}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateController.java
new file mode 100644
index 0000000..aefe201
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateController.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2016 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.systemui.statusbar.policy;
+
+import com.android.systemui.statusbar.StatusBarState;
+import com.android.systemui.statusbar.policy.KeyguardStateController.Callback;
+
+/**
+ * Source of truth for keyguard state: If locked, occluded, has password, trusted etc.
+ */
+public interface KeyguardStateController extends CallbackController<Callback> {
+
+ /**
+ * If the device is locked or unlocked.
+ */
+ default boolean isUnlocked() {
+ return !isShowing() || canDismissLockScreen();
+ }
+
+ /**
+ * If the lock screen is visible.
+ * The keyguard is also visible when the device is asleep or in always on mode, except when
+ * the screen timed out and the user can unlock by quickly pressing power.
+ *
+ * This is unrelated to being locked or not.
+ *
+ * @see #isUnlocked()
+ * @see #canDismissLockScreen()
+ */
+ boolean isShowing();
+
+ /**
+ * If swiping up will unlock without asking for a password.
+ * @see #isUnlocked()
+ */
+ boolean canDismissLockScreen();
+
+ /**
+ * If the device has PIN/pattern/password or a lock screen at all.
+ */
+ boolean isMethodSecure();
+
+ /**
+ * When there's an {@link android.app.Activity} on top of the keyguard, where
+ * {@link android.app.Activity#setShowWhenLocked(boolean)} is true.
+ */
+ boolean isOccluded();
+
+ /**
+ * If a {@link android.service.trust.TrustAgentService} is keeping the device unlocked.
+ * {@link #canDismissLockScreen()} is better source of truth that also considers this state.
+ */
+ boolean isTrusted();
+
+ /**
+ * If the keyguard dismissal animation is running.
+ * @see #isKeyguardGoingAway()
+ */
+ boolean isKeyguardFadingAway();
+
+ /**
+ * When the keyguard challenge was successfully solved, and {@link android.app.ActivityManager}
+ * is launching the activity that will be revealed.
+ *
+ * This also includes the animation of the keyguard being dismissed, meaning that this will
+ * return {@code true} whenever {@link #isKeyguardFadingAway()} also returns {@code true}.
+ */
+ boolean isKeyguardGoingAway();
+
+ /**
+ * @return a shortened fading away duration similar to
+ * {{@link #getKeyguardFadingAwayDuration()}} which may only span half of the duration, unless
+ * we're bypassing
+ */
+ default long getShortenedFadingAwayDuration() {
+ if (isBypassFadingAnimation()) {
+ return getKeyguardFadingAwayDuration();
+ } else {
+ return getKeyguardFadingAwayDuration() / 2;
+ }
+ }
+
+ /**
+ * @return {@code true} if the current fading away animation is the fast bypass fading.
+ */
+ default boolean isBypassFadingAnimation() {
+ return false;
+ }
+
+ /**
+ * Notifies that the Keyguard is fading away with the specified timings.
+ * @param delay the precalculated animation delay in milliseconds
+ * @param fadeoutDuration the duration of the exit animation, in milliseconds
+ * @param isBypassFading is this a fading away animation while bypassing
+ */
+ default void notifyKeyguardFadingAway(long delay, long fadeoutDuration,
+ boolean isBypassFading) {
+ }
+
+ /**
+ * If there are faces enrolled and user enabled face auth on keyguard.
+ */
+ default boolean isFaceAuthEnabled() {
+ return false;
+ }
+
+ /**
+ * If the animation that morphs a notification into an app window is playing.
+ */
+ boolean isLaunchTransitionFadingAway();
+
+ /**
+ * How long the keyguard dismissal animation should take when unlocking.
+ */
+ long getKeyguardFadingAwayDuration();
+
+ /**
+ * Delay for {@link #getKeyguardFadingAwayDuration()}.
+ */
+ long getKeyguardFadingAwayDelay();
+
+ /**
+ * Delay when going from {@link StatusBarState#KEYGUARD} to {@link StatusBarState#SHADE} or
+ * {@link StatusBarState#SHADE_LOCKED}.
+ */
+ long calculateGoingToFullShadeDelay();
+
+ /** **/
+ default void setLaunchTransitionFadingAway(boolean b) {}
+ /** **/
+ default void notifyKeyguardGoingAway(boolean b) {}
+ /** **/
+ default void notifyKeyguardDoneFading() {}
+ /** **/
+ default void notifyKeyguardState(boolean showing, boolean methodSecure, boolean occluded) {}
+
+ /**
+ * Callback for authentication events.
+ */
+ interface Callback {
+ /**
+ * Called when the locked state of the device changes. The lock screen might still be
+ * showing on some cases, like when a {@link android.service.trust.TrustAgentService} is
+ * active, or face auth was triggered but the user didn't swipe up to dismiss the lock
+ * screen yet.
+ */
+ default void onUnlockedChanged() {}
+
+ /**
+ * If the lock screen is active or not. This is different from being locked, since the lock
+ * screen can be visible but unlocked by {@link android.service.trust.TrustAgentService} or
+ * face unlock.
+ *
+ * @see #isShowing()
+ */
+ default void onKeyguardShowingChanged() {}
+
+ /**
+ * Triggered when the device was just unlocked and the lock screen is being dismissed.
+ */
+ default void onKeyguardFadingAwayChanged() {}
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java
new file mode 100644
index 0000000..f8c7532
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardStateControllerImpl.java
@@ -0,0 +1,338 @@
+/*
+ * 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.systemui.statusbar.policy;
+
+import android.annotation.NonNull;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.hardware.biometrics.BiometricSourceType;
+import android.os.Build;
+import android.os.Trace;
+
+import com.android.internal.util.Preconditions;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.keyguard.KeyguardUpdateMonitor;
+import com.android.keyguard.KeyguardUpdateMonitorCallback;
+import com.android.systemui.Dependency;
+import com.android.systemui.Dumpable;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+/**
+ */
+@Singleton
+public class KeyguardStateControllerImpl extends KeyguardUpdateMonitorCallback
+ implements KeyguardStateController, Dumpable {
+
+ private static final boolean DEBUG_AUTH_WITH_ADB = false;
+ private static final String AUTH_BROADCAST_KEY = "debug_trigger_auth";
+
+ private final ArrayList<Callback> mCallbacks = new ArrayList<>();
+ private final Context mContext;
+ private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
+ private final LockPatternUtils mLockPatternUtils;
+ private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =
+ new LockedStateInvalidator();
+
+ private boolean mCanDismissLockScreen;
+ private boolean mShowing;
+ private boolean mSecure;
+ private boolean mOccluded;
+
+ private boolean mListening;
+ private boolean mKeyguardFadingAway;
+ private long mKeyguardFadingAwayDelay;
+ private long mKeyguardFadingAwayDuration;
+ private boolean mKeyguardGoingAway;
+ private boolean mLaunchTransitionFadingAway;
+ private boolean mBypassFadingAnimation;
+ private boolean mTrustManaged;
+ private boolean mTrusted;
+ private boolean mDebugUnlocked = false;
+ private boolean mFaceAuthEnabled;
+
+ /**
+ */
+ @Inject
+ public KeyguardStateControllerImpl(Context context) {
+ mContext = context;
+ mKeyguardUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
+ mLockPatternUtils = new LockPatternUtils(context);
+ mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback);
+
+ update(true /* updateAlways */);
+ if (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB) {
+ // Watch for interesting updates
+ final IntentFilter filter = new IntentFilter();
+ filter.addAction(AUTH_BROADCAST_KEY);
+ context.registerReceiver(new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (DEBUG_AUTH_WITH_ADB && AUTH_BROADCAST_KEY.equals(intent.getAction())) {
+ mDebugUnlocked = !mDebugUnlocked;
+ update(true /* updateAlways */);
+ }
+ }
+ }, filter, null, null);
+ }
+ }
+
+ @Override
+ public void addCallback(@NonNull Callback callback) {
+ Preconditions.checkNotNull(callback, "Callback must not be null. b/128895449");
+ mCallbacks.add(callback);
+ if (mCallbacks.size() != 0 && !mListening) {
+ mListening = true;
+ mKeyguardUpdateMonitor.registerCallback(this);
+ }
+ }
+
+ @Override
+ public void removeCallback(@NonNull Callback callback) {
+ Preconditions.checkNotNull(callback, "Callback must not be null. b/128895449");
+ if (mCallbacks.remove(callback) && mCallbacks.size() == 0 && mListening) {
+ mListening = false;
+ mKeyguardUpdateMonitor.removeCallback(this);
+ }
+ }
+
+ @Override
+ public boolean isShowing() {
+ return mShowing;
+ }
+
+ @Override
+ public boolean isMethodSecure() {
+ return mSecure;
+ }
+
+ @Override
+ public boolean isOccluded() {
+ return mOccluded;
+ }
+
+ @Override
+ public boolean isTrusted() {
+ return mTrusted;
+ }
+
+ @Override
+ public void notifyKeyguardState(boolean showing, boolean secure, boolean occluded) {
+ if (mShowing == showing && mSecure == secure && mOccluded == occluded) return;
+ mShowing = showing;
+ mSecure = secure;
+ mOccluded = occluded;
+ notifyKeyguardChanged();
+ }
+
+ @Override
+ public void onTrustChanged(int userId) {
+ notifyKeyguardChanged();
+ }
+
+ private void notifyKeyguardChanged() {
+ // Copy the list to allow removal during callback.
+ new ArrayList<>(mCallbacks).forEach(Callback::onKeyguardShowingChanged);
+ }
+
+ private void notifyUnlockedChanged() {
+ // Copy the list to allow removal during callback.
+ new ArrayList<>(mCallbacks).forEach(Callback::onUnlockedChanged);
+ }
+
+ @Override
+ public void notifyKeyguardFadingAway(long delay, long fadeoutDuration, boolean isBypassFading) {
+ mKeyguardFadingAwayDelay = delay;
+ mKeyguardFadingAwayDuration = fadeoutDuration;
+ mBypassFadingAnimation = isBypassFading;
+ setKeyguardFadingAway(true);
+ }
+
+ private void setKeyguardFadingAway(boolean keyguardFadingAway) {
+ if (mKeyguardFadingAway != keyguardFadingAway) {
+ mKeyguardFadingAway = keyguardFadingAway;
+ ArrayList<Callback> callbacks = new ArrayList<>(mCallbacks);
+ for (int i = 0; i < callbacks.size(); i++) {
+ callbacks.get(i).onKeyguardFadingAwayChanged();
+ }
+ }
+ }
+
+ @Override
+ public void notifyKeyguardDoneFading() {
+ mKeyguardGoingAway = false;
+ setKeyguardFadingAway(false);
+ }
+
+ private void update(boolean updateAlways) {
+ Trace.beginSection("KeyguardStateController#update");
+ int user = KeyguardUpdateMonitor.getCurrentUser();
+ boolean secure = mLockPatternUtils.isSecure(user);
+ boolean canDismissLockScreen = !secure || mKeyguardUpdateMonitor.getUserCanSkipBouncer(user)
+ || (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB && mDebugUnlocked);
+ boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
+ boolean trusted = mKeyguardUpdateMonitor.getUserHasTrust(user);
+ boolean faceAuthEnabled = mKeyguardUpdateMonitor.isFaceAuthEnabledForUser(user);
+ boolean changed = secure != mSecure || canDismissLockScreen != mCanDismissLockScreen
+ || trustManaged != mTrustManaged
+ || mFaceAuthEnabled != faceAuthEnabled;
+ if (changed || updateAlways) {
+ mSecure = secure;
+ mCanDismissLockScreen = canDismissLockScreen;
+ mTrusted = trusted;
+ mTrustManaged = trustManaged;
+ mFaceAuthEnabled = faceAuthEnabled;
+ notifyUnlockedChanged();
+ }
+ Trace.endSection();
+ }
+
+ @Override
+ public boolean canDismissLockScreen() {
+ return mCanDismissLockScreen;
+ }
+
+ @Override
+ public boolean isFaceAuthEnabled() {
+ return mFaceAuthEnabled;
+ }
+
+ @Override
+ public boolean isKeyguardFadingAway() {
+ return mKeyguardFadingAway;
+ }
+
+ @Override
+ public boolean isKeyguardGoingAway() {
+ return mKeyguardGoingAway;
+ }
+
+ @Override
+ public boolean isBypassFadingAnimation() {
+ return mBypassFadingAnimation;
+ }
+
+ @Override
+ public long getKeyguardFadingAwayDelay() {
+ return mKeyguardFadingAwayDelay;
+ }
+
+ @Override
+ public long getKeyguardFadingAwayDuration() {
+ return mKeyguardFadingAwayDuration;
+ }
+
+ @Override
+ public long calculateGoingToFullShadeDelay() {
+ return mKeyguardFadingAwayDelay + mKeyguardFadingAwayDuration;
+ }
+
+ @Override
+ public void notifyKeyguardGoingAway(boolean keyguardGoingAway) {
+ mKeyguardGoingAway = keyguardGoingAway;
+ }
+
+ @Override
+ public void setLaunchTransitionFadingAway(boolean fadingAway) {
+ mLaunchTransitionFadingAway = fadingAway;
+ }
+
+ @Override
+ public boolean isLaunchTransitionFadingAway() {
+ return mLaunchTransitionFadingAway;
+ }
+
+ /**
+ * Dumps internal state for debugging.
+ * @param pw Where to dump.
+ */
+ @Override
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ pw.println("KeyguardStateController:");
+ pw.println(" mSecure: " + mSecure);
+ pw.println(" mCanDismissLockScreen: " + mCanDismissLockScreen);
+ pw.println(" mTrustManaged: " + mTrustManaged);
+ pw.println(" mTrusted: " + mTrusted);
+ pw.println(" mDebugUnlocked: " + mDebugUnlocked);
+ pw.println(" mFaceAuthEnabled: " + mFaceAuthEnabled);
+ }
+
+ private class LockedStateInvalidator extends KeyguardUpdateMonitorCallback {
+ @Override
+ public void onUserSwitchComplete(int userId) {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onTrustChanged(int userId) {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onTrustManagedChanged(int userId) {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onStartedWakingUp() {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onBiometricAuthenticated(int userId, BiometricSourceType biometricSourceType) {
+ Trace.beginSection("KeyguardUpdateMonitorCallback#onBiometricAuthenticated");
+ if (!mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed()) {
+ Trace.endSection();
+ return;
+ }
+ update(false /* updateAlways */);
+ Trace.endSection();
+ }
+
+ @Override
+ public void onFaceUnlockStateChanged(boolean running, int userId) {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onStrongAuthStateChanged(int userId) {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onScreenTurnedOff() {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onKeyguardVisibilityChanged(boolean showing) {
+ update(false /* updateAlways */);
+ }
+
+ @Override
+ public void onBiometricsCleared() {
+ update(false /* alwaysUpdate */);
+ }
+ };
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
index 4fa4b6c..95ae23c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
@@ -62,7 +62,6 @@
import com.android.systemui.plugins.qs.DetailAdapter;
import com.android.systemui.qs.tiles.UserDetailView;
import com.android.systemui.statusbar.phone.SystemUIDialog;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -93,7 +92,7 @@
private final ArrayList<WeakReference<BaseUserAdapter>> mAdapters = new ArrayList<>();
private final GuestResumeSessionReceiver mGuestResumeSessionReceiver
= new GuestResumeSessionReceiver();
- private final KeyguardMonitor mKeyguardMonitor;
+ private final KeyguardStateController mKeyguardStateController;
protected final Handler mHandler;
private final ActivityStarter mActivityStarter;
@@ -110,13 +109,13 @@
private SparseBooleanArray mForcePictureLoadForUserId = new SparseBooleanArray(2);
@Inject
- public UserSwitcherController(Context context, KeyguardMonitor keyguardMonitor,
+ public UserSwitcherController(Context context, KeyguardStateController keyguardStateController,
@Named(MAIN_HANDLER_NAME) Handler handler, ActivityStarter activityStarter) {
mContext = context;
if (!UserManager.isGuestUserEphemeral()) {
mGuestResumeSessionReceiver.register(context);
}
- mKeyguardMonitor = keyguardMonitor;
+ mKeyguardStateController = keyguardStateController;
mHandler = handler;
mActivityStarter = activityStarter;
mUserManager = UserManager.get(context);
@@ -149,7 +148,7 @@
// Fetch initial values.
mSettingsObserver.onChange(false);
- keyguardMonitor.addCallback(mCallback);
+ keyguardStateController.addCallback(mCallback);
listenForCallState();
refreshUsers(UserHandle.USER_NULL);
@@ -597,20 +596,18 @@
public static abstract class BaseUserAdapter extends BaseAdapter {
final UserSwitcherController mController;
- private final KeyguardMonitor mKeyguardMonitor;
- private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardStateController mKeyguardStateController;
protected BaseUserAdapter(UserSwitcherController controller) {
mController = controller;
- mKeyguardMonitor = controller.mKeyguardMonitor;
- mUnlockMethodCache = UnlockMethodCache.getInstance(controller.mContext);
+ mKeyguardStateController = controller.mKeyguardStateController;
controller.addAdapter(new WeakReference<>(this));
}
public int getUserCount() {
- boolean secureKeyguardShowing = mKeyguardMonitor.isShowing()
- && mKeyguardMonitor.isSecure()
- && !mUnlockMethodCache.canSkipBouncer();
+ boolean secureKeyguardShowing = mKeyguardStateController.isShowing()
+ && mKeyguardStateController.isMethodSecure()
+ && !mKeyguardStateController.canDismissLockScreen();
if (!secureKeyguardShowing) {
return mController.getUsers().size();
}
@@ -630,9 +627,9 @@
@Override
public int getCount() {
- boolean secureKeyguardShowing = mKeyguardMonitor.isShowing()
- && mKeyguardMonitor.isSecure()
- && !mUnlockMethodCache.canSkipBouncer();
+ boolean secureKeyguardShowing = mKeyguardStateController.isShowing()
+ && mKeyguardStateController.isMethodSecure()
+ && !mKeyguardStateController.canDismissLockScreen();
if (!secureKeyguardShowing) {
return mController.getUsers().size();
}
@@ -819,19 +816,21 @@
}
};
- private final KeyguardMonitor.Callback mCallback = new KeyguardMonitor.Callback() {
- @Override
- public void onKeyguardShowingChanged() {
+ private final KeyguardStateController.Callback mCallback =
+ new KeyguardStateController.Callback() {
+ @Override
+ public void onKeyguardShowingChanged() {
- // When Keyguard is going away, we don't need to update our items immediately which
- // helps making the transition faster.
- if (!mKeyguardMonitor.isShowing()) {
- mHandler.post(UserSwitcherController.this::notifyAdapters);
- } else {
- notifyAdapters();
- }
- }
- };
+ // When Keyguard is going away, we don't need to update our items immediately
+ // which
+ // helps making the transition faster.
+ if (!mKeyguardStateController.isShowing()) {
+ mHandler.post(UserSwitcherController.this::notifyAdapters);
+ } else {
+ notifyAdapters();
+ }
+ }
+ };
private final class ExitGuestDialog extends SystemUIDialog implements
DialogInterface.OnClickListener {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
index 818db87..853b2db 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/CastTileTest.java
@@ -40,7 +40,7 @@
import com.android.systemui.qs.QSTileHost;
import com.android.systemui.statusbar.policy.CastController;
import com.android.systemui.statusbar.policy.CastController.CastDevice;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.NetworkController;
import org.junit.Before;
@@ -64,7 +64,7 @@
@Mock
private ActivityStarter mActivityStarter;
@Mock
- private KeyguardMonitor mKeyguard;
+ private KeyguardStateController mKeyguard;
@Mock
private NetworkController mNetworkController;
@Mock
@@ -83,7 +83,7 @@
mDependency.injectTestDependency(Dependency.BG_LOOPER, mTestableLooper.getLooper());
mController = mDependency.injectMockDependency(CastController.class);
mActivityStarter = mDependency.injectMockDependency(ActivityStarter.class);
- mKeyguard = mDependency.injectMockDependency(KeyguardMonitor.class);
+ mKeyguard = mDependency.injectMockDependency(KeyguardStateController.class);
mNetworkController = mDependency.injectMockDependency(NetworkController.class);
when(mHost.getContext()).thenReturn(mContext);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
index 0817ee9..cf6fd4a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
@@ -51,8 +51,8 @@
import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
import com.android.systemui.statusbar.phone.LockIcon;
import com.android.systemui.statusbar.phone.ShadeController;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
import com.android.systemui.statusbar.policy.AccessibilityController;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.wakelock.WakeLockFake;
import org.junit.Before;
@@ -79,7 +79,7 @@
@Mock
private AccessibilityController mAccessibilityController;
@Mock
- private UnlockMethodCache mUnlockMethodCache;
+ private KeyguardStateController mKeyguardStateController;
@Mock
private StatusBarStateController mStatusBarStateController;
@Mock
@@ -111,7 +111,7 @@
}
mController = new KeyguardIndicationController(mContext, mIndicationArea, mLockIcon,
mLockPatternUtils, mWakeLock, mShadeController, mAccessibilityController,
- mUnlockMethodCache, mStatusBarStateController, mKeyguardUpdateMonitor);
+ mKeyguardStateController, mStatusBarStateController, mKeyguardUpdateMonitor);
}
@Test
@@ -187,7 +187,7 @@
}
@Test
- public void unlockMethodCache_listenerUpdatesIndication() {
+ public void updateMonitor_listenerUpdatesIndication() {
createController();
String restingIndication = "Resting indication";
@@ -203,14 +203,14 @@
reset(mKeyguardUpdateMonitor);
when(mKeyguardUpdateMonitor.isUserUnlocked(anyInt())).thenReturn(true);
when(mKeyguardUpdateMonitor.getUserHasTrust(anyInt())).thenReturn(false);
- mController.onUnlockMethodStateChanged();
+ mController.onUnlockedChanged();
assertThat(mTextView.getText()).isEqualTo(restingIndication);
}
@Test
- public void unlockMethodCache_listener() {
+ public void updateMonitor_listener() {
createController();
- verify(mUnlockMethodCache).addListener(eq(mController));
+ verify(mKeyguardStateController).addCallback(eq(mController));
verify(mStatusBarStateController).addCallback(eq(mController));
verify(mKeyguardUpdateMonitor, times(2)).registerCallback(any());
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java
index d804b6f..99dc895 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/DynamicPrivacyControllerTest.java
@@ -26,22 +26,17 @@
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
-import android.testing.TestableLooper.RunWithLooper;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
-import com.android.systemui.statusbar.NotificationViewHierarchyManager;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
-import com.android.systemui.statusbar.phone.UnlockMethodCache;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import dagger.Lazy;
-
@SmallTest
@org.junit.runner.RunWith(AndroidTestingRunner.class)
@@ -49,19 +44,17 @@
public class DynamicPrivacyControllerTest extends SysuiTestCase {
private DynamicPrivacyController mDynamicPrivacyController;
- private UnlockMethodCache mCache = mock(UnlockMethodCache.class);
private NotificationLockscreenUserManager mLockScreenUserManager
= mock(NotificationLockscreenUserManager.class);
private DynamicPrivacyController.Listener mListener
= mock(DynamicPrivacyController.Listener.class);
- private KeyguardMonitor mKeyguardMonitor = mock(KeyguardMonitor.class);
+ private KeyguardStateController mKeyguardStateController = mock(KeyguardStateController.class);
@Before
public void setUp() throws Exception {
- when(mCache.canSkipBouncer()).thenReturn(false);
- when(mKeyguardMonitor.isShowing()).thenReturn(true);
+ when(mKeyguardStateController.isShowing()).thenReturn(true);
mDynamicPrivacyController = new DynamicPrivacyController(
- mLockScreenUserManager, mKeyguardMonitor, mCache,
+ mLockScreenUserManager, mKeyguardStateController,
mock(StatusBarStateController.class));
mDynamicPrivacyController.setStatusBarKeyguardViewManager(
mock(StatusBarKeyguardViewManager.class));
@@ -71,7 +64,7 @@
@Test
public void testDynamicFalseWhenCannotSkipBouncer() {
enableDynamicPrivacy();
- when(mCache.canSkipBouncer()).thenReturn(false);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false);
Assert.assertFalse("can't skip bouncer but is dynamically unlocked",
mDynamicPrivacyController.isDynamicallyUnlocked());
}
@@ -79,16 +72,16 @@
@Test
public void testDynamicTrueWhenCanSkipBouncer() {
enableDynamicPrivacy();
- when(mCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
Assert.assertTrue("Isn't dynamically unlocked even though we can skip bouncer",
mDynamicPrivacyController.isDynamicallyUnlocked());
}
@Test
public void testNotifiedWhenEnabled() {
- when(mCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
enableDynamicPrivacy();
- mDynamicPrivacyController.onUnlockMethodStateChanged();
+ mDynamicPrivacyController.onUnlockedChanged();
verify(mListener).onDynamicPrivacyChanged();
}
@@ -99,10 +92,10 @@
@Test
public void testNotNotifiedWithoutNotifications() {
- when(mCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
when(mLockScreenUserManager.shouldHideNotifications(anyInt())).thenReturn(
true);
- mDynamicPrivacyController.onUnlockMethodStateChanged();
+ mDynamicPrivacyController.onUnlockedChanged();
verifyNoMoreInteractions(mListener);
}
}
\ No newline at end of file
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
index fd67611..ff9aae7 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
@@ -39,6 +39,7 @@
import com.android.systemui.SysuiTestCase;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.statusbar.NotificationMediaManager;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Before;
import org.junit.Test;
@@ -70,7 +71,7 @@
@Mock
private StatusBar mStatusBar;
@Mock
- private UnlockMethodCache mUnlockMethodCache;
+ private KeyguardStateController mKeyguardStateController;
@Mock
private Handler mHandler;
@Mock
@@ -82,7 +83,7 @@
MockitoAnnotations.initMocks(this);
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
- when(mUnlockMethodCache.isFaceAuthEnabled()).thenReturn(true);
+ when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true);
when(mKeyguardBypassController.onBiometricAuthenticated(any())).thenReturn(true);
when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true);
mContext.addMockSystemService(PowerManager.class, mPowerManager);
@@ -90,7 +91,7 @@
mDependency.injectTestDependency(StatusBarWindowController.class,
mStatusBarWindowController);
mBiometricUnlockController = new BiometricUnlockController(mContext, mDozeScrimController,
- mKeyguardViewMediator, mScrimController, mStatusBar, mUnlockMethodCache,
+ mKeyguardViewMediator, mScrimController, mStatusBar, mKeyguardStateController,
mHandler, mUpdateMonitor, 0 /* wakeUpDelay */, mKeyguardBypassController);
mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
index c51263f..3ba3e28 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java
@@ -52,6 +52,7 @@
import com.android.systemui.keyguard.DismissCallbackRegistry;
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
import com.android.systemui.plugins.FalsingManager;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Assert;
import org.junit.Before;
@@ -83,7 +84,7 @@
@Mock
private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@Mock
- private UnlockMethodCache mUnlockMethodCache;
+ private KeyguardStateController mKeyguardStateController;
@Mock
private KeyguardBypassController mKeyguardBypassController;
@Mock
@@ -102,7 +103,7 @@
when(mKeyguardHostView.getHeight()).thenReturn(500);
mBouncer = new KeyguardBouncer(getContext(), mViewMediatorCallback,
mLockPatternUtils, container, mDismissCallbackRegistry, mFalsingManager,
- mExpansionCallback, mUnlockMethodCache, mKeyguardUpdateMonitor,
+ mExpansionCallback, mKeyguardStateController, mKeyguardUpdateMonitor,
mKeyguardBypassController, mHandler) {
@Override
protected void inflateView() {
@@ -384,7 +385,7 @@
@Test
public void testShow_delaysIfFaceAuthIsRunning() {
- when(mUnlockMethodCache.isFaceAuthEnabled()).thenReturn(true);
+ when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true);
mBouncer.show(true /* reset */);
ArgumentCaptor<Runnable> showRunnable = ArgumentCaptor.forClass(Runnable.class);
@@ -397,7 +398,7 @@
@Test
public void testShow_delaysIfFaceAuthIsRunning_unlessBypass() {
- when(mUnlockMethodCache.isFaceAuthEnabled()).thenReturn(true);
+ when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true);
when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true);
mBouncer.show(true /* reset */);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
index 5d3cdc8..f1aaf3d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
@@ -48,7 +48,7 @@
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.ScrimView;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.wakelock.WakeLock;
import com.android.systemui.utils.os.FakeHandler;
@@ -103,7 +103,7 @@
mScrimInFrontColor = scrimInFrontColor;
},
visible -> mScrimVisibility = visible, mDozeParamenters, mAlarmManager,
- mock(KeyguardMonitor.class));
+ mock(KeyguardStateController.class));
mScrimController.setHasBackdrop(false);
mScrimController.setWallpaperSupportsAmbientMode(false);
mScrimController.transitionTo(ScrimState.KEYGUARD);
@@ -801,9 +801,9 @@
ScrimView scrimForBubble,
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
- AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
+ AlarmManager alarmManager, KeyguardStateController keyguardStateController) {
super(scrimBehind, scrimInFront, scrimForBubble, scrimStateListener,
- scrimVisibleListener, dozeParameters, alarmManager, keyguardMonitor);
+ scrimVisibleListener, dozeParameters, alarmManager, keyguardStateController);
}
@Override
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
index 3c445c8..c3b25ce 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
@@ -46,6 +46,7 @@
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Before;
import org.junit.Test;
@@ -65,6 +66,8 @@
@Mock
private KeyguardBouncer mBouncer;
@Mock
+ private KeyguardStateController mKeyguardStateController;
+ @Mock
private StatusBar mStatusBar;
@Mock
private ViewGroup mContainer;
@@ -90,6 +93,7 @@
mDependency.injectMockDependency(StatusBarWindowController.class);
mDependency.injectMockDependency(KeyguardUpdateMonitor.class);
mDependency.injectTestDependency(StatusBarStateController.class, mStatusBarStateController);
+ mDependency.injectTestDependency(KeyguardStateController.class, mKeyguardStateController);
when(mLockIconContainer.getParent()).thenReturn(mock(ViewGroup.class));
when(mLockIconContainer.animate()).thenReturn(mock(ViewPropertyAnimator.class,
RETURNS_DEEP_STUBS));
@@ -169,7 +173,7 @@
@Test
public void onPanelExpansionChanged_showsBouncerWhenSwiping() {
- when(mStatusBar.isKeyguardCurrentlySecure()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false);
mStatusBarKeyguardViewManager.onPanelExpansionChanged(0.5f /* expansion */,
true /* tracking */);
verify(mBouncer).show(eq(false), eq(false));
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
index 5a6f27d..266abcf 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java
@@ -71,7 +71,7 @@
import com.android.systemui.statusbar.notification.collection.NotificationData;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Before;
import org.junit.Test;
@@ -104,7 +104,7 @@
@Mock
private ShadeController mShadeController;
@Mock
- private KeyguardMonitor mKeyguardMonitor;
+ private KeyguardStateController mKeyguardStateController;
@Mock
private Handler mHandler;
@Mock
@@ -167,7 +167,8 @@
mock(StatusBarStateController.class), mock(KeyguardManager.class),
mock(IDreamManager.class), mRemoteInputManager,
mock(StatusBarRemoteInputCallback.class), mock(NotificationGroupManager.class),
- mock(NotificationLockscreenUserManager.class), mShadeController, mKeyguardMonitor,
+ mock(NotificationLockscreenUserManager.class), mShadeController,
+ mKeyguardStateController,
mock(NotificationInterruptionStateProvider.class), mock(MetricsLogger.class),
mock(LockPatternUtils.class), mHandler, mHandler, mActivityIntentHelper,
mBubbleController);
@@ -200,7 +201,7 @@
sbn.getNotification().contentIntent = mContentIntent;
sbn.getNotification().flags |= Notification.FLAG_AUTO_CANCEL;
- when(mKeyguardMonitor.isShowing()).thenReturn(true);
+ when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mShadeController.isOccluded()).thenReturn(true);
// When
@@ -263,7 +264,7 @@
// Given
sbn.getNotification().contentIntent = null;
- when(mKeyguardMonitor.isShowing()).thenReturn(true);
+ when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mShadeController.isOccluded()).thenReturn(true);
// When
@@ -293,7 +294,7 @@
// Given
sbn.getNotification().contentIntent = mContentIntent;
- when(mKeyguardMonitor.isShowing()).thenReturn(true);
+ when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mShadeController.isOccluded()).thenReturn(true);
// When
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
index 4eb9a31..3be71c0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
@@ -110,7 +110,7 @@
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import org.junit.Before;
@@ -131,7 +131,7 @@
@RunWithLooper
public class StatusBarTest extends SysuiTestCase {
@Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
- @Mock private UnlockMethodCache mUnlockMethodCache;
+ @Mock private KeyguardStateController mKeyguardStateController;
@Mock private KeyguardIndicationController mKeyguardIndicationController;
@Mock private NotificationStackScrollLayout mStackScroller;
@Mock private HeadsUpManagerPhone mHeadsUpManager;
@@ -191,7 +191,6 @@
mViewHierarchyManager);
mDependency.injectTestDependency(VisualStabilityManager.class, mVisualStabilityManager);
mDependency.injectTestDependency(NotificationListener.class, mNotificationListener);
- mDependency.injectTestDependency(KeyguardMonitor.class, mock(KeyguardMonitor.class));
mDependency.injectTestDependency(AppOpsController.class, mock(AppOpsController.class));
mDependency.injectTestDependency(StatusBarStateController.class, mStatusBarStateController);
mDependency.injectTestDependency(DeviceProvisionedController.class,
@@ -253,7 +252,7 @@
mHeadsUpManager, mHeadsUpSuppressor);
when(mRemoteInputManager.getController()).thenReturn(mRemoteInputController);
- mStatusBar = new TestableStatusBar(mStatusBarKeyguardViewManager, mUnlockMethodCache,
+ mStatusBar = new TestableStatusBar(mStatusBarKeyguardViewManager,
mKeyguardIndicationController, mStackScroller,
mPowerManager, mNotificationPanelView, mBarService, mNotificationListener,
mNotificationLogger, mVisualStabilityManager, mViewHierarchyManager,
@@ -270,6 +269,7 @@
SystemUIFactory.getInstance().getRootComponent()
.getStatusBarInjector()
.createStatusBar(mStatusBar);
+ mStatusBar.mKeyguardStateController = mKeyguardStateController;
mStatusBar.setHeadsUpManager(mHeadsUpManager);
mStatusBar.putComponent(StatusBar.class, mStatusBar);
Dependency.get(InitController.class).executePostInitTasks();
@@ -313,11 +313,11 @@
public void lockscreenStateMetrics_notShowing() {
// uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
- when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
- when(mUnlockMethodCache.isMethodSecure()).thenReturn(false);
+ when(mKeyguardStateController.isMethodSecure()).thenReturn(false);
mStatusBar.onKeyguardViewManagerStatesUpdated();
MetricsAsserts.assertHasLog("missing hidden insecure lockscreen log",
@@ -331,11 +331,11 @@
public void lockscreenStateMetrics_notShowing_secure() {
// uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
- when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
- when(mUnlockMethodCache.isMethodSecure()).thenReturn(true);
+ when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
mStatusBar.onKeyguardViewManagerStatesUpdated();
@@ -350,11 +350,11 @@
public void lockscreenStateMetrics_isShowing() {
// uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
- when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
- when(mUnlockMethodCache.isMethodSecure()).thenReturn(false);
+ when(mKeyguardStateController.isMethodSecure()).thenReturn(false);
mStatusBar.onKeyguardViewManagerStatesUpdated();
@@ -369,11 +369,11 @@
public void lockscreenStateMetrics_isShowing_secure() {
// uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
- when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
- when(mUnlockMethodCache.isMethodSecure()).thenReturn(true);
+ when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
mStatusBar.onKeyguardViewManagerStatesUpdated();
@@ -388,11 +388,11 @@
public void lockscreenStateMetrics_isShowingBouncer() {
// uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
- when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true);
+ when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true);
- when(mUnlockMethodCache.isMethodSecure()).thenReturn(true);
+ when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
mStatusBar.onKeyguardViewManagerStatesUpdated();
@@ -776,7 +776,7 @@
static class TestableStatusBar extends StatusBar {
public TestableStatusBar(StatusBarKeyguardViewManager man,
- UnlockMethodCache unlock, KeyguardIndicationController key,
+ KeyguardIndicationController key,
NotificationStackScrollLayout stack,
PowerManager pm, NotificationPanelView panelView,
IStatusBarService barService, NotificationListener notificationListener,
@@ -803,7 +803,6 @@
KeyguardUpdateMonitor keyguardUpdateMonitor,
StatusBarWindowView statusBarWindow) {
mStatusBarKeyguardViewManager = man;
- mUnlockMethodCache = unlock;
mKeyguardIndicationController = key;
mStackScroller = stack;
mPowerManager = pm;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardStateController.java
similarity index 65%
rename from packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java
rename to packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardStateController.java
index 2fb0e0e7..26cac29 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardStateController.java
@@ -1,28 +1,30 @@
/*
* Copyright (C) 2016 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
+ * 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.
+ * 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.systemui.utils.leaks;
import android.testing.LeakCheck;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
-public class FakeKeyguardMonitor implements KeyguardMonitor {
+public class FakeKeyguardStateController implements KeyguardStateController {
private final BaseLeakChecker<Callback> mCallbackController;
- public FakeKeyguardMonitor(LeakCheck test) {
+ public FakeKeyguardStateController(LeakCheck test) {
mCallbackController = new BaseLeakChecker<Callback>(test, "keyguard");
}
@@ -37,7 +39,7 @@
}
@Override
- public boolean isSecure() {
+ public boolean isMethodSecure() {
return false;
}
@@ -47,11 +49,21 @@
}
@Override
+ public boolean canDismissLockScreen() {
+ return false;
+ }
+
+ @Override
public boolean isOccluded() {
return false;
}
@Override
+ public boolean isTrusted() {
+ return false;
+ }
+
+ @Override
public boolean isKeyguardFadingAway() {
return false;
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java
index f479126..fedc08d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java
@@ -14,8 +14,6 @@
package com.android.systemui.utils.leaks;
-import static org.mockito.Matchers.any;
-
import android.testing.LeakCheck;
import android.util.ArrayMap;
@@ -29,7 +27,7 @@
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.FlashlightController;
import com.android.systemui.statusbar.policy.HotspotController;
-import com.android.systemui.statusbar.policy.KeyguardMonitor;
+import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.NextAlarmController;
@@ -60,7 +58,7 @@
HotspotController.class,
FlashlightController.class,
UserInfoController.class,
- KeyguardMonitor.class,
+ KeyguardStateController.class,
BatteryController.class,
SecurityController.class,
ManagedProfileController.class,
@@ -118,8 +116,8 @@
obj = new FakeFlashlightController(this);
} else if (cls == UserInfoController.class) {
obj = new FakeUserInfoController(this);
- } else if (cls == KeyguardMonitor.class) {
- obj = new FakeKeyguardMonitor(this);
+ } else if (cls == KeyguardStateController.class) {
+ obj = new FakeKeyguardStateController(this);
} else if (cls == BatteryController.class) {
obj = new FakeBatteryController(this);
} else if (cls == SecurityController.class) {