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

Commit 7fd3fbbc authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 10919479 from 1b010fc7 to 24Q1-release

Change-Id: If6a242266170c91839e5b8a7ff5f7d4b02a86971
parents 095d0358 1b010fc7
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -53,6 +53,15 @@ public final class GetCandidateCredentialsResponse implements Parcelable {
        mCandidateProviderDataList = new ArrayList<>(candidateProviderDataList);
    }

    /**
     * Returns candidate provider data list.
     *
     * @hide
     */
    public List<GetCredentialProviderData> getCandidateProviderDataList() {
        return mCandidateProviderDataList;
    }

    protected GetCandidateCredentialsResponse(Parcel in) {
        List<GetCredentialProviderData> candidateProviderDataList = new ArrayList<>();
        in.readTypedList(candidateProviderDataList, GetCredentialProviderData.CREATOR);
+39 −0
Original line number Diff line number Diff line
@@ -11606,6 +11606,45 @@ public final class Settings {
        public static final String ACCESSIBILITY_MAGNIFICATION_JOYSTICK_ENABLED =
                "accessibility_magnification_joystick_enabled";
        /**
         * Controls magnification enable gesture. Accessibility magnification can have one or more
         * enable gestures.
         *
         * @see #ACCESSIBILITY_MAGNIFICATION_GESTURE_NONE
         * @see #ACCESSIBILITY_MAGNIFICATION_GESTURE_SINGLE_FINGER_TRIPLE_TAP
         * @see #ACCESSIBILITY_MAGNIFICATION_GESTURE_TWO_FINGER_TRIPLE_TAP
         * @hide
         */
        public static final String ACCESSIBILITY_MAGNIFICATION_GESTURE =
                "accessibility_magnification_gesture";
        /**
         * Magnification enable gesture value that is a default value.
         * @hide
         */
        public static final int ACCESSIBILITY_MAGNIFICATION_GESTURE_NONE = 0x0;
        /**
         * Magnification enable gesture value is single finger triple tap.
         * @hide
         */
        public static final int ACCESSIBILITY_MAGNIFICATION_GESTURE_SINGLE_FINGER_TRIPLE_TAP = 0x1;
        /**
         * Magnification enable gesture value is two finger triple tap.
         * @hide
         */
        public static final int ACCESSIBILITY_MAGNIFICATION_GESTURE_TWO_FINGER_TRIPLE_TAP = 0x2;
        /**
         * Magnification enable gesture values include single finger triple tap and two finger
         * triple tap.
         * @hide
         */
        public static final int ACCESSIBILITY_MAGNIFICATION_GESTURE_ALL =
                ACCESSIBILITY_MAGNIFICATION_GESTURE_SINGLE_FINGER_TRIPLE_TAP
                | ACCESSIBILITY_MAGNIFICATION_GESTURE_TWO_FINGER_TRIPLE_TAP;
        /**
         * Controls magnification capability. Accessibility magnification is capable of at least one
         * of the magnification modes.
+12 −0
Original line number Diff line number Diff line
@@ -153,6 +153,18 @@ public abstract class CredentialProviderService extends Service {
    public static final String EXTRA_BEGIN_GET_CREDENTIAL_REQUEST =
            "android.service.credentials.extra.BEGIN_GET_CREDENTIAL_REQUEST";

    /**
     * The key to autofillId associated with the requested credential option and the corresponding
     * credential entry. The associated autofillId will be contained inside the candidate query
     * bundle of {@link android.credentials.CredentialOption} if requested through the
     * {@link com.android.credentialmanager.autofill.CredentialAutofillService}. The resulting
     * credential entry will  contain the autofillId inside its framework extras intent.
     *
     * @hide
     */
    public static final String EXTRA_AUTOFILL_ID =
            "android.service.credentials.extra.AUTOFILL_ID";

    private static final String TAG = "CredProviderService";

     /**
+1 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ message SecureSettingsProto {
        // Settings for font scaling
        optional SettingProto accessibility_font_scaling_has_been_changed = 51 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto accessibility_force_invert_color_enabled = 52 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto accessibility_magnification_gesture = 53 [ (android.privacy).dest = DEST_AUTOMATIC ];
    }
    optional Accessibility accessibility = 2;

+29 −18
Original line number Diff line number Diff line
@@ -18,21 +18,23 @@ package com.android.credentialmanager.autofill

import android.app.assist.AssistStructure
import android.content.Context
import android.credentials.GetCredentialRequest
import android.credentials.CredentialManager
import android.credentials.GetCandidateCredentialsResponse
import android.credentials.CredentialOption
import android.credentials.GetCandidateCredentialsException
import android.credentials.GetCandidateCredentialsResponse
import android.credentials.GetCredentialRequest
import android.os.Bundle
import android.os.CancellationSignal
import android.os.OutcomeReceiver
import android.service.autofill.FillRequest
import android.service.autofill.AutofillService
import android.service.autofill.FillResponse
import android.service.autofill.FillCallback
import android.service.autofill.SaveRequest
import android.service.autofill.FillRequest
import android.service.autofill.FillResponse
import android.service.autofill.SaveCallback
import android.service.autofill.SaveRequest
import android.service.credentials.CredentialProviderService
import android.util.Log
import android.view.autofill.AutofillId
import org.json.JSONObject
import java.util.concurrent.Executors

@@ -129,27 +131,31 @@ class CredentialAutofillService : AutofillService() {
    }

    private fun traverseNode(
            viewNode: AssistStructure.ViewNode?,
            viewNode: AssistStructure.ViewNode,
            cmRequests: MutableList<CredentialOption>
    ) {
        val options = getCredentialOptionsFromViewNode(viewNode)
        viewNode.autofillId?.let {
            val options = getCredentialOptionsFromViewNode(viewNode, it)
            cmRequests.addAll(options)
        }

        val children: List<AssistStructure.ViewNode>? =
                viewNode?.run {
        val children: List<AssistStructure.ViewNode> =
                viewNode.run {
                    (0 until childCount).map { getChildAt(it) }
                }

        children?.forEach { childNode: AssistStructure.ViewNode ->
        children.forEach { childNode: AssistStructure.ViewNode ->
            traverseNode(childNode, cmRequests)
        }
    }

    private fun getCredentialOptionsFromViewNode(viewNode: AssistStructure.ViewNode?):
            List<CredentialOption> {
    private fun getCredentialOptionsFromViewNode(
            viewNode: AssistStructure.ViewNode,
            autofillId: AutofillId
    ): List<CredentialOption> {
        // TODO(b/293945193) Replace with isCredential check from viewNode
        val credentialHints: MutableList<String> = mutableListOf()
        if (viewNode != null && viewNode.autofillHints != null) {
        if (viewNode.autofillHints != null) {
            for (hint in viewNode.autofillHints!!) {
                if (hint.startsWith(CRED_HINT_PREFIX)) {
                    credentialHints.add(hint.substringAfter(CRED_HINT_PREFIX))
@@ -159,12 +165,14 @@ class CredentialAutofillService : AutofillService() {

        val credentialOptions: MutableList<CredentialOption> = mutableListOf()
        for (credentialHint in credentialHints) {
            convertJsonToCredentialOption(credentialHint).let { credentialOptions.addAll(it) }
            convertJsonToCredentialOption(credentialHint, autofillId)
                    .let { credentialOptions.addAll(it) }
        }
        return credentialOptions
    }

    private fun convertJsonToCredentialOption(jsonString: String): List<CredentialOption> {
    private fun convertJsonToCredentialOption(jsonString: String, autofillId: AutofillId):
            List<CredentialOption> {
        // TODO(b/302000646) Move this logic to jetpack so that is consistent
        //  with building the json
        val credentialOptions: MutableList<CredentialOption> = mutableListOf()
@@ -173,11 +181,14 @@ class CredentialAutofillService : AutofillService() {
        val options = json.getJSONArray(CRED_OPTIONS_KEY)
        for (i in 0 until options.length()) {
            val option = options.getJSONObject(i)

            val candidateBundle = convertJsonToBundle(option.getJSONObject(CANDIDATE_DATA_KEY))
            candidateBundle.putParcelable(
                    CredentialProviderService.EXTRA_AUTOFILL_ID,
                    autofillId)
            credentialOptions.add(CredentialOption(
                    option.getString(TYPE_KEY),
                    convertJsonToBundle(option.getJSONObject(REQUEST_DATA_KEY)),
                    convertJsonToBundle(option.getJSONObject(CANDIDATE_DATA_KEY)),
                    candidateBundle,
                    option.getBoolean(SYS_PROVIDER_REQ_KEY),
            ))
        }
Loading