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

Commit c2293328 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Skip user restriction tests when synchronizing PDB"

parents ea4e107a 1a5b76c9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -26,4 +26,7 @@ public interface PersistentDataBlockManagerInternal {

    /** Retrieves handle to a lockscreen credential to be used for Factory Reset Protection. */
    byte[] getFrpCredentialHandle();

    /** Update the OEM unlock enabled bit, bypassing user restriction checks. */
    void forceOemUnlockEnabled(boolean enabled);
}
+8 −0
Original line number Diff line number Diff line
@@ -668,5 +668,13 @@ public class PersistentDataBlockService extends SystemService {
                IoUtils.closeQuietly(inputStream);
            }
        }

        @Override
        public void forceOemUnlockEnabled(boolean enabled) {
            synchronized (mLock) {
                doSetOemUnlockEnabledLocked(enabled);
                computeAndWriteDigestLocked();
            }
        }
    };
}
+5 −6
Original line number Diff line number Diff line
@@ -31,10 +31,10 @@ import android.os.UserManager;
import android.os.UserManagerInternal;
import android.os.UserManagerInternal.UserRestrictionsListener;
import android.service.oemlock.IOemLockService;
import android.service.persistentdata.PersistentDataBlockManager;
import android.util.Slog;

import com.android.server.LocalServices;
import com.android.server.PersistentDataBlockManagerInternal;
import com.android.server.SystemService;
import com.android.server.pm.UserRestrictionsUtils;

@@ -217,13 +217,12 @@ public class OemLockService extends SystemService {
     * is used to erase FRP information on a unlockable device.
     */
    private void setPersistentDataBlockOemUnlockAllowedBit(boolean allowed) {
        final PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
                mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
        final PersistentDataBlockManagerInternal pdbmi
                = LocalServices.getService(PersistentDataBlockManagerInternal.class);
        // if mOemLock is PersistentDataBlockLock, then the bit should have already been set
        if (pdbm != null && !(mOemLock instanceof PersistentDataBlockLock)
                && pdbm.getOemUnlockEnabled() != allowed) {
        if (pdbmi != null && !(mOemLock instanceof PersistentDataBlockLock)) {
            Slog.i(TAG, "Update OEM Unlock bit in pst partition to " + allowed);
            pdbm.setOemUnlockEnabled(allowed);
            pdbmi.forceOemUnlockEnabled(allowed);
        }
    }