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

Commit 1d36e06c authored by Simon Davie's avatar Simon Davie
Browse files

Disable UMS splash when phone in locked state

Currently devices which use UMS will display the UMS toggle screen
over the lockscreen. This would allow unauthorised users to access
the contents of the SD card, when plugged into USB, without first
unlocking the device.

Disable the UMS splash if the phone is in a locked state.

Change-Id: Ic18462758344c327e70e6a70d674f08d8ad51cb0
parent 5eee0838
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.usb;

import android.app.KeyguardManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -321,7 +322,11 @@ public class StorageNotification extends StorageEventListener {
                Settings.Secure.ADB_ENABLED,
                0);

            if (POP_UMS_ACTIVITY_ON_CONNECT && !adbOn) {
            KeyguardManager keyguardManager =
                    (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);

            if (POP_UMS_ACTIVITY_ON_CONNECT && !adbOn &&
                !keyguardManager.isKeyguardLocked() && !keyguardManager.isKeyguardSecure()) {
                // Pop up a full-screen alert to coach the user through enabling UMS. The average
                // user has attached the device to USB either to charge the phone (in which case
                // this is harmless) or transfer files, and in the latter case this alert saves