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

Commit 87bc6e15 authored by padarshr's avatar padarshr Committed by Linux Build Service Account
Browse files

Auto-Share SdCard on PC on insertion if ums was ON when it was removed

This change will share the sdcard to PC on insertion, if the state
of sd card was SHARED when it was physically removed.

Change-Id: Ie118f8539d011f968ec26ebd4dfebd0499af0239
parent f93e1c9b
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -947,12 +947,14 @@ class MountService extends IMountService.Stub
            }

            if (code == VoldResponseCode.VolumeDiskInserted) {
                if(!(isUsbMassStorageConnected() && volume.allowMassStorage()))
                    new Thread("MountService#VolumeDiskInserted") {
                        @Override
                        public void run() {
                            try {
                                int rc;
                            if ((rc = doMountVolume(path)) != StorageResultCode.OperationSucceeded) {
                                if ((rc = doMountVolume(path)) !=
                                        StorageResultCode.OperationSucceeded) {
                                    Slog.w(TAG, String.format("Insertion mount failed (%d)", rc));
                                }
                            } catch (Exception ex) {
@@ -1033,6 +1035,8 @@ class MountService extends IMountService.Stub
                updatePublicVolumeState(volume, Environment.MEDIA_UNMOUNTED);
                action = Intent.ACTION_MEDIA_UNMOUNTED;
            }
            if(isUsbMassStorageConnected() && volume.allowMassStorage())
                doShareUnshareVolume(path, "ums", true);
        } else if (newState == VolumeState.Pending) {
        } else if (newState == VolumeState.Checking) {
            if (DEBUG_EVENTS) Slog.i(TAG, "updating volume state checking");