diff --git a/core/api/system-current.txt b/core/api/system-current.txt index ff3ad1378b97d..2fd43b50bc6e0 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -10016,7 +10016,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"; diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 8ae6e4cfced2e..8724b5363985f 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -2877,6 +2877,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 diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 613d3cc7d14be..6c045442fe4a8 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -15216,7 +15216,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 = diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index 11220561b00ce..bb13c1e789644 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -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). + * + *
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 */
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index 103e14175f763..d4f9f91b6db45 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -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);
diff --git a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
index 368dda13e921f..a3f39959e7cfd 100644
--- a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
+++ b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
@@ -134,7 +134,6 @@ public class SettingsBackupTest {
Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE,
Settings.Global.ASSISTED_GPS_ENABLED,
Settings.Global.AUDIO_SAFE_VOLUME_STATE,
- Settings.Global.AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES,
Settings.Global.AUTOFILL_LOGGING_LEVEL,
Settings.Global.AUTOFILL_MAX_PARTITIONS_SIZE,
Settings.Global.AUTOFILL_MAX_VISIBLE_DATASETS,
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
index 422749e9a75af..051281c5dd08f 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
@@ -240,9 +240,6 @@ public final class AutofillManagerService
@Override // from AbstractMasterSystemService
protected void registerForExtraSettingsChanges(@NonNull ContentResolver resolver,
@NonNull ContentObserver observer) {
- resolver.registerContentObserver(Settings.Global.getUriFor(
- Settings.Global.AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES), false, observer,
- UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.Global.getUriFor(
Settings.Global.AUTOFILL_LOGGING_LEVEL), false, observer,
UserHandle.USER_ALL);
@@ -274,8 +271,6 @@ public final class AutofillManagerService
break;
default:
Slog.w(TAG, "Unexpected property (" + property + "); updating cache instead");
- // fall through
- case Settings.Global.AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES:
synchronized (mLock) {
updateCachedServiceLocked(userId);
}
@@ -307,6 +302,9 @@ public final class AutofillManagerService
case AutofillManager.DEVICE_CONFIG_AUGMENTED_SERVICE_REQUEST_TIMEOUT:
setDeviceConfigProperties();
break;
+ case AutofillManager.DEVICE_CONFIG_AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES:
+ updateCachedServices();
+ break;
default:
Slog.i(mTag, "Ignoring change on " + key);
}
@@ -588,6 +586,15 @@ public final class AutofillManagerService
}
}
+ private void updateCachedServices() {
+ List
* resolver.registerContentObserver(Settings.Global.getUriFor(
- * Settings.Global.AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES), false, observer,
+ * Settings.Global.AUTOFILL_LOGGING_LEVEL), false, observer,
* UserHandle.USER_ALL);
*
*
diff --git a/services/tests/servicestests/src/com/android/server/autofill/AutofillManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/autofill/AutofillManagerServiceTest.java
index d5a28f6b1d76f..d2ea9c4056e69 100644
--- a/services/tests/servicestests/src/com/android/server/autofill/AutofillManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/autofill/AutofillManagerServiceTest.java
@@ -15,7 +15,7 @@
*/
package com.android.server.autofill;
-import static com.android.server.autofill.AutofillManagerService.getWhitelistedCompatModePackages;
+import static com.android.server.autofill.AutofillManagerService.getAllowedCompatModePackages;
import static com.google.common.truth.Truth.assertThat;
@@ -29,54 +29,54 @@ import java.util.Map;
public class AutofillManagerServiceTest {
@Test
- public void testGetWhitelistedCompatModePackages_null() {
- assertThat(getWhitelistedCompatModePackages(null)).isNull();
+ public void testGetAllowedCompatModePackages_null() {
+ assertThat(getAllowedCompatModePackages(null)).isNull();
}
@Test
- public void testGetWhitelistedCompatModePackages_empty() {
- assertThat(getWhitelistedCompatModePackages("")).isNull();
+ public void testGetAllowedCompatModePackages_empty() {
+ assertThat(getAllowedCompatModePackages("")).isNull();
}
@Test
- public void testGetWhitelistedCompatModePackages_onePackageNoUrls() {
- assertThat(getWhitelistedCompatModePackages("one_is_the_loniest_package"))
+ public void testGetAllowedCompatModePackages_onePackageNoUrls() {
+ assertThat(getAllowedCompatModePackages("one_is_the_loniest_package"))
.containsExactly("one_is_the_loniest_package", null);
}
@Test
- public void testGetWhitelistedCompatModePackages_onePackageMissingEndDelimiter() {
- assertThat(getWhitelistedCompatModePackages("one_is_the_loniest_package[")).isEmpty();
+ public void testGetAllowedCompatModePackages_onePackageMissingEndDelimiter() {
+ assertThat(getAllowedCompatModePackages("one_is_the_loniest_package[")).isEmpty();
}
@Test
- public void testGetWhitelistedCompatModePackages_onePackageOneUrl() {
+ public void testGetAllowedCompatModePackages_onePackageOneUrl() {
final Map