Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1b4b7fc authored by SongFerngWang's avatar SongFerngWang
Browse files

Avoid the exception when UI shows the fragment

Bug: 290145058
Test: build pass.
Change-Id: Ic8d084cc98c3d0094d816e43fed57fb10446462d
parent 997ef1e5
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -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