Merge "Fix The pop-up security lock will disappear after rotate" into tm-qpr-dev
This commit is contained in:
@@ -129,6 +129,8 @@ public class AuthContainerView extends LinearLayout
|
|||||||
private final Set<Integer> mFailedModalities = new HashSet<Integer>();
|
private final Set<Integer> mFailedModalities = new HashSet<Integer>();
|
||||||
|
|
||||||
private final @Background DelayableExecutor mBackgroundExecutor;
|
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.
|
// 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;
|
@Nullable @AuthDialogCallback.DismissedReason private Integer mPendingCallbackReason;
|
||||||
@@ -441,6 +443,12 @@ public class AuthContainerView extends LinearLayout
|
|||||||
public void onWindowFocusChanged(boolean hasWindowFocus) {
|
public void onWindowFocusChanged(boolean hasWindowFocus) {
|
||||||
super.onWindowFocusChanged(hasWindowFocus);
|
super.onWindowFocusChanged(hasWindowFocus);
|
||||||
if (!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");
|
Log.v(TAG, "Lost window focus, dismissing the dialog");
|
||||||
animateAway(AuthDialogCallback.DISMISSED_USER_CANCELED);
|
animateAway(AuthDialogCallback.DISMISSED_USER_CANCELED);
|
||||||
}
|
}
|
||||||
@@ -450,6 +458,9 @@ public class AuthContainerView extends LinearLayout
|
|||||||
public void onAttachedToWindow() {
|
public void onAttachedToWindow() {
|
||||||
super.onAttachedToWindow();
|
super.onAttachedToWindow();
|
||||||
|
|
||||||
|
//save the first orientation
|
||||||
|
mOrientation = getResources().getConfiguration().orientation;
|
||||||
|
|
||||||
mWakefulnessLifecycle.addObserver(this);
|
mWakefulnessLifecycle.addObserver(this);
|
||||||
|
|
||||||
if (Utils.isBiometricAllowed(mConfig.mPromptInfo)) {
|
if (Utils.isBiometricAllowed(mConfig.mPromptInfo)) {
|
||||||
@@ -621,6 +632,12 @@ public class AuthContainerView extends LinearLayout
|
|||||||
if (mBiometricView != null) {
|
if (mBiometricView != null) {
|
||||||
mBiometricView.restoreState(savedState);
|
mBiometricView.restoreState(savedState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (savedState != null) {
|
||||||
|
mSkipFirstLostFocus = savedState.getBoolean(
|
||||||
|
AuthDialog.KEY_BIOMETRIC_ORIENTATION_CHANGED);
|
||||||
|
}
|
||||||
|
|
||||||
wm.addView(this, getLayoutParams(mWindowToken, mConfig.mPromptInfo.getTitle()));
|
wm.addView(this, getLayoutParams(mWindowToken, mConfig.mPromptInfo.getTitle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,6 +694,10 @@ public class AuthContainerView extends LinearLayout
|
|||||||
mBiometricView != null && mCredentialView == null);
|
mBiometricView != null && mCredentialView == null);
|
||||||
outState.putBoolean(AuthDialog.KEY_CREDENTIAL_SHOWING, 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) {
|
if (mBiometricView != null) {
|
||||||
mBiometricView.onSaveState(outState);
|
mBiometricView.onSaveState(outState);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public interface AuthDialog extends Dumpable {
|
|||||||
String KEY_BIOMETRIC_SENSOR_TYPE = "sensor_type";
|
String KEY_BIOMETRIC_SENSOR_TYPE = "sensor_type";
|
||||||
String KEY_BIOMETRIC_SENSOR_PROPS = "sensor_props";
|
String KEY_BIOMETRIC_SENSOR_PROPS = "sensor_props";
|
||||||
|
|
||||||
|
String KEY_BIOMETRIC_ORIENTATION_CHANGED = "orientation_changed";
|
||||||
|
|
||||||
int SIZE_UNKNOWN = 0;
|
int SIZE_UNKNOWN = 0;
|
||||||
/**
|
/**
|
||||||
* Minimal UI, showing only biometric icon.
|
* Minimal UI, showing only biometric icon.
|
||||||
|
|||||||
Reference in New Issue
Block a user