summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author William Escande <wescande@google.com> 2022-01-28 21:45:07 +0100
committer William Escande <wescande@google.com> 2022-02-01 19:37:26 +0000
commitc51683b7e73142331bcfd6ab873f885b41b496cc (patch)
tree8c4f6fb371a6cc9b1153ab8420ab24aae4597468
parent49081156741a53898e41c8612bdd6effef8981ce (diff)
Expose Secure.get{Int,String}ForUser as systemApi
Bluetooth is going mainline and can no longer use hidden api. We tried to use the public alternative as our user is the same returned by contentResolver.getUserId() but errorprone is not happy with it Bug: 216769091 Test: Build bluetooth as apex mainline module Change-Id: I195d545cc359d765e261c169032dfad46c916d75 CTS-Coverage-Bug: 217352944
-rw-r--r--core/api/system-current.txt2
-rw-r--r--core/java/android/provider/Settings.java13
2 files changed, 10 insertions, 5 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index b3dd7a76a8cf..d03ca085204f 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -10285,6 +10285,8 @@ package android.provider {
}
public static final class Settings.Secure extends android.provider.Settings.NameValueTable {
+ method public static int getIntForUser(@NonNull android.content.ContentResolver, @NonNull String, int, int);
+ method @Nullable public static String getStringForUser(@NonNull android.content.ContentResolver, @NonNull String, int);
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static boolean putString(@NonNull android.content.ContentResolver, @NonNull String, @Nullable String, @Nullable String, boolean);
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static void resetToDefaults(@NonNull android.content.ContentResolver, @Nullable String);
field @Deprecated public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED = "accessibility_display_magnification_navbar_enabled";
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index c4fe1a44d161..ee6f9c033271 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -6094,9 +6094,11 @@ public final class Settings {
}
/** @hide */
- @UnsupportedAppUsage
- public static String getStringForUser(ContentResolver resolver, String name,
- int userHandle) {
+ @SystemApi
+ @Nullable
+ @SuppressLint("VisiblySynchronized")
+ public static String getStringForUser(@NonNull ContentResolver resolver,
+ @NonNull String name, int userHandle) {
if (MOVED_TO_GLOBAL.contains(name)) {
Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
+ " to android.provider.Settings.Global.");
@@ -6328,8 +6330,9 @@ public final class Settings {
}
/** @hide */
- @UnsupportedAppUsage
- public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
+ @SystemApi
+ public static int getIntForUser(@NonNull ContentResolver cr, @NonNull String name,
+ int def, int userHandle) {
String v = getStringForUser(cr, name, userHandle);
return parseIntSettingWithDefault(v, def);
}