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

Commit bdb28595 authored by Raj Yengisetty's avatar Raj Yengisetty Committed by Rajesh Yengisetty
Browse files

CMFileManager: Don't show unmounted volumes in PickerActivity

Change-Id: I628077e6132ffb4aa9f561484630e1f29b1188a5
(cherry picked from commit f3839092)
parent 342d12ed
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.storage.StorageVolume;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
@@ -600,11 +601,24 @@ public class PickerActivity extends Activity
        if (volumes != null) {
            int cc = volumes.length;
            for (int i = 0; i < cc; i++) {
                StorageVolume volume = volumes[i];
                if (volumes[i] != null) {
                    String mountedState = volumes[i].getState();
                    String path = volumes[i].getPath();
                    if (!Environment.MEDIA_MOUNTED.equalsIgnoreCase(mountedState) &&
                            !Environment.MEDIA_MOUNTED_READ_ONLY.equalsIgnoreCase(mountedState)) {
                        Log.w(TAG, "Ignoring '" + path + "' with state of '"+ mountedState + "'");
                        continue;
                    }
                    if (!TextUtils.isEmpty(path)) {
                        String desc = StorageHelper.getStorageVolumeDescription(this, volumes[i]);
                        CheckableItem item = new CheckableItem(desc, false, false);
                        descriptions.add(item);
                    }
                }
            }

        }
        CheckableListAdapter adapter =
                new CheckableListAdapter(getApplicationContext(), descriptions);