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

Commit d9680161 authored by Andrew Scull's avatar Andrew Scull Committed by Android (Google) Code Review
Browse files

Merge "Complete OemLockService API."

parents 76642a6c 23a1a5f4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5179,6 +5179,7 @@ package android.service.notification {
package android.service.oemlock {

  public class OemLockManager {
    method public java.lang.String getLockName();
    method public boolean isOemUnlockAllowedByCarrier();
    method public boolean isOemUnlockAllowedByUser();
    method public void setOemUnlockAllowedByCarrier(boolean, byte[]);
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ package android.service.oemlock;
 * @hide
 */
interface IOemLockService {
    String getLockName();

    void setOemUnlockAllowedByCarrier(boolean allowed, in byte[] signature);
    boolean isOemUnlockAllowedByCarrier();

+17 −0
Original line number Diff line number Diff line
@@ -43,6 +43,23 @@ public class OemLockManager {
        mService = service;
    }

    /**
     * Returns a vendor specific name for the OEM lock.
     *
     * This value is used to identify the security protocol used by locks.
     *
     * @return The name of the OEM lock or {@code null} if failed to get the name.
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_CARRIER_OEM_UNLOCK_STATE)
    @Nullable
    public String getLockName() {
        try {
            return mService.getLockName();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Sets whether the carrier has allowed this device to be OEM unlocked.
     *
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ package com.android.server.oemlock;
import android.annotation.Nullable;

abstract class OemLock {
    @Nullable
    abstract String getLockName();

    abstract void setOemUnlockAllowedByCarrier(boolean allowed, @Nullable byte[] signature);
    abstract boolean isOemUnlockAllowedByCarrier();

+13 −0
Original line number Diff line number Diff line
@@ -112,6 +112,19 @@ public class OemLockService extends SystemService {
     * implementation being used on this device.
     */
    private final IBinder mService = new IOemLockService.Stub() {
        @Override
        @Nullable
        public String getLockName() {
            enforceManageCarrierOemUnlockPermission();

            final long token = Binder.clearCallingIdentity();
            try {
                return mOemLock.getLockName();
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }

        @Override
        public void setOemUnlockAllowedByCarrier(boolean allowed, @Nullable byte[] signature) {
            enforceManageCarrierOemUnlockPermission();
Loading