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

Commit 678fadf5 authored by Josh Stone's avatar Josh Stone
Browse files

MountService: Remount all volumes after USB disconnect



If USB was removed while UMS was enabled, the MountService was only
remounting the primary share.  Any other shares, like the HTC Inc's
emmc, were left in limbo.  This patch now iterates over *all* shared
volumes to remount after disconnect.

Change-Id: Ie6fd49ad80ba6fa0e4e194a386549cac786b4bbe
Signed-off-by: default avatarJosh Stone <cuviper@gmail.com>
parent 02332098
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -1011,17 +1011,20 @@ class MountService extends IMountService.Stub
            /*
             * USB mass storage disconnected while enabled
             */
            final ArrayList<String> volumes = getShareableVolumes();
            new Thread() {
                public void run() {
                    try {
                        int rc;
                        Slog.w(TAG, "Disabling UMS after cable disconnect");
                        for (String path: volumes) {
                            doShareUnshareVolume(path, "ums", false);
                            if ((rc = doMountVolume(path)) != StorageResultCode.OperationSucceeded) {
                                Slog.e(TAG, String.format(
                                        "Failed to remount {%s} on UMS enabled-disconnect (%d)",
                                                path, rc));
                            }
                        }
                    } catch (Exception ex) {
                        Slog.w(TAG, "Failed to mount media on UMS enabled-disconnect", ex);
                    }