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

Commit 31a7b2a4 authored by Daniel Nishi's avatar Daniel Nishi Committed by Gerrit Code Review
Browse files

Merge "Fix PrivateVolumeSettings be launched repeatedly"

parents 16db22a9 b699603f
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -93,6 +93,8 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
    private StorageSummaryPreference mInternalSummary;
    private static long sTotalInternalStorage;

    private boolean mHasLaunchedPrivateVolumeSettings = false;

    @Override
    public int getMetricsCategory() {
        return MetricsEvent.DEVICEINFO_STORAGE;
@@ -110,7 +112,6 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
        final Context context = getActivity();

        mStorageManager = context.getSystemService(StorageManager.class);
        mStorageManager.registerListener(mStorageListener);

        if (sTotalInternalStorage <= 0) {
            sTotalInternalStorage = mStorageManager.getPrimaryStorageSize();
@@ -231,6 +232,8 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
        if (mInternalCategory.getPreferenceCount() == 2
                && mExternalCategory.getPreferenceCount() == 0) {
            // Only showing primary internal storage, so just shortcut
            if (!mHasLaunchedPrivateVolumeSettings) {
                mHasLaunchedPrivateVolumeSettings = true;
                final Bundle args = new Bundle();
                args.putString(VolumeInfo.EXTRA_VOLUME_ID, VolumeInfo.ID_PRIVATE_INTERNAL);
                Intent intent = Utils.onBuildStartFragmentIntent(getActivity(),
@@ -241,6 +244,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
                finish();
            }
        }
    }

    @Override
    public void onResume() {