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

Commit 388f9ab7 authored by Reema Bajwa's avatar Reema Bajwa
Browse files

Direct connection btw Autofill & Credman sessions

Before this change, a result reciever was added to each pinned dataset's
associated intent, and then retrieved in the from the intent that
starts the credman selector intent which then passed it to credman session.
Now, autofill session constructs one resultreciever per FillRequest and adds it to
client state, proxy service retrieves it from clientstate and
adds it to the req top level bundle, which is then extracted by credman session
and used to propagate the final response.
Hence we remove the dependency on the selector passing the resultReciver to the credman
session

Test: Cts
Bug: 333455221

Change-Id: Ic17091841edbcf0975d0ff238f2d8b72d8cd5593
parent 760a44e4
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -131,6 +131,13 @@ public final class CredentialManager {
    private static final String DEVICE_CONFIG_ENABLE_CREDENTIAL_DESC_API =
            "enable_credential_description_api";

    /**
     * @hide
     */
    @Hide
    public static final String EXTRA_AUTOFILL_RESULT_RECEIVER =
            "android.credentials.AUTOFILL_RESULT_RECEIVER";

    /**
     * @hide instantiated by ContextImpl.
     */
+0 −7
Original line number Diff line number Diff line
@@ -28,12 +28,5 @@ public class Constants {
     */
    public static final String EXTRA_RESULT_RECEIVER =
            "android.credentials.selection.extra.RESULT_RECEIVER";

    /**
     * The intent extra key for the final result receiver object
     */
    public static final String EXTRA_FINAL_RESPONSE_RECEIVER =
            "android.credentials.selection.extra.FINAL_RESPONSE_RECEIVER";

    private Constants() {}
}
+3 −8
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.content.Context
import android.content.Intent
import android.credentials.selection.BaseDialogResult
import android.credentials.selection.BaseDialogResult.RESULT_CODE_DIALOG_USER_CANCELED
import android.credentials.selection.Constants
import android.credentials.selection.ProviderPendingIntentResponse
import android.credentials.selection.UserSelectionDialogResult
import android.os.Bundle
@@ -117,21 +116,17 @@ class CredentialManagerClientImpl @Inject constructor(
        sendCancellationCode(
            cancelCode = cancelCode,
            requestToken = token,
            resultReceiver = resultReceiver,
            finalResponseReceiver = finalResponseReceiver
            resultReceiver = resultReceiver
        )
    }

    private fun sendCancellationCode(
        cancelCode: Int,
        requestToken: IBinder?,
        resultReceiver: ResultReceiver?,
        finalResponseReceiver: ResultReceiver?
        resultReceiver: ResultReceiver?
    ) {
        if (requestToken != null && resultReceiver != null) {
            val resultData = Bundle().apply {
                putParcelable(Constants.EXTRA_FINAL_RESPONSE_RECEIVER, finalResponseReceiver)
            }
            val resultData = Bundle()
            BaseDialogResult.addToBundle(BaseDialogResult(requestToken), resultData)
            resultReceiver.send(cancelCode, resultData)
        }
+0 −6
Original line number Diff line number Diff line
@@ -54,9 +54,3 @@ val Intent.resultReceiver: ResultReceiver?
        Constants.EXTRA_RESULT_RECEIVER,
        ResultReceiver::class.java
    )

val Intent.finalResponseReceiver: ResultReceiver?
    get() = this.getParcelableExtra(
        Constants.EXTRA_FINAL_RESPONSE_RECEIVER,
        ResultReceiver::class.java
    )
+0 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.content.Context
import android.content.Intent
import com.android.credentialmanager.ktx.getCredentialProviderDataList
import com.android.credentialmanager.ktx.requestInfo
import com.android.credentialmanager.ktx.finalResponseReceiver
import com.android.credentialmanager.ktx.resultReceiver
import com.android.credentialmanager.ktx.toProviderList
import com.android.credentialmanager.model.Request
@@ -29,7 +28,6 @@ fun Intent.toGet(context: Context): Request.Get {
    return Request.Get(
        token = requestInfo?.token,
        resultReceiver = resultReceiver,
        finalResponseReceiver = finalResponseReceiver,
        providerInfos = getCredentialProviderDataList.toProviderList(context)
    )
}
Loading