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

Commit 1f75e638 authored by Scott Mertz's avatar Scott Mertz Committed by Steve Kondik
Browse files

MountService: support UMS on any volume

Change-Id: I2597d96909e3f458dfa722884c6d8ee79e8c6733
parent c4b16ea4
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -1505,6 +1505,16 @@ class MountService extends IMountService.Stub
        return null;
    }

    private boolean hasUmsVolume() {
        final StorageVolume[] storageVolumes = getVolumeList();
        for(StorageVolume volume : storageVolumes) {
            if (volume.allowMassStorage()) {
                return true;
            }
        }
        return false;
    }

    /**
     * Constructs a new MountService instance
     *
@@ -1532,11 +1542,7 @@ class MountService extends IMountService.Stub
        userFilter.addAction(Intent.ACTION_USER_REMOVED);
        mContext.registerReceiver(mUserReceiver, userFilter, null, mHandler);

        // Watch for USB changes on primary volume
        final StorageVolume primary = getPrimaryPhysicalVolume();
        if ((primary != null && primary.allowMassStorage()) ||
            //ignore primary config, force to register if property is true
            SystemProperties.getBoolean("persist.sys.ums", true)) {
        if (hasUmsVolume() || SystemProperties.getBoolean("persist.sys.ums", true)) {
            mContext.registerReceiver(
                    mUsbReceiver, new IntentFilter(UsbManager.ACTION_USB_STATE), null, mHandler);
        }