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

Commit aee170f3 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "framework: Add a version of Environment.getExternalStorageState which...

Merge "framework: Add a version of Environment.getExternalStorageState which accepts a path parameter" into ics
parents bd6ab551 0fe4ba28
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -416,11 +416,18 @@ public class Environment {
     * <p>See {@link #getExternalStorageDirectory()} for more information.
     */
    public static String getExternalStorageState() {
        return getExternalStorageState(getExternalStorageDirectory().toString());
    }

    /**
     * Gets the current state of the specified "external" storage device.
     * @hide
     */
    public static String getExternalStorageState(String path) {
        try {
            IMountService mountService = IMountService.Stub.asInterface(ServiceManager
                    .getService("mount"));
            return mountService.getVolumeState(getExternalStorageDirectory()
                    .toString());
            return mountService.getVolumeState(path);
        } catch (Exception rex) {
            return Environment.MEDIA_REMOVED;
        }