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

Commit 65ecadc6 authored by Jason Monk's avatar Jason Monk Committed by Jason Monk
Browse files

Try not to crash while AppInfo is finishing

Bug: 21025020
Change-Id: Iebb9e6b24ca503f87b5648f0aaf02dde01903488
parent 5af3d6f5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -69,9 +69,12 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
    // Dialog identifiers used in showDialog
    protected static final int DLG_BASE = 0;

    protected boolean mFinishing;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mFinishing = false;

        mState = ApplicationsState.getInstance(getActivity().getApplication());
        mSession = mState.newSession(this);
@@ -147,6 +150,7 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment
        intent.putExtra(ManageApplications.APP_CHG, appChanged);
        SettingsActivity sa = (SettingsActivity)getActivity();
        sa.finishPreferencePanel(this, Activity.RESULT_OK, intent);
        mFinishing = true;
    }

    protected void showDialogInner(int id, int moveErrorCode) {
+7 −3
Original line number Diff line number Diff line
@@ -244,15 +244,16 @@ public class InstalledAppDetails extends AppInfoBase
    @Override
    public void onResume() {
        super.onResume();
        if (mFinishing) {
            return;
        }
        AppItem app = new AppItem(mAppEntry.info.uid);
        app.addUid(mAppEntry.info.uid);
        getLoaderManager().restartLoader(LOADER_CHART_DATA,
                ChartDataLoader.buildArgs(getTemplate(getContext()), app),
                mDataCallbacks);
        if (mPackageInfo != null) {
        new BatteryUpdater().execute();
    }
    }

    @Override
    public void onPause() {
@@ -269,6 +270,9 @@ public class InstalledAppDetails extends AppInfoBase

    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        if (mFinishing) {
            return;
        }
        handleHeader();

        mNotificationPreference = findPreference(KEY_NOTIFICATION);