Loading services/credentials/java/com/android/server/credentials/CreateRequestSession.java +4 −4 Original line number Diff line number Diff line Loading @@ -81,8 +81,9 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR mClientAppInfo.getPackageName()), providerDataList)); } catch (RemoteException e) { Log.i(TAG, "Issue with invoking pending intent: " + e.getMessage()); // TODO: Propagate failure respondToClientWithErrorAndFinish( CreateCredentialException.TYPE_UNKNOWN, "Unable to invoke selector"); } } Loading @@ -106,8 +107,7 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR @Override public void onUiCancellation() { // TODO("Replace with properly defined error type") respondToClientWithErrorAndFinish(CreateCredentialException.TYPE_NO_CREDENTIAL, respondToClientWithErrorAndFinish(CreateCredentialException.TYPE_USER_CANCELED, "User cancelled the selector"); } Loading services/credentials/java/com/android/server/credentials/GetRequestSession.java +3 −4 Original line number Diff line number Diff line Loading @@ -76,8 +76,8 @@ public final class GetRequestSession extends RequestSession<GetCredentialRequest mRequestId, mClientRequest, mClientAppInfo.getPackageName()), providerDataList)); } catch (RemoteException e) { Log.i(TAG, "Issue with invoking pending intent: " + e.getMessage()); // TODO: Propagate failure respondToClientWithErrorAndFinish( GetCredentialException.TYPE_UNKNOWN, "Unable to instantiate selector"); } } Loading Loading @@ -122,8 +122,7 @@ public final class GetRequestSession extends RequestSession<GetCredentialRequest @Override public void onUiCancellation() { // TODO("Replace with user cancelled error type when ready") respondToClientWithErrorAndFinish(GetCredentialException.TYPE_NO_CREDENTIAL, respondToClientWithErrorAndFinish(GetCredentialException.TYPE_USER_CANCELED, "User cancelled the selector"); } Loading services/credentials/java/com/android/server/credentials/PendingIntentResultHandler.java +6 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,12 @@ public class PendingIntentResultHandler { return pendingIntentResponse.getResultCode() == Activity.RESULT_OK; } /** Returns true if the pending intent was cancelled by the user. */ public static boolean isCancelledResponse( ProviderPendingIntentResponse pendingIntentResponse) { return pendingIntentResponse.getResultCode() == Activity.RESULT_CANCELED; } /** Extracts the {@link CredentialsResponseContent} object added to the result data. */ public static CredentialsResponseContent extractResponseContent(Intent resultData) { if (resultData == null) { Loading services/credentials/java/com/android/server/credentials/ProviderCreateSession.java +4 −5 Original line number Diff line number Diff line Loading @@ -263,9 +263,9 @@ public final class ProviderCreateSession extends ProviderSession< Log.i(TAG, "Pending intent contains provider exception"); return exception; } } else if (PendingIntentResultHandler.isCancelledResponse(pendingIntentResponse)) { return new CreateCredentialException(CreateCredentialException.TYPE_USER_CANCELED); } else { Log.i(TAG, "Pending intent result code not Activity.RESULT_OK"); // TODO("Update with unknown exception when ready") return new CreateCredentialException(CreateCredentialException.TYPE_NO_CREDENTIAL); } return null; Loading @@ -273,12 +273,11 @@ public final class ProviderCreateSession extends ProviderSession< /** * When an invalid state occurs, e.g. entry mismatch or no response from provider, * we send back a TYPE_NO_CREDENTIAL error as to the developer, it is the same as not * getting any credentials back. * we send back a TYPE_UNKNOWN error as to the developer. */ private void invokeCallbackOnInternalInvalidState() { mCallbacks.onFinalErrorReceived(mComponentName, CreateCredentialException.TYPE_NO_CREDENTIAL, CreateCredentialException.TYPE_UNKNOWN, null); } } services/credentials/java/com/android/server/credentials/ProviderGetSession.java +4 −5 Original line number Diff line number Diff line Loading @@ -429,8 +429,9 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential Log.i(TAG, "Pending intent contains provider exception"); return exception; } } else if (PendingIntentResultHandler.isCancelledResponse(pendingIntentResponse)) { return new GetCredentialException(GetCredentialException.TYPE_USER_CANCELED); } else { Log.i(TAG, "Pending intent result code not Activity.RESULT_OK"); return new GetCredentialException(GetCredentialException.TYPE_NO_CREDENTIAL); } return null; Loading @@ -438,12 +439,10 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential /** * When an invalid state occurs, e.g. entry mismatch or no response from provider, * we send back a TYPE_NO_CREDENTIAL error as to the developer, it is the same as not * getting any credentials back. * we send back a TYPE_UNKNOWN error as to the developer. */ private void invokeCallbackOnInternalInvalidState() { mCallbacks.onFinalErrorReceived(mComponentName, GetCredentialException.TYPE_NO_CREDENTIAL, null); GetCredentialException.TYPE_UNKNOWN, null); } } Loading
services/credentials/java/com/android/server/credentials/CreateRequestSession.java +4 −4 Original line number Diff line number Diff line Loading @@ -81,8 +81,9 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR mClientAppInfo.getPackageName()), providerDataList)); } catch (RemoteException e) { Log.i(TAG, "Issue with invoking pending intent: " + e.getMessage()); // TODO: Propagate failure respondToClientWithErrorAndFinish( CreateCredentialException.TYPE_UNKNOWN, "Unable to invoke selector"); } } Loading @@ -106,8 +107,7 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR @Override public void onUiCancellation() { // TODO("Replace with properly defined error type") respondToClientWithErrorAndFinish(CreateCredentialException.TYPE_NO_CREDENTIAL, respondToClientWithErrorAndFinish(CreateCredentialException.TYPE_USER_CANCELED, "User cancelled the selector"); } Loading
services/credentials/java/com/android/server/credentials/GetRequestSession.java +3 −4 Original line number Diff line number Diff line Loading @@ -76,8 +76,8 @@ public final class GetRequestSession extends RequestSession<GetCredentialRequest mRequestId, mClientRequest, mClientAppInfo.getPackageName()), providerDataList)); } catch (RemoteException e) { Log.i(TAG, "Issue with invoking pending intent: " + e.getMessage()); // TODO: Propagate failure respondToClientWithErrorAndFinish( GetCredentialException.TYPE_UNKNOWN, "Unable to instantiate selector"); } } Loading Loading @@ -122,8 +122,7 @@ public final class GetRequestSession extends RequestSession<GetCredentialRequest @Override public void onUiCancellation() { // TODO("Replace with user cancelled error type when ready") respondToClientWithErrorAndFinish(GetCredentialException.TYPE_NO_CREDENTIAL, respondToClientWithErrorAndFinish(GetCredentialException.TYPE_USER_CANCELED, "User cancelled the selector"); } Loading
services/credentials/java/com/android/server/credentials/PendingIntentResultHandler.java +6 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,12 @@ public class PendingIntentResultHandler { return pendingIntentResponse.getResultCode() == Activity.RESULT_OK; } /** Returns true if the pending intent was cancelled by the user. */ public static boolean isCancelledResponse( ProviderPendingIntentResponse pendingIntentResponse) { return pendingIntentResponse.getResultCode() == Activity.RESULT_CANCELED; } /** Extracts the {@link CredentialsResponseContent} object added to the result data. */ public static CredentialsResponseContent extractResponseContent(Intent resultData) { if (resultData == null) { Loading
services/credentials/java/com/android/server/credentials/ProviderCreateSession.java +4 −5 Original line number Diff line number Diff line Loading @@ -263,9 +263,9 @@ public final class ProviderCreateSession extends ProviderSession< Log.i(TAG, "Pending intent contains provider exception"); return exception; } } else if (PendingIntentResultHandler.isCancelledResponse(pendingIntentResponse)) { return new CreateCredentialException(CreateCredentialException.TYPE_USER_CANCELED); } else { Log.i(TAG, "Pending intent result code not Activity.RESULT_OK"); // TODO("Update with unknown exception when ready") return new CreateCredentialException(CreateCredentialException.TYPE_NO_CREDENTIAL); } return null; Loading @@ -273,12 +273,11 @@ public final class ProviderCreateSession extends ProviderSession< /** * When an invalid state occurs, e.g. entry mismatch or no response from provider, * we send back a TYPE_NO_CREDENTIAL error as to the developer, it is the same as not * getting any credentials back. * we send back a TYPE_UNKNOWN error as to the developer. */ private void invokeCallbackOnInternalInvalidState() { mCallbacks.onFinalErrorReceived(mComponentName, CreateCredentialException.TYPE_NO_CREDENTIAL, CreateCredentialException.TYPE_UNKNOWN, null); } }
services/credentials/java/com/android/server/credentials/ProviderGetSession.java +4 −5 Original line number Diff line number Diff line Loading @@ -429,8 +429,9 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential Log.i(TAG, "Pending intent contains provider exception"); return exception; } } else if (PendingIntentResultHandler.isCancelledResponse(pendingIntentResponse)) { return new GetCredentialException(GetCredentialException.TYPE_USER_CANCELED); } else { Log.i(TAG, "Pending intent result code not Activity.RESULT_OK"); return new GetCredentialException(GetCredentialException.TYPE_NO_CREDENTIAL); } return null; Loading @@ -438,12 +439,10 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential /** * When an invalid state occurs, e.g. entry mismatch or no response from provider, * we send back a TYPE_NO_CREDENTIAL error as to the developer, it is the same as not * getting any credentials back. * we send back a TYPE_UNKNOWN error as to the developer. */ private void invokeCallbackOnInternalInvalidState() { mCallbacks.onFinalErrorReceived(mComponentName, GetCredentialException.TYPE_NO_CREDENTIAL, null); GetCredentialException.TYPE_UNKNOWN, null); } }