diff options
| author | 2023-01-12 19:39:15 +0000 | |
|---|---|---|
| committer | 2023-01-12 20:06:30 +0000 | |
| commit | 1e875ddba2907434d981c53dcff1aa1f702471b9 (patch) | |
| tree | 1805a7ca673ffea9d5c3280a80be903f875a443f | |
| parent | 59bce679c59c8b76fb1af11dd289604c18bff68b (diff) | |
Hide auth entry if there are no credentials retrieved from it
Test: Built & deployed locally
Bug: 265304287
Change-Id: Ie53f00320e7ff6f41d2ff826cb2258d5f70e567f
| -rw-r--r-- | services/credentials/java/com/android/server/credentials/ProviderGetSession.java | 13 | ||||
| -rw-r--r-- | services/credentials/java/com/android/server/credentials/ProviderSession.java | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/services/credentials/java/com/android/server/credentials/ProviderGetSession.java b/services/credentials/java/com/android/server/credentials/ProviderGetSession.java index de93af41671d..878f6318f89b 100644 --- a/services/credentials/java/com/android/server/credentials/ProviderGetSession.java +++ b/services/credentials/java/com/android/server/credentials/ProviderGetSession.java @@ -375,6 +375,11 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential private void onAuthenticationEntrySelected( @Nullable ProviderPendingIntentResponse providerPendingIntentResponse) { //TODO: Other provider intent statuses + if (providerPendingIntentResponse == null) { + Log.i(TAG, "providerPendingIntentResponse is null"); + onUpdateEmptyResponse(); + } + GetCredentialException exception = maybeGetPendingIntentException( providerPendingIntentResponse); if (exception != null) { @@ -393,7 +398,7 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential } Log.i(TAG, "No error or respond found in pending intent response"); - invokeCallbackOnInternalInvalidState(); + onUpdateEmptyResponse(); } private void onActionEntrySelected(ProviderPendingIntentResponse @@ -415,12 +420,16 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential } } + private void onUpdateEmptyResponse() { + updateStatusAndInvokeCallback(Status.NO_CREDENTIALS); + } + @Nullable private GetCredentialException maybeGetPendingIntentException( ProviderPendingIntentResponse pendingIntentResponse) { if (pendingIntentResponse == null) { Log.i(TAG, "pendingIntentResponse is null"); - return new GetCredentialException(GetCredentialException.TYPE_NO_CREDENTIAL); + return null; } if (PendingIntentResultHandler.isValidResponse(pendingIntentResponse)) { GetCredentialException exception = PendingIntentResultHandler diff --git a/services/credentials/java/com/android/server/credentials/ProviderSession.java b/services/credentials/java/com/android/server/credentials/ProviderSession.java index 7036dfb94163..678c752f8589 100644 --- a/services/credentials/java/com/android/server/credentials/ProviderSession.java +++ b/services/credentials/java/com/android/server/credentials/ProviderSession.java @@ -133,7 +133,7 @@ public abstract class ProviderSession<T, R> PENDING_INTENT_INVOKED, CREDENTIAL_RECEIVED_FROM_SELECTION, SAVE_ENTRIES_RECEIVED, CANCELED, - COMPLETE + NO_CREDENTIALS, COMPLETE } /** Converts exception to a provider session status. */ |