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

Commit 4bfa55d4 authored by Clara Bayarri's avatar Clara Bayarri Committed by Android (Google) Code Review
Browse files

Merge "Protect TrustManager.setDeviceLockedForUser with permission"

parents 6dfcf14a 00a9b890
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@

package android.app.trust;

import android.Manifest;
import android.annotation.IntDef;
import android.annotation.RequiresPermission;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
@@ -54,9 +56,12 @@ public class TrustManager {
     * Changes the lock status for the given user. This is only applicable to Managed Profiles,
     * other users should be handled by Keyguard.
     *
     * Requires the {@link android.Manifest.permission#ACCESS_KEYGUARD_SECURE_STORAGE} permission.
     *
     * @param userId The id for the user to be locked/unlocked.
     * @param locked The value for that user's locked state.
     */
    @RequiresPermission(Manifest.permission.ACCESS_KEYGUARD_SECURE_STORAGE)
    public void setDeviceLockedForUser(int userId, boolean locked) {
        try {
            mService.setDeviceLockedForUser(userId, locked);
+1 −0
Original line number Diff line number Diff line
@@ -778,6 +778,7 @@ public class TrustManagerService extends SystemService {

        @Override
        public void setDeviceLockedForUser(int userId, boolean value) {
            enforceReportPermission();
            mHandler.obtainMessage(MSG_SET_DEVICE_LOCKED, value ? 1 : 0, userId)
                    .sendToTarget();
        }