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

Commit 514c5804 authored by Guang Zhu's avatar Guang Zhu
Browse files

do not allow monkey to flip OEM unlock flag

Bug: 11435021
Change-Id: I3a6865bc6c9fde245d8f4af3230716eac4a3f1b1
parent ce8a52f9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server;

import android.Manifest;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Binder;
@@ -26,7 +27,9 @@ import android.os.SystemProperties;
import android.os.UserHandle;
import android.service.persistentdata.IPersistentDataBlockService;
import android.util.Slog;

import com.android.internal.R;

import libcore.io.IoUtils;

import java.io.DataInputStream;
@@ -241,6 +244,10 @@ public class PersistentDataBlockService extends SystemService {

        @Override
        public void setOemUnlockEnabled(boolean enabled) {
            // do not allow monkey to flip the flag
            if (ActivityManager.isUserAMonkey()) {
                return;
            }
            enforceOemUnlockPermission();
            FileOutputStream outputStream;
            try {