From ff7c7a4f6760ed42dc81d9dbf02caeb133ab24aa Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 28 Jan 2022 22:15:43 +0000 Subject: [PATCH] Updating active-unlock APIs Exposing active unlock APIs, not much more. Simplifies approval and tracking process later. go/android-active-unlock-t-api Test: None Bug: 213631677 Bug: 213631675 CTS-Coverage-Bug: 213944235 Change-Id: I613a400991b0ea1895dcebb6fb01a4c13beb9c0a --- core/api/system-current.txt | 4 ++++ .../service/trust/TrustAgentService.java | 20 +++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index c7be8d3c48d75..4395ac6b61319 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -11522,6 +11522,7 @@ package android.service.trust { method @Deprecated public final void grantTrust(CharSequence, long, boolean); method public final void grantTrust(CharSequence, long, int); method public final void isEscrowTokenActive(long, android.os.UserHandle); + method public final void lockUser(); method public final android.os.IBinder onBind(android.content.Intent); method public boolean onConfigure(java.util.List); method public void onDeviceLocked(); @@ -11532,13 +11533,16 @@ package android.service.trust { method public void onEscrowTokenStateReceived(long, int); method public void onTrustTimeout(); method public void onUnlockAttempt(boolean); + method public void onUserRequestedUnlock(); method public final void removeEscrowToken(long, android.os.UserHandle); method public final void revokeTrust(); method public final void setManagingTrust(boolean); method public final void showKeyguardErrorMessage(@NonNull CharSequence); method public final void unlockUserWithToken(long, byte[], android.os.UserHandle); field public static final int FLAG_GRANT_TRUST_DISMISS_KEYGUARD = 2; // 0x2 + field public static final int FLAG_GRANT_TRUST_DISPLAY_MESSAGE = 8; // 0x8 field public static final int FLAG_GRANT_TRUST_INITIATED_BY_USER = 1; // 0x1 + field public static final int FLAG_GRANT_TRUST_TEMPORARY_AND_RENEWABLE = 4; // 0x4 field public static final String SERVICE_INTERFACE = "android.service.trust.TrustAgentService"; field public static final int TOKEN_STATE_ACTIVE = 1; // 0x1 field public static final int TOKEN_STATE_INACTIVE = 0; // 0x0 diff --git a/core/java/android/service/trust/TrustAgentService.java b/core/java/android/service/trust/TrustAgentService.java index fba61cfd801ec..8b9c109fe522d 100644 --- a/core/java/android/service/trust/TrustAgentService.java +++ b/core/java/android/service/trust/TrustAgentService.java @@ -119,16 +119,15 @@ public class TrustAgentService extends Service { * automatically remove trust after some conditions are met (detailed below) with the option for * the agent to renew the trust again later. * - *

After this is called, the agent will grant trust until the platform thinks an active user - * is no longer using that trust. For example, if the user dismisses keyguard, the platform will - * remove trust (this does not automatically lock the device). + *

After this is called, the agent will grant trust until the platform thinks an active + * user is no longer using that trust. This can happen for any reason as determined by the + * platform. For example, if the user dismisses keyguard, the platform will remove trust; + * since this does not automatically lock the device, this results in the device locking the + * next time the screen turns off. * *

When the platform internally removes the agent's trust in this manner, an agent can * re-grant it (via a call to grantTrust) without the user having to unlock the device through * another method (e.g. PIN). This renewable state only persists for a limited time. - * - * TODO(b/213631675): Remove @hide - * @hide */ public static final int FLAG_GRANT_TRUST_TEMPORARY_AND_RENEWABLE = 1 << 2; @@ -139,9 +138,6 @@ public class TrustAgentService extends Service { * Without this flag, the message passed to {@code grantTrust} is only used for debugging * purposes. With the flag, it may be displayed to the user as the reason why the device is * unlocked. - * - * TODO(b/213911325): Remove @hide - * @hide */ public static final int FLAG_GRANT_TRUST_DISPLAY_MESSAGE = 1 << 3; @@ -309,9 +305,6 @@ public class TrustAgentService extends Service { * {@link #grantTrust(CharSequence, long, int)}. * * @see #FLAG_GRANT_TRUST_TEMPORARY_AND_RENEWABLE - * - * TODO(b/213631672): Add CTS tests - * @hide */ public void onUserRequestedUnlock() { } @@ -624,9 +617,6 @@ public class TrustAgentService extends Service { * * If the user has no auth method specified, then keyguard will still be shown but can be * dismissed normally. - * - * TODO(b/213631675): Implement & make public - * @hide */ public final void lockUser() { }