Fix BiometricDialog onConfigChange crash
BiometricDialog was crashing during orientation changes due to
incorrectly tracked window state.
Test: With BiometricPromptDemo, orientation changes work again
Test: Unplub USB, enable battery saver, start authentication,
plug in USB. Changes from dark theme to light theme
Test: BiometricDialog width is correct before/after rotation
Change-Id: Id6021f3defded1bfd71c008b4ebdab2e13f9f515
Fixes: 118835751
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java
index 903e178..67bc8b6 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricDialogImpl.java
@@ -66,7 +66,7 @@
public void handleMessage(Message msg) {
switch(msg.what) {
case MSG_SHOW_DIALOG:
- handleShowDialog((SomeArgs) msg.obj);
+ handleShowDialog((SomeArgs) msg.obj, false /* skipAnimation */);
break;
case MSG_BIOMETRIC_AUTHENTICATED:
handleBiometricAuthenticated();
@@ -178,7 +178,7 @@
mHandler.obtainMessage(MSG_HIDE_DIALOG, false /* userCanceled */).sendToTarget();
}
- private void handleShowDialog(SomeArgs args) {
+ private void handleShowDialog(SomeArgs args, boolean skipAnimation) {
mCurrentDialogArgs = args;
final int type = args.argi1;
mCurrentDialog = mDialogs.get(type);
@@ -195,6 +195,7 @@
mReceiver = (IBiometricPromptReceiver) args.arg2;
mCurrentDialog.setBundle((Bundle)args.arg1);
mCurrentDialog.setRequireConfirmation((boolean)args.arg3);
+ mCurrentDialog.setSkipIntro(skipAnimation);
mWindowManager.addView(mCurrentDialog, mCurrentDialog.getLayoutParams());
mDialogShowing = true;
}
@@ -278,15 +279,15 @@
@Override
protected void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ final boolean wasShowing = mDialogShowing;
if (mDialogShowing) {
mCurrentDialog.forceRemove();
+ mDialogShowing = false;
}
createDialogs();
- if (mDialogShowing) {
- mCurrentDialog = mDialogs.get(mCurrentDialogArgs.argi1);
- mCurrentDialog.forceRemove(); // Prevents intro animation when reattaching.
- mDialogShowing = false;
- handleShowDialog(mCurrentDialogArgs);
+ if (wasShowing) {
+ handleShowDialog(mCurrentDialogArgs, true /* skipAnimation */);
}
}
}