summaryrefslogtreecommitdiffstats
path: root/services/usb
diff options
context:
space:
mode:
authorGeoffrey Borggaard <geoffreyb@google.com>2014-11-19 14:22:56 -0500
committerGeoffrey Borggaard <geoffreyb@google.com>2014-11-19 14:26:08 -0500
commitba45b96a378623e3392da65e81e67dabdf4f0678 (patch)
tree65ec9871e51f27d0fd2c92a31b6d8580e113e6da /services/usb
parente9fddfd802f9d00dd2d86bd78e3da3cc2f530d3c (diff)
downloadframeworks_base-ba45b96a378623e3392da65e81e67dabdf4f0678.zip
frameworks_base-ba45b96a378623e3392da65e81e67dabdf4f0678.tar.gz
frameworks_base-ba45b96a378623e3392da65e81e67dabdf4f0678.tar.bz2
Setting ADB_ENABLED may result in a SecurityException.
If the restriction UserManager.DISALLOW_DEBUGGING_FEATURES is enforced, then any attempt to set ADB_ENABLED will result in a SecurityException. This can result in the device not being able to boot. Bug: 18433477 Change-Id: I21e4b406ad0fa89b7d4b678eac1baf212a3c7acd
Diffstat (limited to 'services/usb')
-rw-r--r--services/usb/java/com/android/server/usb/UsbDeviceManager.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index c63eb18..23ba3b6 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -209,8 +209,13 @@ public class UsbDeviceManager {
mUseUsbNotification = !massStorageSupported;
// make sure the ADB_ENABLED setting value matches the current state
- Settings.Global.putInt(mContentResolver, Settings.Global.ADB_ENABLED, mAdbEnabled ? 1 : 0);
-
+ try {
+ Settings.Global.putInt(mContentResolver,
+ Settings.Global.ADB_ENABLED, mAdbEnabled ? 1 : 0);
+ } catch (SecurityException e) {
+ // If UserManager.DISALLOW_DEBUGGING_FEATURES is on, that this setting can't be changed.
+ Slog.d(TAG, "ADB_ENABLED is restricted.");
+ }
mHandler.sendEmptyMessage(MSG_SYSTEM_READY);
}