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

Commit 5e0e3a3d authored by Dave McCloskey's avatar Dave McCloskey Committed by Android (Google) Code Review
Browse files

Merge "Add call to TrustManager for SystemUI to propagate unlock requests to a trust agent."

parents 3f9c90b8 997c684a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.hardware.biometrics.BiometricSourceType;
 */
interface ITrustManager {
    void reportUnlockAttempt(boolean successful, int userId);
    void reportUserRequestedUnlock(int userId);
    void reportUnlockLockout(int timeoutMs, int userId);
    void reportEnabledTrustAgentsChanged(int userId);
    void registerTrustListener(in ITrustListener trustListener);
+13 −0
Original line number Diff line number Diff line
@@ -84,6 +84,19 @@ public class TrustManager {
        }
    }

    /**
     * Reports that the user {@code userId} is likely interested in unlocking the device.
     *
     * Requires the {@link android.Manifest.permission#ACCESS_KEYGUARD_SECURE_STORAGE} permission.
     */
    public void reportUserRequestedUnlock(int userId) {
        try {
            mService.reportUserRequestedUnlock(userId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Reports that user {@param userId} has entered a temporary device lockout.
     *
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.service.trust.ITrustAgentServiceCallback;
 */
interface ITrustAgentService {
    oneway void onUnlockAttempt(boolean successful);
    oneway void onUserRequestedUnlock();
    oneway void onUnlockLockout(int timeoutMs);
    oneway void onTrustTimeout();
    oneway void onDeviceLocked();
+10 −1
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ public class TrustAgentService extends Service {
    private static final int MSG_ESCROW_TOKEN_ADDED = 7;
    private static final int MSG_ESCROW_TOKEN_STATE_RECEIVED = 8;
    private static final int MSG_ESCROW_TOKEN_REMOVED = 9;
    private static final int MSG_USER_REQUESTED_UNLOCK = 10;

    private static final String EXTRA_TOKEN = "token";
    private static final String EXTRA_TOKEN_HANDLE = "token_handle";
@@ -219,6 +220,9 @@ public class TrustAgentService extends Service {
                case MSG_UNLOCK_ATTEMPT:
                    onUnlockAttempt(msg.arg1 != 0);
                    break;
                case MSG_USER_REQUESTED_UNLOCK:
                    onUserRequestedUnlock();
                    break;
                case MSG_UNLOCK_LOCKOUT:
                    onDeviceUnlockLockout(msg.arg1);
                    break;
@@ -306,7 +310,7 @@ public class TrustAgentService extends Service {
     *
     * @see #FLAG_GRANT_TRUST_TEMPORARY_AND_RENEWABLE
     *
     * TODO(b/213631672): Hook up call from system server & SystemUI, then un-hide
     * TODO(b/213631672): Add CTS tests
     * @hide
     */
    public void onUserRequestedUnlock() {
@@ -664,6 +668,11 @@ public class TrustAgentService extends Service {
            mHandler.obtainMessage(MSG_UNLOCK_ATTEMPT, successful ? 1 : 0, 0).sendToTarget();
        }

        @Override
        public void onUserRequestedUnlock() {
            mHandler.obtainMessage(MSG_USER_REQUESTED_UNLOCK).sendToTarget();
        }

        @Override
        public void onUnlockLockout(int timeoutMs) {
            mHandler.obtainMessage(MSG_UNLOCK_LOCKOUT, timeoutMs, 0).sendToTarget();
+13 −0
Original line number Diff line number Diff line
@@ -460,6 +460,19 @@ public class TrustAgentWrapper {
        }
    }

    /**
     * @see android.service.trust.TrustAgentService#onUserRequestedUnlock()
     */
    public void onUserRequestedUnlock() {
        try {
            if (mTrustAgentService != null) {
                mTrustAgentService.onUserRequestedUnlock();
            }
        } catch (RemoteException e) {
            onError(e);
        }
    }

    /**
     * @see android.service.trust.TrustAgentService#onUnlockLockout(int)
     */
Loading