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

Commit ba45b96a authored by Geoffrey Borggaard's avatar Geoffrey Borggaard
Browse files

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
parent e9fddfd8
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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);
    }