From 8397f1056ba8d948f9b383c7bf1c6675e0725740 Mon Sep 17 00:00:00 2001 From: Sunny Shao Date: Thu, 6 Feb 2025 13:31:21 +0000 Subject: [PATCH] [Catalyst] Introduce the Tags for Get/Set APIs NO_IFTTT=Catalyst only Test: atest ExternalSettingsProviderTest Bug: 394002861 Flag: EXEMPT bugfix Change-Id: I630a9f5ffbaaeed16e13674efa507f3a7b681839 --- .../settings/contract/SettingsContract.kt | 39 +++++++++++++++++++ .../AmbientDisplayAlwaysOnPreference.kt | 3 +- .../settings/slices/CustomSliceRegistry.java | 8 ++-- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/src/com/android/settings/contract/SettingsContract.kt b/src/com/android/settings/contract/SettingsContract.kt index d3798daa582..99db4973b71 100644 --- a/src/com/android/settings/contract/SettingsContract.kt +++ b/src/com/android/settings/contract/SettingsContract.kt @@ -47,3 +47,42 @@ const val KEY_ADAPTIVE_BRIGHTNESS = "auto_brightness" /** Contract key for the "Screen attention" setting. */ const val KEY_SCREEN_ATTENTION = "screen_attention" + +/** Contract key for the "Use adaptive connectivity" setting. */ +const val KEY_ADAPTIVE_CONNECTIVITY = "adaptive_connectivity" + +/** Contract key for the "WiFi hotspot" setting. */ +const val KEY_WIFI_HOTSPOT = "enable_wifi_ap" + +/** Contract key for the "Battery Gauge Slider" setting. */ +const val KEY_BATTERY_LEVEL = "battery_level" + +/** Contract key for the "Battery Percentage" setting. */ +const val KEY_BATTERY_PERCENTAGE = "battery_percentage" + +/** Contract key for the "Brightness level" setting. */ +const val KEY_BRIGHTNESS_LEVEL = "brightness_level" + +/** Contract key for the "Smooth display" setting. */ +const val KEY_SMOOTH_DISPLAY = "smooth_display" + +/** Contract key for the "Dark theme" setting. */ +const val KEY_DARK_THEME = "dark_theme" + +/** Contract key for the "Always show time and info" setting. */ +const val KEY_AMBIENT_DISPLAY_ALWAYS_ON = "ambient_display_always_on" + +/** Contract key for the "Use vibration & haptics" setting. */ +const val KEY_VIBRATION_HAPTICS = "vibration_haptics" + +/** Contract key for the "Media volume" setting. */ +const val KEY_MEDIA_VOLUME = "media_volume" + +/** Contract key for the "Call volume" setting. */ +const val KEY_CALL_VOLUME = "call_volume" + +/** Contract key for the "Ring volume" setting. */ +const val KEY_RING_VOLUME = "separate_ring_volume" + +/** Contract key for the "Remove animation" setting. */ +const val KEY_REMOVE_ANIMATION = "remove_animation" diff --git a/src/com/android/settings/display/AmbientDisplayAlwaysOnPreference.kt b/src/com/android/settings/display/AmbientDisplayAlwaysOnPreference.kt index 3cc608bec91..453593fd5c0 100644 --- a/src/com/android/settings/display/AmbientDisplayAlwaysOnPreference.kt +++ b/src/com/android/settings/display/AmbientDisplayAlwaysOnPreference.kt @@ -24,6 +24,7 @@ import android.os.UserManager import android.provider.Settings.Secure.DOZE_ALWAYS_ON import com.android.settings.PreferenceRestrictionMixin import com.android.settings.R +import com.android.settings.contract.KEY_AMBIENT_DISPLAY_ALWAYS_ON import com.android.settings.display.AmbientDisplayAlwaysOnPreferenceController.isAodSuppressedByBedtime import com.android.settingslib.datastore.AbstractKeyedDataObservable import com.android.settingslib.datastore.HandlerExecutor @@ -123,7 +124,7 @@ class AmbientDisplayAlwaysOnPreference : } companion object { - const val KEY = "ambient_display_always_on" + const val KEY = KEY_AMBIENT_DISPLAY_ALWAYS_ON private const val PROP_AWARE_AVAILABLE = "ro.vendor.aware_available" } } diff --git a/src/com/android/settings/slices/CustomSliceRegistry.java b/src/com/android/settings/slices/CustomSliceRegistry.java index 41f189276dd..38ca5cde95e 100644 --- a/src/com/android/settings/slices/CustomSliceRegistry.java +++ b/src/com/android/settings/slices/CustomSliceRegistry.java @@ -171,7 +171,7 @@ public class CustomSliceRegistry { .scheme(ContentResolver.SCHEME_CONTENT) .authority(SettingsSliceProvider.SLICE_AUTHORITY) .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION) - .appendPath("call_volume") + .appendPath(SettingsContractKt.KEY_CALL_VOLUME) .build(); /** * Full {@link Uri} for the Media Volume Slice. @@ -180,7 +180,7 @@ public class CustomSliceRegistry { .scheme(ContentResolver.SCHEME_CONTENT) .authority(SettingsSliceProvider.SLICE_AUTHORITY) .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION) - .appendPath("media_volume") + .appendPath(SettingsContractKt.KEY_MEDIA_VOLUME) .build(); /** @@ -190,7 +190,7 @@ public class CustomSliceRegistry { .scheme(ContentResolver.SCHEME_CONTENT) .authority(SettingsSliceProvider.SLICE_AUTHORITY) .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION) - .appendPath("separate_ring_volume") + .appendPath(SettingsContractKt.KEY_RING_VOLUME) .build(); /** @@ -268,7 +268,7 @@ public class CustomSliceRegistry { .scheme(ContentResolver.SCHEME_CONTENT) .authority(SettingsSliceProvider.SLICE_AUTHORITY) .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION) - .appendPath("dark_theme") + .appendPath(SettingsContractKt.KEY_DARK_THEME) .build(); /**