summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vincent Wang <firewall@google.com> 2022-08-31 04:13:02 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-08-31 04:13:02 +0000
commitd7027f52df5b70ae555a7a3abbf65605b072e4ab (patch)
treecebe1adbc266f1df30a71076ebcbe4b41bc20354
parent0d7db317c21f709884b703e0deab7a6294a2f167 (diff)
parentaebeb9f611013903f516e6cc608c045d58d4c148 (diff)
Merge "Fix The pop-up security lock will disappear after rotate" into tm-qpr-dev am: f2b50de574 am: aebeb9f611
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19711753 Change-Id: I7bb9f5185967f642c536a16761b88595295e35ca Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/AuthDialog.java2
2 files changed, 23 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
index 84e1c3d4c8f0..86837366e0b7 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
@@ -129,6 +129,8 @@ public class AuthContainerView extends LinearLayout
private final Set<Integer> mFailedModalities = new HashSet<Integer>();
private final @Background DelayableExecutor mBackgroundExecutor;
+ private int mOrientation;
+ private boolean mSkipFirstLostFocus = false;
// Non-null only if the dialog is in the act of dismissing and has not sent the reason yet.
@Nullable @AuthDialogCallback.DismissedReason private Integer mPendingCallbackReason;
@@ -441,6 +443,12 @@ public class AuthContainerView extends LinearLayout
public void onWindowFocusChanged(boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
if (!hasWindowFocus) {
+ //it's a workaround to avoid closing BP incorrectly
+ //BP gets a onWindowFocusChanged(false) and then gets a onWindowFocusChanged(true)
+ if (mSkipFirstLostFocus) {
+ mSkipFirstLostFocus = false;
+ return;
+ }
Log.v(TAG, "Lost window focus, dismissing the dialog");
animateAway(AuthDialogCallback.DISMISSED_USER_CANCELED);
}
@@ -450,6 +458,9 @@ public class AuthContainerView extends LinearLayout
public void onAttachedToWindow() {
super.onAttachedToWindow();
+ //save the first orientation
+ mOrientation = getResources().getConfiguration().orientation;
+
mWakefulnessLifecycle.addObserver(this);
if (Utils.isBiometricAllowed(mConfig.mPromptInfo)) {
@@ -621,6 +632,12 @@ public class AuthContainerView extends LinearLayout
if (mBiometricView != null) {
mBiometricView.restoreState(savedState);
}
+
+ if (savedState != null) {
+ mSkipFirstLostFocus = savedState.getBoolean(
+ AuthDialog.KEY_BIOMETRIC_ORIENTATION_CHANGED);
+ }
+
wm.addView(this, getLayoutParams(mWindowToken, mConfig.mPromptInfo.getTitle()));
}
@@ -677,6 +694,10 @@ public class AuthContainerView extends LinearLayout
mBiometricView != null && mCredentialView == null);
outState.putBoolean(AuthDialog.KEY_CREDENTIAL_SHOWING, mCredentialView != null);
+ if (mOrientation != getResources().getConfiguration().orientation) {
+ outState.putBoolean(AuthDialog.KEY_BIOMETRIC_ORIENTATION_CHANGED, true);
+ }
+
if (mBiometricView != null) {
mBiometricView.onSaveState(outState);
}
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialog.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialog.java
index 51f39b358659..cd0fc3737594 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialog.java
@@ -48,6 +48,8 @@ public interface AuthDialog extends Dumpable {
String KEY_BIOMETRIC_SENSOR_TYPE = "sensor_type";
String KEY_BIOMETRIC_SENSOR_PROPS = "sensor_props";
+ String KEY_BIOMETRIC_ORIENTATION_CHANGED = "orientation_changed";
+
int SIZE_UNKNOWN = 0;
/**
* Minimal UI, showing only biometric icon.