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

Commit 4d4142b6 authored by Daniel Nishi's avatar Daniel Nishi
Browse files

Fix a bug where Settings would crash from search into storage.

If the user entered the StorageDashboardFragment from search,
it would crash due to a precondition check added to the Storage
Manager. Because no volume id was set in the bundle for it to
check, it hits an assert that the volume id is not null causing
Settings to crash.

This sets a sensible default instead of null.

Bug: 34633464
Test: Manual. Entering through search does not crash now.
Change-Id: Ia6cd82929a0813eefcdad279436b9c2fe30b0146
parent d9d463be
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -21,9 +21,6 @@ import android.os.Bundle;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.provider.SearchIndexableResource;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
@@ -62,7 +59,8 @@ public class StorageDashboardFragment extends DashboardFragment {

        // Initialize the storage sizes that we can quickly calc.
        StorageManager sm = context.getSystemService(StorageManager.class);
        String volumeId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
        String volumeId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID,
                VolumeInfo.ID_PRIVATE_INTERNAL);
        mVolume = sm.findVolumeById(volumeId);
        if (!isVolumeValid()) {
            getActivity().finish();