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

Commit 9f8d8c01 authored by TYM Tsai's avatar TYM Tsai
Browse files

Migrate compat mode allowed list to DeviceConfig

To test, manually played with 'adb shell device_config'. Examples:

$ adb shell device_config list autofill
$ adb shell device_config delete autofill compat_mode_allowed_packages
$ adb shell device_config list autofill
compat_mode_allowed_packages: not found

$ adb shell device_config put autofill compat_mode_allowed_packages com.android.chrome[url_bar]:com.brave.browser[url_bar]
$ adb shell device_config list autofill
compat_mode_allowed_packages: found, value is com.android.chrome[url_bar]:com.brave.browser[url_bar]
$ adb shell dumpsys autofill
see:
Autofill Compat State:
  User: 0
    com.android.chrome: maxVersionCode=10000000000, urlBarResourceIds=[url_bar]
from device config: com.android.chrome[url_bar]:com.brave.browser[url_bar]

Bug: 194967348
Test: atest CtsAutoFillServiceTestCases
Test: atest com.android.server.autofill.AutofillManagerServiceTest
Change-Id: I775782622adecb42b86de508f502f03039cc34ca
parent eb867fde
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -9652,7 +9652,7 @@ package android.provider {
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static void resetToDefaults(@NonNull android.content.ContentResolver, @Nullable String);
    field public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
    field public static final String APP_STANDBY_ENABLED = "app_standby_enabled";
    field public static final String AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES = "autofill_compat_mode_allowed_packages";
    field @Deprecated public static final String AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES = "autofill_compat_mode_allowed_packages";
    field public static final String CARRIER_APP_NAMES = "carrier_app_names";
    field public static final String CARRIER_APP_WHITELIST = "carrier_app_whitelist";
    field public static final String DEFAULT_SM_DP_PLUS = "default_sm_dp_plus";
+1 −0
Original line number Diff line number Diff line
@@ -2956,6 +2956,7 @@ package android.view.autofill {
  }

  public final class AutofillManager {
    field public static final String DEVICE_CONFIG_AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES = "compat_mode_allowed_packages";
    field public static final String DEVICE_CONFIG_AUTOFILL_SMART_SUGGESTION_SUPPORTED_MODES = "smart_suggestion_supported_modes";
    field public static final int FLAG_SMART_SUGGESTION_OFF = 0; // 0x0
    field public static final int FLAG_SMART_SUGGESTION_SYSTEM = 1; // 0x1
+3 −0
Original line number Diff line number Diff line
@@ -15035,7 +15035,10 @@ public final class Settings {
         * {@code p1[url_bar]:p2:p3[url_foo,url_bas]}
         *
         * @hide
         * @deprecated Use {@link android.view.autofill.AutofillManager
         * #DEVICE_CONFIG_AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES} instead.
         */
        @Deprecated
        @SystemApi
        @Readable
        public static final String AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES =
+18 −0
Original line number Diff line number Diff line
@@ -472,6 +472,24 @@ public final class AutofillManager {
    public static final String DEVICE_CONFIG_AUGMENTED_SERVICE_REQUEST_TIMEOUT =
            "augmented_service_request_timeout";

    /**
     * Sets allowed list for the autofill compatibility mode.
     *
     * The list of packages is {@code ":"} colon delimited, and each entry has the name of the
     * package and an optional list of url bar resource ids (the list is delimited by
     * brackets&mdash{@code [} and {@code ]}&mdash and is also comma delimited).
     *
     * <p>For example, a list with 3 packages {@code p1}, {@code p2}, and {@code p3}, where
     * package {@code p1} have one id ({@code url_bar}, {@code p2} has none, and {@code p3 }
     * have 2 ids {@code url_foo} and {@code url_bas}) would be
     * {@code p1[url_bar]:p2:p3[url_foo,url_bas]}
     *
     * @hide
     */
    @TestApi
    public static final String DEVICE_CONFIG_AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES =
            "compat_mode_allowed_packages";

    /** @hide */
    public static final int RESULT_OK = 0;
    /** @hide */
+0 −3
Original line number Diff line number Diff line
@@ -243,9 +243,6 @@ class SettingsProtoDumpUtil {
                GlobalSettingsProto.AUDIO_SAFE_VOLUME_STATE);

        final long autofillToken = p.start(GlobalSettingsProto.AUTOFILL);
        dumpSetting(s, p,
                Settings.Global.AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES,
                GlobalSettingsProto.Autofill.COMPAT_MODE_ALLOWED_PACKAGES);
        dumpSetting(s, p,
                Settings.Global.AUTOFILL_LOGGING_LEVEL,
                GlobalSettingsProto.Autofill.LOGGING_LEVEL);
Loading