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

Commit fbdd33f8 authored by Reema Bajwa's avatar Reema Bajwa
Browse files

Change IAutofillManagerClient to IBinder for getCandidateCreds API

Bug:319917410
Test: Deployed & tested locally

Change-Id: I3211191ec3a1627361427760cc33f2020afbd7fc
parent bb0b0ea8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -33,12 +33,12 @@ import android.content.Context;
import android.content.IntentSender;
import android.os.Binder;
import android.os.CancellationSignal;
import android.os.IBinder;
import android.os.ICancellationSignal;
import android.os.OutcomeReceiver;
import android.os.RemoteException;
import android.provider.DeviceConfig;
import android.util.Log;
import android.view.autofill.IAutoFillManagerClient;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -138,7 +138,7 @@ public final class CredentialManager {
            @CallbackExecutor @NonNull Executor executor,
            @NonNull OutcomeReceiver<GetCandidateCredentialsResponse,
                    GetCandidateCredentialsException> callback,
            @NonNull IAutoFillManagerClient clientCallback
            @NonNull IBinder clientCallback
    ) {
        requireNonNull(request, "request must not be null");
        requireNonNull(callingPackage, "callingPackage must not be null");
+2 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.credentials.CredentialProviderInfo;
import android.credentials.ClearCredentialStateRequest;
import android.credentials.CreateCredentialRequest;
import android.credentials.GetCandidateCredentialsRequest;
import android.view.autofill.IAutoFillManagerClient;
import android.credentials.GetCredentialRequest;
import android.credentials.RegisterCredentialDescriptionRequest;
import android.credentials.UnregisterCredentialDescriptionRequest;
@@ -33,6 +32,7 @@ import android.credentials.IGetCandidateCredentialsCallback;
import android.credentials.IPrepareGetCredentialCallback;
import android.credentials.ISetEnabledProvidersCallback;
import android.content.ComponentName;
import android.os.IBinder;
import android.os.ICancellationSignal;

/**
@@ -48,7 +48,7 @@ interface ICredentialManager {

    @nullable ICancellationSignal executeCreateCredential(in CreateCredentialRequest request, in ICreateCredentialCallback callback, String callingPackage);

    @nullable ICancellationSignal getCandidateCredentials(in GetCredentialRequest request, in IGetCandidateCredentialsCallback callback, in IAutoFillManagerClient clientCallback, String callingPackage);
    @nullable ICancellationSignal getCandidateCredentials(in GetCredentialRequest request, in IGetCandidateCredentialsCallback callback, in IBinder clientCallback, String callingPackage);

    @nullable ICancellationSignal clearCredentialState(in ClearCredentialStateRequest request, in IClearCredentialStateCallback callback, String callingPackage);

+3 −3
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ class CredentialAutofillService : AutofillService() {
                CancellationSignal(),
                Executors.newSingleThreadExecutor(),
                outcome,
                autofillCallback
                autofillCallback.asBinder()
        )
    }

@@ -358,8 +358,8 @@ class CredentialAutofillService : AutofillService() {
                } else {
                    spec = inlinePresentationSpecs[inlinePresentationSpecsCount - 1]
                }
                val displayName: String = if (primaryEntry.credentialType == CredentialType.PASSKEY
                        && primaryEntry.displayName != null) {
                val displayName: String = if (primaryEntry.credentialType ==
                        CredentialType.PASSKEY && primaryEntry.displayName != null) {
                    primaryEntry.displayName!!
                } else {
                    primaryEntry.userName
+2 −3
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@ import android.text.TextUtils;
import android.util.Pair;
import android.util.Slog;
import android.util.SparseArray;
import android.view.autofill.IAutoFillManagerClient;

import com.android.internal.annotations.GuardedBy;
import com.android.server.credentials.metrics.ApiName;
@@ -484,7 +483,7 @@ public final class CredentialManagerService
        public ICancellationSignal getCandidateCredentials(
                GetCredentialRequest request,
                IGetCandidateCredentialsCallback callback,
                IAutoFillManagerClient clientCallback,
                IBinder clientBinder,
                final String callingPackage) {
            Slog.i(TAG, "starting getCandidateCredentials with callingPackage: "
                    + callingPackage);
@@ -506,7 +505,7 @@ public final class CredentialManagerService
                            constructCallingAppInfo(callingPackage, userId, request.getOrigin()),
                            getEnabledProvidersForUser(userId),
                            CancellationSignal.fromTransport(cancelTransport),
                            clientCallback
                            clientBinder
                    );
            addSessionLocked(userId, session);

+6 −6
Original line number Diff line number Diff line
@@ -30,11 +30,11 @@ import android.credentials.ui.GetCredentialProviderData;
import android.credentials.ui.ProviderData;
import android.credentials.ui.RequestInfo;
import android.os.CancellationSignal;
import android.os.IBinder;
import android.os.RemoteException;
import android.service.credentials.CallingAppInfo;
import android.service.credentials.PermissionUtils;
import android.util.Slog;
import android.view.autofill.IAutoFillManagerClient;

import java.util.ArrayList;
import java.util.List;
@@ -52,7 +52,7 @@ public class GetCandidateRequestSession extends RequestSession<GetCredentialRequ
    private static final String SESSION_ID_KEY = "autofill_session_id";
    private static final String REQUEST_ID_KEY = "autofill_request_id";

    private final IAutoFillManagerClient mAutoFillCallback;
    private final IBinder mClientBinder;
    private final int mAutofillSessionId;
    private final int mAutofillRequestId;

@@ -62,15 +62,15 @@ public class GetCandidateRequestSession extends RequestSession<GetCredentialRequ
            IGetCandidateCredentialsCallback callback, GetCredentialRequest request,
            CallingAppInfo callingAppInfo, Set<ComponentName> enabledProviders,
            CancellationSignal cancellationSignal,
            IAutoFillManagerClient autoFillCallback) {
            IBinder clientBinder) {
        super(context, sessionCallback, lock, userId, callingUid, request, callback,
                RequestInfo.TYPE_GET, callingAppInfo, enabledProviders,
                cancellationSignal, 0L, /*shouldBindClientToDeath=*/ false);
        mAutoFillCallback = autoFillCallback;
        mClientBinder = clientBinder;
        mAutofillSessionId = request.getData().getInt(SESSION_ID_KEY, -1);
        mAutofillRequestId = request.getData().getInt(REQUEST_ID_KEY, -1);
        if (mAutoFillCallback != null) {
            setUpClientCallbackListener(mAutoFillCallback.asBinder());
        if (mClientBinder != null) {
            setUpClientCallbackListener(mClientBinder);
        }
    }