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

Commit 3e825feb authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix bug #17976062 Stability: ISE in Settings: Fragment ApnSettings{4da9ae0}...

Fix bug #17976062 Stability: ISE in Settings: Fragment ApnSettings{4da9ae0} not attached to Activity

- prevent IllegalStateException

Change-Id: I63fa1bb6240c7ff82c04be938b72940049409dee
parent 178db4d5
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.settings;

import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
@@ -171,8 +172,6 @@ public class ApnSettings extends SettingsPreferenceFragment implements

        if (!mRestoreDefaultApnMode) {
            fillList();
        } else {
            showDialog(DIALOG_RESTORE_DEFAULTAPN);
        }
    }

@@ -348,12 +347,17 @@ public class ApnSettings extends SettingsPreferenceFragment implements
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case EVENT_RESTORE_DEFAULTAPN_COMPLETE:
                    Activity activity = getActivity();
                    if (activity == null) {
                        mRestoreDefaultApnMode = false;
                        return;
                    }
                    fillList();
                    getPreferenceScreen().setEnabled(true);
                    mRestoreDefaultApnMode = false;
                    removeDialog(DIALOG_RESTORE_DEFAULTAPN);
                    Toast.makeText(
                        getActivity(),
                        activity,
                        getResources().getString(
                                R.string.restore_default_apn_completed),
                        Toast.LENGTH_LONG).show();