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

Commit 4e9ce287 authored by padarshr's avatar padarshr
Browse files

Update Volume state for Unmounting Phase.

This change will update the state of volume
to "unmounting" when the volume is in Umounting Phase
It will prevent apps from getting wrong state when state
of volume is queried on receiving MEDIA_EJECT broadcast.

CRs-Fixed: 642047

Change-Id: Idce0569e076c9d64f2022e86ad995bc5428e2fbc
parent 40ee06d7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -679,6 +679,14 @@ public class Environment {
     */
    public static final String MEDIA_UNMOUNTABLE = "unmountable";

    /**
     * Storage state if the media is present and in unmounting state.
     *
     * @see #getStorageState(File)
     * @hide
     */
    public static final String MEDIA_UNMOUNTING = "unmounting";

    /**
     * Returns the current state of the primary "external" storage device.
     * 
+1 −0
Original line number Diff line number Diff line
@@ -951,6 +951,7 @@ class MountService extends IMountService.Stub
            action = Intent.ACTION_MEDIA_MOUNTED;
        } else if (newState == VolumeState.Unmounting) {
            action = Intent.ACTION_MEDIA_EJECT;
            updatePublicVolumeState(volume, Environment.MEDIA_UNMOUNTING);
        } else if (newState == VolumeState.Formatting) {
        } else if (newState == VolumeState.Shared) {
            if (DEBUG_EVENTS) Slog.i(TAG, "Updating volume state media mounted");