Merge "Avoid the exception when UI shows the fragment" into udc-qpr-dev am: a94cfc7b76 am: a4cac90c1d

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/24098950

Change-Id: I8e970d59c04041f980d52861d229d2b0261d0ed3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
SongFerng Wang
2023-07-20 16:52:27 +00:00
committed by Automerger Merge Worker

View File

@@ -280,8 +280,20 @@ public class SimDialogActivity extends FragmentActivity {
public void showEnableAutoDataSwitchDialog() {
final FragmentManager fragmentManager = getSupportFragmentManager();
SimDialogFragment fragment = createFragment(ENABLE_AUTO_DATA_SWITCH);
fragment.show(fragmentManager, Integer.toString(ENABLE_AUTO_DATA_SWITCH));
if (fragmentManager.isStateSaved()) {
Log.w(TAG, "Failed to show EnableAutoDataSwitchDialog. The fragmentManager "
+ "is StateSaved.");
forceClose();
return;
}
try {
fragment.show(fragmentManager, Integer.toString(ENABLE_AUTO_DATA_SWITCH));
} catch (Exception e) {
Log.e(TAG, "Failed to show EnableAutoDataSwitchDialog.", e);
forceClose();
return;
}
if (getResources().getBoolean(
R.bool.config_auto_data_switch_enables_cross_sim_calling)) {
// If auto data switch is already enabled on the non-DDS, the dialog for enabling it