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

Commit 8f78a534 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "Allow USB notification to show when primary SD allows UMS and MTP" into jellybean

parents 20b174da 920e25a1
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -182,8 +182,10 @@ public class UsbDeviceManager {
        mNotificationManager = (NotificationManager)
                mContext.getSystemService(Context.NOTIFICATION_SERVICE);

        // We do not show the USB notification if the primary volume supports mass storage.
        // The legacy mass storage UI will be used instead.
        // We do not show the USB notification if the primary volume supports mass storage, unless
        // persist.sys.usb.config is set to mtp,adb. This will allow the USB notification to show
        // on devices with mtp as default and mass storage enabled on primary, so the user can choose
        // between mtp, ptp, and mass storage. The legacy mass storage UI will be used otherwise.
        boolean massStorageSupported = false;
        StorageManager storageManager = (StorageManager)
                mContext.getSystemService(Context.STORAGE_SERVICE);
@@ -197,7 +199,11 @@ public class UsbDeviceManager {
            }
        }

        if ("mtp,adb".equals(SystemProperties.get("persist.sys.usb.config"))) {
            mUseUsbNotification = true;
        } else {
            mUseUsbNotification = !massStorageSupported;
        }

        // make sure the ADB_ENABLED setting value matches the current state
        Settings.Secure.putInt(mContentResolver, Settings.Secure.ADB_ENABLED, mAdbEnabled ? 1 : 0);