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

Commit 91c2e6a9 authored by Reema Bajwa's avatar Reema Bajwa Committed by Android (Google) Code Review
Browse files

Merge "Copy option data in begin requests"

parents a94af75b dc70cf94
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@ import android.os.Parcelable;

import com.android.internal.util.Preconditions;

import java.util.Objects;

/**
 * Request for beginning a create credential request.
 *
@@ -54,7 +52,9 @@ public class BeginCreateCredentialRequest implements Parcelable {
            @Nullable CallingAppInfo callingAppInfo) {
        mType = Preconditions.checkStringNotEmpty(type,
                "type must not be null or empty");
        mData = Objects.requireNonNull(data, "data must not be null");
        Bundle dataCopy = new Bundle();
        dataCopy.putAll(data);
        mData = dataCopy;
        mCallingAppInfo = callingAppInfo;
    }

+4 −7
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.service.credentials;

import static java.util.Objects.requireNonNull;

import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.os.Bundle;
@@ -60,9 +58,7 @@ public class BeginGetCredentialOption implements Parcelable {
    private final Bundle mCandidateQueryData;

    /**
     * Returns the unique id associated with this request. Providers must pass this id
     * to the constructor of {@link CredentialEntry} while creating a candidate credential
     * entry for this request option.
     * Returns the unique id associated with this request. This is for internal use only.
     */
    @NonNull
    public String getId() {
@@ -127,8 +123,9 @@ public class BeginGetCredentialOption implements Parcelable {
            @NonNull Bundle candidateQueryData) {
        mId = id;
        mType = Preconditions.checkStringNotEmpty(type, "type must not be empty");
        mCandidateQueryData = requireNonNull(
                candidateQueryData, "candidateQueryData must not be null");
        Bundle bundle = new Bundle();
        bundle.putAll(candidateQueryData);
        mCandidateQueryData = bundle;
        addIdToBundle();
    }

+9 −4
Original line number Diff line number Diff line
@@ -77,14 +77,19 @@ public final class ProviderCreateSession extends ProviderSession<
                        createRequestSession.mClientRequest,
                        createRequestSession.mClientAppInfo);
        if (providerCreateRequest != null) {
            BeginCreateCredentialRequest providerBeginCreateRequest =
            return new ProviderCreateSession(
                    context,
                    providerInfo,
                    createRequestSession,
                    userId,
                    remoteCredentialService,
                    constructQueryPhaseRequest(createRequestSession.mClientRequest.getType(),
                            createRequestSession.mClientRequest.getCandidateQueryData(),
                            createRequestSession.mClientAppInfo,
                            createRequestSession
                                    .mClientRequest.alwaysSendAppInfoToProvider());
            return new ProviderCreateSession(context, providerInfo, createRequestSession, userId,
                    remoteCredentialService, providerBeginCreateRequest, providerCreateRequest);
                                    .mClientRequest.alwaysSendAppInfoToProvider()),
                    providerCreateRequest
            );
        }
        Log.i(TAG, "Unable to create provider session");
        return null;
+14 −8
Original line number Diff line number Diff line
@@ -97,14 +97,20 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
        if (filteredRequest != null) {
            Map<String, CredentialOption> beginGetOptionToCredentialOptionMap =
                    new HashMap<>();
            BeginGetCredentialRequest beginGetCredentialRequest = constructQueryPhaseRequest(
            return new ProviderGetSession(
                    context,
                    providerInfo,
                    getRequestSession,
                    userId,
                    remoteCredentialService,
                    constructQueryPhaseRequest(
                            filteredRequest, getRequestSession.mClientAppInfo,
                            getRequestSession.mClientRequest.alwaysSendAppInfoToProvider(),
                    beginGetOptionToCredentialOptionMap);
            return new ProviderGetSession(context, providerInfo, getRequestSession, userId,
                    remoteCredentialService, beginGetCredentialRequest, filteredRequest,
                            beginGetOptionToCredentialOptionMap),
                    filteredRequest,
                    getRequestSession.mClientAppInfo,
                    beginGetOptionToCredentialOptionMap);
                    beginGetOptionToCredentialOptionMap
            );
        }
        Log.i(TAG, "Unable to create provider session");
        return null;
@@ -168,7 +174,7 @@ public final class ProviderGetSession extends ProviderSession<BeginGetCredential
        mCompleteRequest = completeGetRequest;
        mCallingAppInfo = callingAppInfo;
        setStatus(Status.PENDING);
        mBeginGetOptionToCredentialOptionMap = beginGetOptionToCredentialOptionMap;
        mBeginGetOptionToCredentialOptionMap = new HashMap<>(beginGetOptionToCredentialOptionMap);
    }

    /** Called when the provider response has been updated by an external source. */