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

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

Merge "Invoke Credential Manager UI from the apps process through a pending...

Merge "Invoke Credential Manager UI from the apps process through a pending intent generated by the framework Test: Locally built & deployed Bug: 253155429"
parents 970a248a 65a9b5c4
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -72,9 +72,15 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR


    @Override
    @Override
    protected void launchUiWithProviderData(ArrayList<ProviderData> providerDataList) {
    protected void launchUiWithProviderData(ArrayList<ProviderData> providerDataList) {
        mHandler.post(() -> mCredentialManagerUi.show(RequestInfo.newCreateRequestInfo(
        try {
            mClientCallback.onPendingIntent(mCredentialManagerUi.createPendingIntent(
                    RequestInfo.newCreateRequestInfo(
                            mRequestId, mClientRequest, mIsFirstUiTurn, mClientCallingPackage),
                            mRequestId, mClientRequest, mIsFirstUiTurn, mClientCallingPackage),
                    providerDataList));
                    providerDataList));
        } catch (RemoteException e) {
            Log.i(TAG, "Issue with invoking pending intent: " + e.getMessage());
            // TODO: Propagate failure
        }
    }
    }


    private void respondToClientAndFinish(CreateCredentialResponse response) {
    private void respondToClientAndFinish(CreateCredentialResponse response) {
+11 −6
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@
package com.android.server.credentials;
package com.android.server.credentials;


import android.annotation.NonNull;
import android.annotation.NonNull;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.credentials.ui.IntentFactory;
import android.credentials.ui.IntentFactory;
@@ -79,14 +80,18 @@ public class CredentialManagerUi {
    }
    }


    /**
    /**
     * Surfaces the Credential Manager bottom sheet UI.
     * Creates a {@link PendingIntent} to be used to invoke the credential manager selector UI,
     * by the calling app process.
     * @param requestInfo the information about the request
     * @param providerDataList the list of provider data from remote providers
     * @param providerDataList the list of provider data from remote providers
     */
     */
    public void show(RequestInfo requestInfo, ArrayList<ProviderData> providerDataList) {
    public PendingIntent createPendingIntent(
        Log.i(TAG, "In show");
            RequestInfo requestInfo, ArrayList<ProviderData> providerDataList) {
        Log.i(TAG, "In createPendingIntent");
        Intent intent = IntentFactory.newIntent(requestInfo, providerDataList, new ArrayList<>(),
        Intent intent = IntentFactory.newIntent(requestInfo, providerDataList, new ArrayList<>(),
                mResultReceiver);
                mResultReceiver).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        //TODO: Determine if a specific request code is needed
        mContext.startActivity(intent);
        return PendingIntent.getActivity(
                mContext, /*requestCode=*/0, intent, PendingIntent.FLAG_IMMUTABLE);
    }
    }
}
}
+9 −3
Original line number Original line Diff line number Diff line
@@ -68,9 +68,15 @@ public final class GetRequestSession extends RequestSession<GetCredentialRequest


    @Override
    @Override
    protected void launchUiWithProviderData(ArrayList<ProviderData> providerDataList) {
    protected void launchUiWithProviderData(ArrayList<ProviderData> providerDataList) {
        mHandler.post(() -> mCredentialManagerUi.show(RequestInfo.newGetRequestInfo(
        try {
            mClientCallback.onPendingIntent(mCredentialManagerUi.createPendingIntent(
                    RequestInfo.newGetRequestInfo(
                    mRequestId, null, mIsFirstUiTurn, ""),
                    mRequestId, null, mIsFirstUiTurn, ""),
                    providerDataList));
                    providerDataList));
        } catch (RemoteException e) {
            Log.i(TAG, "Issue with invoking pending intent: " + e.getMessage());
            // TODO: Propagate failure
        }
    }
    }


    @Override // from provider session
    @Override // from provider session