Merge "Add removeAltInterceptor method" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c9f3868e61
@@ -108,6 +108,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
mStatusBarStateController.addCallback(mStateListener);
|
||||
|
||||
mUdfpsRequested = false;
|
||||
|
||||
mStatusBarState = mStatusBarStateController.getState();
|
||||
mQsExpanded = mKeyguardViewManager.isQsExpanded();
|
||||
mInputBouncerHiddenAmount = KeyguardBouncer.EXPANSION_HIDDEN;
|
||||
@@ -125,7 +126,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
mFaceDetectRunning = false;
|
||||
|
||||
mStatusBarStateController.removeCallback(mStateListener);
|
||||
mKeyguardViewManager.setAlternateAuthInterceptor(null);
|
||||
mKeyguardViewManager.removeAlternateAuthInterceptor(mAlternateAuthInterceptor);
|
||||
mTransitioningFromHome = false;
|
||||
mKeyguardUpdateMonitor.requestFaceAuthOnOccludingApp(false);
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import android.view.ViewGroup;
|
||||
import android.view.ViewRootImpl;
|
||||
import android.view.WindowManagerGlobal;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
@@ -63,6 +64,7 @@ import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -268,10 +270,23 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
registerListeners();
|
||||
}
|
||||
|
||||
public void setAlternateAuthInterceptor(@Nullable AlternateAuthInterceptor authInterceptor) {
|
||||
final boolean newlyNull = authInterceptor == null && mAlternateAuthInterceptor != null;
|
||||
/**
|
||||
* Sets the given alt auth interceptor to null if it's the current auth interceptor. Else,
|
||||
* does nothing.
|
||||
*/
|
||||
public void removeAlternateAuthInterceptor(@NonNull AlternateAuthInterceptor authInterceptor) {
|
||||
if (Objects.equals(mAlternateAuthInterceptor, authInterceptor)) {
|
||||
mAlternateAuthInterceptor = null;
|
||||
resetAlternateAuth(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new alt auth interceptor.
|
||||
*/
|
||||
public void setAlternateAuthInterceptor(@NonNull AlternateAuthInterceptor authInterceptor) {
|
||||
mAlternateAuthInterceptor = authInterceptor;
|
||||
resetAlternateAuth(newlyNull);
|
||||
resetAlternateAuth(false);
|
||||
}
|
||||
|
||||
private void registerListeners() {
|
||||
|
||||
@@ -254,15 +254,15 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testOnDetachedStateReset() {
|
||||
// GIVEN view is attached, alt auth is force being shown
|
||||
// GIVEN view is attached
|
||||
mController.onViewAttached();
|
||||
captureStatusBarStateListeners();
|
||||
captureAltAuthInterceptor();
|
||||
|
||||
// WHEN view is detached
|
||||
mController.onViewDetached();
|
||||
|
||||
// THEN set alternate auth interceptor to null
|
||||
verify(mStatusBarKeyguardViewManager).setAlternateAuthInterceptor(null);
|
||||
// THEN remove alternate auth interceptor
|
||||
verify(mStatusBarKeyguardViewManager).removeAlternateAuthInterceptor(mAltAuthInterceptor);
|
||||
}
|
||||
|
||||
private void sendStatusBarStateChanged(int statusBarState) {
|
||||
|
||||
Reference in New Issue
Block a user