Merge "Don't show udfps disabled tap target after auth" into sc-dev am: 4ac678f289

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13619578

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I89b6c20344c1f6ae4c39bd32e63fba4a05d780f1
This commit is contained in:
Beverly Tai
2021-02-22 20:56:13 +00:00
committed by Automerger Merge Worker
2 changed files with 45 additions and 15 deletions

View File

@@ -20,6 +20,7 @@ import static android.hardware.biometrics.BiometricSourceType.FINGERPRINT;
import android.hardware.biometrics.BiometricSourceType;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
@@ -73,13 +74,15 @@ public class DisabledUdfpsController extends ViewController<DisabledUdfpsView> i
@Override
protected void onViewAttached() {
mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback);
mIsBouncerShowing = mKeyguardViewController.isBouncerShowing();
mStatusBarStateController.addCallback(mStatusBarStateListener);
mIsKeyguardShowing = mStatusBarStateController.getState() == StatusBarState.KEYGUARD;
mIsDozing = mStatusBarStateController.isDozing();
mRunningFPS = mKeyguardUpdateMonitor.isFingerprintDetectionRunning();
mAuthenticated = false;
updateButtonVisibility();
mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback);
mStatusBarStateController.addCallback(mStatusBarStateListener);
}
@Override
@@ -88,6 +91,15 @@ public class DisabledUdfpsController extends ViewController<DisabledUdfpsView> i
mStatusBarStateController.removeCallback(mStatusBarStateListener);
}
/**
* Call when this controller is no longer needed. This will remove the view from its parent.
*/
public void destroy() {
if (mView != null && mView.getParent() != null) {
((ViewGroup) mView.getParent()).removeView(mView);
}
}
private void updateButtonVisibility() {
mShowButton = !mAuthenticated && !mIsDozing && mIsKeyguardShowing
&& !mIsBouncerShowing && !mRunningFPS;
@@ -143,6 +155,14 @@ public class DisabledUdfpsController extends ViewController<DisabledUdfpsView> i
public void onBiometricRunningStateChanged(boolean running,
BiometricSourceType biometricSourceType) {
mRunningFPS = running && biometricSourceType == FINGERPRINT;
mAuthenticated &= !mRunningFPS;
updateButtonVisibility();
}
@Override
public void onBiometricAuthenticated(int userId,
BiometricSourceType biometricSourceType, boolean isStrongBiometric) {
mAuthenticated = true;
updateButtonVisibility();
}

View File

@@ -281,18 +281,8 @@ public class NotificationPanelViewController extends PanelViewController {
@Override
public void onKeyguardVisibilityChanged(boolean showing) {
if (mDisabledUdfpsController == null
&& mAuthController.getUdfpsRegion() != null
&& mAuthController.isUdfpsEnrolled(
KeyguardUpdateMonitor.getCurrentUser())) {
mLayoutInflater.inflate(R.layout.disabled_udfps_view, mView);
mDisabledUdfpsController = new DisabledUdfpsController(
mView.findViewById(R.id.disabled_udfps_view),
mStatusBarStateController,
mUpdateMonitor,
mAuthController,
mStatusBarKeyguardViewManager);
mDisabledUdfpsController.init();
if (showing) {
updateDisabledUdfpsController();
}
}
};
@@ -3561,6 +3551,25 @@ public class NotificationPanelViewController extends PanelViewController {
}
}
private void updateDisabledUdfpsController() {
final boolean udfpsEnrolled = mAuthController.getUdfpsRegion() != null
&& mAuthController.isUdfpsEnrolled(
KeyguardUpdateMonitor.getCurrentUser());
if (mDisabledUdfpsController == null && udfpsEnrolled) {
mLayoutInflater.inflate(R.layout.disabled_udfps_view, mView);
mDisabledUdfpsController = new DisabledUdfpsController(
mView.findViewById(R.id.disabled_udfps_view),
mStatusBarStateController,
mUpdateMonitor,
mAuthController,
mStatusBarKeyguardViewManager);
mDisabledUdfpsController.init();
} else if (mDisabledUdfpsController != null && !udfpsEnrolled) {
mDisabledUdfpsController.destroy();
mDisabledUdfpsController = null;
}
}
private class OnHeightChangedListener implements ExpandableView.OnHeightChangedListener {
@Override
public void onHeightChanged(ExpandableView view, boolean needsAnimation) {
@@ -3980,6 +3989,7 @@ public class NotificationPanelViewController extends PanelViewController {
FragmentHostManager.get(mView).addTagListener(QS.TAG, mFragmentListener);
mStatusBarStateController.addCallback(mStatusBarStateListener);
mConfigurationController.addCallback(mConfigurationListener);
updateDisabledUdfpsController();
mUpdateMonitor.registerCallback(mKeyguardUpdateCallback);
// Theme might have changed between inflating this view and attaching it to the
// window, so