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

Commit 7b58f100 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: Icf6c3d5396ea762aeb223869c380c5c3757d5652
Signed-off-by: default avatarJosh Stone <cuviper@gmail.com>
parent b4869cfc
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -856,17 +856,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);
                    }