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

Commit 030060a3 authored by Steven Ng's avatar Steven Ng Committed by Android (Google) Code Review
Browse files

Merge "Add a Global setting for disabling OEM unlocking setting" into nyc-mr1-dev

parents 03f26d39 3fe14031
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1014,7 +1014,9 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
            flashLockState = mOemUnlockManager.getFlashLockState();
        }

        return flashLockState != PersistentDataBlockManager.FLASH_LOCK_UNLOCKED;
        return flashLockState != PersistentDataBlockManager.FLASH_LOCK_UNLOCKED
                && Settings.Global.getInt(getActivity().getContentResolver(),
                        Settings.Global.OEM_UNLOCK_DISALLOWED, 0) == 0;
    }

    private void updateOemUnlockOptions() {
+7 −3
Original line number Diff line number Diff line
@@ -759,9 +759,13 @@ public final class Utils extends com.android.settingslib.Utils {
     * devices allow users to flash other OSes to them.
     */
    static void setOemUnlockEnabled(Context context, boolean enabled) {
        try {
            PersistentDataBlockManager manager = (PersistentDataBlockManager)
                    context.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
            manager.setOemUnlockEnabled(enabled);
        } catch (SecurityException e) {
            Log.e(TAG, "Fail to set oem unlock.", e);
        }
    }

    /**