summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/service/autofill/AutofillService.java5
-rw-r--r--core/java/android/service/autofill/IAutoFillService.aidl4
-rw-r--r--packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt6
-rw-r--r--services/autofill/java/com/android/server/autofill/RemoteFillService.java5
-rw-r--r--services/autofill/java/com/android/server/autofill/SecondaryProviderHandler.java5
-rw-r--r--services/autofill/java/com/android/server/autofill/Session.java51
6 files changed, 46 insertions, 30 deletions
diff --git a/core/java/android/service/autofill/AutofillService.java b/core/java/android/service/autofill/AutofillService.java
index e6a84df16c27..269839b61bef 100644
--- a/core/java/android/service/autofill/AutofillService.java
+++ b/core/java/android/service/autofill/AutofillService.java
@@ -37,7 +37,6 @@ import android.view.ViewStructure;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillValue;
-import android.view.autofill.IAutoFillManagerClient;
import com.android.internal.os.IResultReceiver;
@@ -642,7 +641,7 @@ public abstract class AutofillService extends Service {
@Override
public void onFillCredentialRequest(FillRequest request, IFillCallback callback,
- IAutoFillManagerClient autofillClientCallback) {
+ IBinder autofillClientCallback) {
ICancellationSignal transport = CancellationSignal.createTransport();
try {
callback.onCancellable(transport);
@@ -724,7 +723,7 @@ public abstract class AutofillService extends Service {
*/
public void onFillCredentialRequest(@NonNull FillRequest request,
@NonNull CancellationSignal cancellationSignal, @NonNull FillCallback callback,
- @NonNull IAutoFillManagerClient autofillClientCallback) {}
+ @NonNull IBinder autofillClientCallback) {}
/**
* Called by the Android system to convert a credential manager response to a dataset
diff --git a/core/java/android/service/autofill/IAutoFillService.aidl b/core/java/android/service/autofill/IAutoFillService.aidl
index 2c2feae7aeea..3b64b8a0ec5e 100644
--- a/core/java/android/service/autofill/IAutoFillService.aidl
+++ b/core/java/android/service/autofill/IAutoFillService.aidl
@@ -16,13 +16,13 @@
package android.service.autofill;
+import android.os.IBinder;
import android.service.autofill.ConvertCredentialRequest;
import android.service.autofill.IConvertCredentialCallback;
import android.service.autofill.FillRequest;
import android.service.autofill.IFillCallback;
import android.service.autofill.ISaveCallback;
import android.service.autofill.SaveRequest;
-import android.view.autofill.IAutoFillManagerClient;
import com.android.internal.os.IResultReceiver;
/**
@@ -34,7 +34,7 @@ oneway interface IAutoFillService {
void onConnectedStateChanged(boolean connected);
void onFillRequest(in FillRequest request, in IFillCallback callback);
void onFillCredentialRequest(in FillRequest request, in IFillCallback callback,
- in IAutoFillManagerClient client);
+ in IBinder client);
void onSaveRequest(in SaveRequest request, in ISaveCallback callback);
void onSavedPasswordCountRequest(in IResultReceiver receiver);
void onConvertCredentialRequest(in ConvertCredentialRequest convertCredentialRequest, in IConvertCredentialCallback convertCredentialCallback);
diff --git a/packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt b/packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt
index 4109079e20a5..50ebdd5e3ce7 100644
--- a/packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt
+++ b/packages/CredentialManager/src/com/android/credentialmanager/autofill/CredentialAutofillService.kt
@@ -47,9 +47,9 @@ import android.service.autofill.SaveRequest
import android.service.credentials.CredentialProviderService
import android.util.Log
import android.content.Intent
+import android.os.IBinder
import android.view.autofill.AutofillId
import android.view.autofill.AutofillManager
-import android.view.autofill.IAutoFillManagerClient
import android.widget.RemoteViews
import android.widget.inline.InlinePresentationSpec
import androidx.autofill.inline.v1.InlineSuggestionUi
@@ -95,7 +95,7 @@ class CredentialAutofillService : AutofillService() {
request: FillRequest,
cancellationSignal: CancellationSignal,
callback: FillCallback,
- autofillCallback: IAutoFillManagerClient
+ autofillCallback: IBinder
) {
val context = request.fillContexts
val structure = context[context.size - 1].structure
@@ -160,7 +160,7 @@ class CredentialAutofillService : AutofillService() {
CancellationSignal(),
Executors.newSingleThreadExecutor(),
outcome,
- autofillCallback.asBinder()
+ autofillCallback
)
}
diff --git a/services/autofill/java/com/android/server/autofill/RemoteFillService.java b/services/autofill/java/com/android/server/autofill/RemoteFillService.java
index c96688c1b9ae..7ceb3bb56403 100644
--- a/services/autofill/java/com/android/server/autofill/RemoteFillService.java
+++ b/services/autofill/java/com/android/server/autofill/RemoteFillService.java
@@ -28,6 +28,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Handler;
+import android.os.IBinder;
import android.os.ICancellationSignal;
import android.os.RemoteException;
import android.service.autofill.AutofillService;
@@ -42,7 +43,6 @@ import android.service.autofill.ISaveCallback;
import android.service.autofill.SaveRequest;
import android.text.format.DateUtils;
import android.util.Slog;
-import android.view.autofill.IAutoFillManagerClient;
import com.android.internal.infra.AbstractRemoteService;
import com.android.internal.infra.ServiceConnector;
@@ -283,8 +283,7 @@ final class RemoteFillService extends ServiceConnector.Impl<IAutoFillService> {
return callback;
}
- public void onFillCredentialRequest(@NonNull FillRequest request,
- IAutoFillManagerClient autofillCallback) {
+ public void onFillCredentialRequest(@NonNull FillRequest request, IBinder autofillCallback) {
if (sVerbose) {
Slog.v(TAG, "onFillRequest:" + request);
}
diff --git a/services/autofill/java/com/android/server/autofill/SecondaryProviderHandler.java b/services/autofill/java/com/android/server/autofill/SecondaryProviderHandler.java
index ce9d1803d764..044a06417c00 100644
--- a/services/autofill/java/com/android/server/autofill/SecondaryProviderHandler.java
+++ b/services/autofill/java/com/android/server/autofill/SecondaryProviderHandler.java
@@ -21,11 +21,11 @@ import android.annotation.Nullable;
import android.content.ComponentName;
import android.content.Context;
import android.content.IntentSender;
+import android.os.IBinder;
import android.service.autofill.ConvertCredentialResponse;
import android.service.autofill.FillRequest;
import android.service.autofill.FillResponse;
import android.util.Slog;
-import android.view.autofill.IAutoFillManagerClient;
/**
* Requests autofill response from a Remote Autofill Service. This autofill service can be
@@ -105,8 +105,7 @@ final class SecondaryProviderHandler implements RemoteFillService.FillServiceCal
/**
* Requests a new fill response.
*/
- public void onFillRequest(FillRequest pendingFillRequest, int flag,
- IAutoFillManagerClient client) {
+ public void onFillRequest(FillRequest pendingFillRequest, int flag, IBinder client) {
Slog.v(TAG, "Requesting fill response to secondary provider.");
mLastFlag = flag;
if (mRemoteFillService != null && mRemoteFillService.isCredentialAutofillService()) {
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index 3f3ff4a46edf..9393c625337e 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -757,13 +757,14 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
mPendingInlineSuggestionsRequest, id);
}
mSecondaryProviderHandler.onFillRequest(mPendingFillRequest,
- mPendingFillRequest.getFlags(), mClient);
+ mPendingFillRequest.getFlags(), mClient.asBinder());
} else if (mRemoteFillService != null) {
if (mIsPrimaryCredential) {
mPendingFillRequest = addCredentialManagerDataToClientState(
mPendingFillRequest,
mPendingInlineSuggestionsRequest, id);
- mRemoteFillService.onFillCredentialRequest(mPendingFillRequest, mClient);
+ mRemoteFillService.onFillCredentialRequest(mPendingFillRequest,
+ mClient.asBinder());
} else {
mRemoteFillService.onFillRequest(mPendingFillRequest);
}
@@ -2897,7 +2898,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
+ ", clientState=" + newClientState + ", authenticationId=" + authenticationId);
}
if (Flags.autofillCredmanDevIntegration() && exception != null
- && exception instanceof GetCredentialException) {
+ && !exception.getType().equals(GetCredentialException.TYPE_USER_CANCELED)) {
if (dataset != null && dataset.getFieldIds().size() == 1) {
if (sDebug) {
Slog.d(TAG, "setAuthenticationResultLocked(): result returns with"
@@ -6492,21 +6493,15 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
}
}
if (exception != null) {
- mClient.onGetCredentialException(id, viewId, exception.getType(),
- exception.getMessage());
+ if (viewId.isVirtualInt()) {
+ sendResponseToViewNode(viewId, /*response=*/ null, exception);
+ } else {
+ mClient.onGetCredentialException(id, viewId, exception.getType(),
+ exception.getMessage());
+ }
} else if (response != null) {
if (viewId.isVirtualInt()) {
- ViewNode viewNode = getViewNodeFromContextsLocked(viewId);
- if (viewNode != null && viewNode.getPendingCredentialCallback() != null) {
- Bundle resultData = new Bundle();
- resultData.putParcelable(
- CredentialProviderService.EXTRA_GET_CREDENTIAL_RESPONSE,
- response);
- viewNode.getPendingCredentialCallback().send(SUCCESS_CREDMAN_SELECTOR,
- resultData);
- } else {
- Slog.w(TAG, "View node not found after GetCredentialResponse");
- }
+ sendResponseToViewNode(viewId, response, /*exception=*/ null);
} else {
mClient.onGetCredentialResponse(id, viewId, response);
}
@@ -6520,6 +6515,30 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
}
}
+ @GuardedBy("mLock")
+ private void sendResponseToViewNode(AutofillId viewId, GetCredentialResponse response,
+ GetCredentialException exception) {
+ ViewNode viewNode = getViewNodeFromContextsLocked(viewId);
+ if (viewNode != null && viewNode.getPendingCredentialCallback() != null) {
+ Bundle resultData = new Bundle();
+ if (response != null) {
+ resultData.putParcelable(
+ CredentialProviderService.EXTRA_GET_CREDENTIAL_RESPONSE,
+ response);
+ viewNode.getPendingCredentialCallback().send(SUCCESS_CREDMAN_SELECTOR,
+ resultData);
+ } else if (exception != null) {
+ resultData.putStringArray(
+ CredentialProviderService.EXTRA_GET_CREDENTIAL_EXCEPTION,
+ new String[] {exception.getType(), exception.getMessage()});
+ viewNode.getPendingCredentialCallback().send(FAILURE_CREDMAN_SELECTOR,
+ resultData);
+ }
+ } else {
+ Slog.w(TAG, "View node not found after GetCredentialResponse");
+ }
+ }
+
void autoFillApp(Dataset dataset) {
synchronized (mLock) {
if (mDestroyed) {