DO NOT MERGE Fix of crash when error messages are triggered

Issue is caused by call FragmentTransaction.commit after
activity saved it's state, then IllegalStateException will be thrown
and Settings will crash.

Bug: 216492911
Test: Manual. First boot up the device and follow the wizard till the
  point when register the fingerprint. While adding the fingerprint,
  short press the power button and turn off the screen.

Change-Id: I96244fc26d2aa8639538f967d645a6ca4fc7c0ba
Merged-In: I1de23885a9b80fabdc199ad09c35c3f98e86c831
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintErrorDialog.java b/src/com/android/settings/biometrics/fingerprint/FingerprintErrorDialog.java
index fa92951..00c14ca 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintErrorDialog.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintErrorDialog.java
@@ -34,7 +34,7 @@
         final CharSequence errMsg = host.getText(getErrorMessage(errMsgId));
         final FingerprintErrorDialog dialog = newInstance(errMsg, errMsgId);
         final FragmentManager fragmentManager = host.getSupportFragmentManager();
-        if (!fragmentManager.isDestroyed()) {
+        if (!fragmentManager.isDestroyed()  && !fragmentManager.isStateSaved()) {
             dialog.show(fragmentManager, FingerprintErrorDialog.class.getName());
         }
     }