summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
diff options
context:
space:
mode:
authorDave Mankoff <mankoff@google.com>2020-09-14 12:20:41 -0400
committerDave Mankoff <mankoff@google.com>2020-09-16 16:27:56 -0400
commit4a3d8000168accd9bdc431ddd8599fdd299bbcaa (patch)
treef0851d4e160ce3cca5f1ff24d4b4fe220703c4af /packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
parent720c7c6eff34fd005f130f39f5ab8d63ba8b9ced (diff)
9/N Clean Up Keyguard Class Structure
KeyguardInputView no longer implements KeyguardSecurityView. This cl seeks to clean up some of the lingering vestiges from this large chain of refactors. I have manually tested none, swipe, pattern, pin, and password views for successfully unlocking, as well as multiple failed attempts resulting in temporary lock outs. Fixes: 166448040 Test: atest SystemUITests && manual Change-Id: I36275598001184e774677cf2dbb16dec8dc7ab5b
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java80
1 files changed, 18 insertions, 62 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
index 2c7dce6e4302..64676e55b038 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
@@ -50,9 +50,6 @@ import com.android.systemui.shared.system.SysUiStatsLog;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.ViewController;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.inject.Inject;
/** Controller for {@link KeyguardSecurityContainer} */
@@ -71,7 +68,6 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
private final UiEventLogger mUiEventLogger;
private final KeyguardStateController mKeyguardStateController;
private final KeyguardSecurityViewFlipperController mSecurityViewFlipperController;
- private final List<KeyguardInputViewController> mChildren = new ArrayList<>();
private SecurityCallback mSecurityCallback;
private SecurityMode mCurrentSecurityMode = SecurityMode.Invalid;
@@ -137,28 +133,6 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
}
};
- // The following is used to ignore callbacks from SecurityViews that are no longer current
- // (e.g. face unlock). This avoids unwanted asynchronous events from messing with the
- // state for the current security method.
- private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() {
- @Override
- public void userActivity() { }
- @Override
- public void reportUnlockAttempt(int userId, boolean success, int timeoutMs) { }
- @Override
- public boolean isVerifyUnlockOnly() {
- return false;
- }
- @Override
- public void dismiss(boolean securityVerified, int targetUserId) { }
- @Override
- public void dismiss(boolean authenticated, int targetId,
- boolean bypassSecondaryLockScreen) { }
- @Override
- public void onUserInput() { }
- @Override
- public void reset() {}
- };
private SwipeListener mSwipeListener = new SwipeListener() {
@Override
@@ -189,7 +163,6 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
mUiEventLogger = uiEventLogger;
mKeyguardStateController = keyguardStateController;
mSecurityViewFlipperController = securityViewFlipperController;
- view.setLockPatternUtils(mLockPatternUtils);
mAdminSecondaryLockScreenController = adminSecondaryLockScreenControllerFactory.create(
mKeyguardSecurityCallback);
}
@@ -213,7 +186,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
public void onPause() {
mAdminSecondaryLockScreenController.hide();
if (mCurrentSecurityMode != SecurityMode.None) {
- getSecurityView(mCurrentSecurityMode).onPause();
+ getCurrentSecurityController().onPause();
}
mView.onPause();
}
@@ -237,13 +210,13 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
if (reason != PROMPT_REASON_NONE) {
Log.i(TAG, "Strong auth required, reason: " + reason);
}
- getSecurityView(mCurrentSecurityMode).showPromptReason(reason);
+ getCurrentSecurityController().showPromptReason(reason);
}
}
public void showMessage(CharSequence message, ColorStateList colorState) {
if (mCurrentSecurityMode != SecurityMode.None) {
- getSecurityView(mCurrentSecurityMode).showMessage(message, colorState);
+ getCurrentSecurityController().showMessage(message, colorState);
}
}
@@ -267,7 +240,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
@Override
public void onResume(int reason) {
if (mCurrentSecurityMode != SecurityMode.None) {
- getSecurityView(mCurrentSecurityMode).onResume(reason);
+ getCurrentSecurityController().onResume(reason);
}
mView.onResume(
mSecurityModel.getSecurityMode(KeyguardUpdateMonitor.getCurrentUser()),
@@ -276,7 +249,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
public void startAppearAnimation() {
if (mCurrentSecurityMode != SecurityMode.None) {
- getSecurityView(mCurrentSecurityMode).startAppearAnimation();
+ getCurrentSecurityController().startAppearAnimation();
}
}
@@ -284,8 +257,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
mView.startDisappearAnimation(getCurrentSecurityMode());
if (mCurrentSecurityMode != SecurityMode.None) {
- return getSecurityView(mCurrentSecurityMode).startDisappearAnimation(
- onFinishRunnable);
+ return getCurrentSecurityController().startDisappearAnimation(onFinishRunnable);
}
return false;
@@ -293,7 +265,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
public void onStartingToHide() {
if (mCurrentSecurityMode != SecurityMode.None) {
- getSecurityView(mCurrentSecurityMode).onStartingToHide();
+ getCurrentSecurityController().onStartingToHide();
}
}
@@ -390,7 +362,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
}
public boolean needsInput() {
- return mSecurityViewFlipperController.needsInput();
+ return getCurrentSecurityController().needsInput();
}
/**
@@ -407,21 +379,19 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
return;
}
- KeyguardInputViewController oldView = getSecurityView(mCurrentSecurityMode);
- KeyguardInputViewController newView = getSecurityView(securityMode);
+ KeyguardInputViewController<KeyguardInputView> oldView = getCurrentSecurityController();
// Emulate Activity life cycle
if (oldView != null) {
oldView.onPause();
- oldView.setKeyguardCallback(mNullCallback); // ignore requests from old view
}
+
+ KeyguardInputViewController<KeyguardInputView> newView = changeSecurityMode(securityMode);
if (newView != null) {
newView.onResume(KeyguardSecurityView.VIEW_REVEALED);
- newView.setKeyguardCallback(mKeyguardSecurityCallback);
mSecurityViewFlipperController.show(newView);
}
- mCurrentSecurityMode = securityMode;
mSecurityCallback.onSecurityModeChanged(
securityMode, newView != null && newView.needsInput());
}
@@ -470,28 +440,14 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
}
}
- @Override
- public void setKeyguardCallback(KeyguardSecurityCallback callback) {
- // no-op. This should never be reset.
- }
-
- @Override
- public void setLockPatternUtils(LockPatternUtils utils) {
- // We already have one of these.
- }
-
- @Override
- public KeyguardSecurityCallback getCallback() {
- return mView.getCallback();
- }
-
- @Override
- public void showUsabilityHint() {
- mView.showUsabilityHint();
+ private KeyguardInputViewController<KeyguardInputView> getCurrentSecurityController() {
+ return mSecurityViewFlipperController
+ .getSecurityView(mCurrentSecurityMode, mKeyguardSecurityCallback);
}
- private KeyguardInputViewController getSecurityView(SecurityMode securityMode) {
- return mSecurityViewFlipperController
- .getSecurityView(securityMode, mKeyguardSecurityCallback);
+ private KeyguardInputViewController<KeyguardInputView> changeSecurityMode(
+ SecurityMode securityMode) {
+ mCurrentSecurityMode = securityMode;
+ return getCurrentSecurityController();
}
}