diff --git a/src/com/android/settings/development/OemUnlockPreferenceController.java b/src/com/android/settings/development/OemUnlockPreferenceController.java index 3053defac86..8149d07f59c 100644 --- a/src/com/android/settings/development/OemUnlockPreferenceController.java +++ b/src/com/android/settings/development/OemUnlockPreferenceController.java @@ -236,7 +236,13 @@ public class OemUnlockPreferenceController extends DeveloperOptionsPreferenceCon @VisibleForTesting boolean isOemUnlockedAllowed() { - return mOemLockManager.isOemUnlockAllowed(); + try { + return mOemLockManager.isOemUnlockAllowed(); + } catch (SecurityException e) { + // This exception is thrown if the device is not allowed to check (or change) the OEM + // unlock setting because Factory Reset Protection is active. + Log.e(TAG, "Failed to check OEM unlock allowed", e); + return false; + } } - } diff --git a/tests/Enable16KbTests/test_16kb_app/src/com/android/settings/development/test/Enable16KbDeviceTest.java b/tests/Enable16KbTests/test_16kb_app/src/com/android/settings/development/test/Enable16KbDeviceTest.java index b84a99f2c33..79aaa164caa 100644 --- a/tests/Enable16KbTests/test_16kb_app/src/com/android/settings/development/test/Enable16KbDeviceTest.java +++ b/tests/Enable16KbTests/test_16kb_app/src/com/android/settings/development/test/Enable16KbDeviceTest.java @@ -41,7 +41,7 @@ import java.util.Locale; @RunWith(AndroidJUnit4.class) public class Enable16KbDeviceTest { - private static final long TIMEOUT = 2000; + private static final long TIMEOUT = 3000; private static final String ENABLE_16K_TOGGLE = "Boot with 16 KB page size"; private static final String BUILD_NUMBER = "Build number";