Move AmbientProperties to Settings.Global

Bug: 173069117, 191375904
Test: manual test
Change-Id: I020d78355339464764a71256ab4959e90c171612
This commit is contained in:
Josh Yang
2020-11-17 18:10:45 -08:00
committed by Haiping Yang
parent 420cce97e1
commit 22316bc508
5 changed files with 130 additions and 1 deletions

View File

@@ -16512,6 +16512,67 @@ public final class Settings {
* @hide
*/
public static final String MOBILE_SIGNAL_DETECTOR = "mobile_signal_detector";
/**
* Whether ambient is currently enabled.
* @hide
*/
public static final String AMBIENT_ENABLED = "ambient_enabled";
/**
* Whether ambient tilt to wake is enabled.
* @hide
*/
public static final String AMBIENT_TILT_TO_WAKE = "ambient_tilt_to_wake";
/**
* Whether ambient low bit mode is enabled by developer options.
* @hide
*/
public static final String AMBIENT_LOW_BIT_ENABLED_DEV = "ambient_low_bit_enabled_dev";
/**
* Whether ambient touch to wake is enabled.
* @hide
*/
public static final String AMBIENT_TOUCH_TO_WAKE = "ambient_touch_to_wake";
/**
* Whether ambient tilt to bright is enabled.
* @hide
*/
public static final String AMBIENT_TILT_TO_BRIGHT = "ambient_tilt_to_bright";
/**
* Whether the current watchface is decomposable.
* @hide
*/
public static final String DECOMPOSABLE_WATCHFACE = "current_watchface_decomposable";
/**
* Whether to force ambient when docked.
* @hide
*/
public static final String AMBIENT_FORCE_WHEN_DOCKED = "ambient_force_when_docked";
/**
* The id of the gesture sensor.
* @hide
*/
public static final String AMBIENT_GESTURE_SENSOR_ID = "ambient_gesture_sensor_id";
/**
* Whether the ambient low bit mode is enabled.
* @hide
*/
public static final String AMBIENT_LOW_BIT_ENABLED = "ambient_low_bit_enabled";
/**
* The timeout duration in minutes of ambient mode when plugged in.
* @hide
*/
public static final String AMBIENT_PLUGGED_TIMEOUT_MIN = "ambient_plugged_timeout_min";
}
}

View File

@@ -311,4 +311,16 @@
<!-- Whether to allow mobile signal detector by default. -->
<bool name="def_wearable_mobileSignalDetectorAllowed">true</bool>
<!-- If ambient mode is enabled by default. -->
<bool name="def_wearable_ambientEnabled">true</bool>
<!-- Whether tilt to wake is enabled by default. -->
<bool name="def_wearable_tiltToWakeEnabled">true</bool>
<!-- Whether touch to wake is enabled by default. -->
<bool name="def_wearable_touchToWakeEnabled">true</bool>
<!-- Whether tilt to bright is enabled by default. -->
<bool name="def_wearable_tiltToBrightEnabled">false</bool>
</resources>

View File

@@ -255,6 +255,16 @@ public class GlobalSettingsValidators {
String.valueOf(Global.Wearable.DISPLAY_SHAPE_SQUARE)
}));
VALIDATORS.put(Global.Wearable.MOBILE_SIGNAL_DETECTOR, BOOLEAN_VALIDATOR);
VALIDATORS.put(Global.Wearable.AMBIENT_ENABLED, BOOLEAN_VALIDATOR);
VALIDATORS.put(Global.Wearable.AMBIENT_TILT_TO_WAKE, BOOLEAN_VALIDATOR);
VALIDATORS.put(Global.Wearable.AMBIENT_LOW_BIT_ENABLED_DEV, BOOLEAN_VALIDATOR);
VALIDATORS.put(Global.Wearable.AMBIENT_TOUCH_TO_WAKE, BOOLEAN_VALIDATOR);
VALIDATORS.put(Global.Wearable.DECOMPOSABLE_WATCHFACE, BOOLEAN_VALIDATOR);
VALIDATORS.put(Global.Wearable.AMBIENT_FORCE_WHEN_DOCKED, BOOLEAN_VALIDATOR);
VALIDATORS.put(Global.Wearable.AMBIENT_GESTURE_SENSOR_ID, ANY_INTEGER_VALIDATOR);
VALIDATORS.put(Global.Wearable.AMBIENT_LOW_BIT_ENABLED, BOOLEAN_VALIDATOR);
VALIDATORS.put(Global.Wearable.AMBIENT_PLUGGED_TIMEOUT_MIN, ANY_INTEGER_VALIDATOR);
VALIDATORS.put(Global.Wearable.AMBIENT_TILT_TO_BRIGHT, BOOLEAN_VALIDATOR);
}
}

View File

@@ -5317,6 +5317,42 @@ public class SettingsProvider extends ContentProvider {
.getResources()
.getBoolean(
R.bool.def_wearable_mobileSignalDetectorAllowed));
initGlobalSettingsDefaultValForWearLocked(
Global.Wearable.AMBIENT_ENABLED,
getContext()
.getResources()
.getBoolean(R.bool.def_wearable_ambientEnabled));
initGlobalSettingsDefaultValForWearLocked(
Global.Wearable.AMBIENT_TILT_TO_WAKE,
getContext()
.getResources()
.getBoolean(R.bool.def_wearable_tiltToWakeEnabled));
initGlobalSettingsDefaultValForWearLocked(
Global.Wearable.AMBIENT_LOW_BIT_ENABLED_DEV, false);
initGlobalSettingsDefaultValForWearLocked(
Global.Wearable.AMBIENT_TOUCH_TO_WAKE,
getContext()
.getResources()
.getBoolean(R.bool.def_wearable_touchToWakeEnabled));
initGlobalSettingsDefaultValForWearLocked(
Global.Wearable.AMBIENT_TILT_TO_BRIGHT,
getContext()
.getResources()
.getBoolean(R.bool.def_wearable_tiltToBrightEnabled));
initGlobalSettingsDefaultValForWearLocked(
Global.Wearable.DECOMPOSABLE_WATCHFACE, false);
initGlobalSettingsDefaultValForWearLocked(
Settings.Global.Wearable.AMBIENT_FORCE_WHEN_DOCKED,
SystemProperties.getBoolean("ro.ambient.force_when_docked", false));
initGlobalSettingsDefaultValForWearLocked(
Settings.Global.Wearable.AMBIENT_GESTURE_SENSOR_ID,
SystemProperties.getInt("ro.ambient.gesture_sensor_id", 0));
initGlobalSettingsDefaultValForWearLocked(
Settings.Global.Wearable.AMBIENT_LOW_BIT_ENABLED,
SystemProperties.getBoolean("ro.ambient.low_bit_enabled", false));
initGlobalSettingsDefaultValForWearLocked(
Settings.Global.Wearable.AMBIENT_PLUGGED_TIMEOUT_MIN,
SystemProperties.getInt("ro.ambient.plugged_timeout_min", -1));
// TODO(b/164398026): add necessary initialization logic for all entries.
currentVersion = 204;

View File

@@ -635,7 +635,17 @@ public class SettingsBackupTest {
Settings.Global.Wearable.DISPLAY_SHAPE,
Settings.Global.Wearable.BOTTOM_OFFSET,
Settings.Global.Wearable.SCREEN_BRIGHTNESS_LEVEL,
Settings.Global.Wearable.MOBILE_SIGNAL_DETECTOR);
Settings.Global.Wearable.MOBILE_SIGNAL_DETECTOR,
Settings.Global.Wearable.AMBIENT_ENABLED,
Settings.Global.Wearable.AMBIENT_TILT_TO_WAKE,
Settings.Global.Wearable.AMBIENT_LOW_BIT_ENABLED_DEV,
Settings.Global.Wearable.AMBIENT_TOUCH_TO_WAKE,
Settings.Global.Wearable.AMBIENT_TILT_TO_BRIGHT,
Settings.Global.Wearable.DECOMPOSABLE_WATCHFACE,
Settings.Global.Wearable.AMBIENT_FORCE_WHEN_DOCKED,
Settings.Global.Wearable.AMBIENT_GESTURE_SENSOR_ID,
Settings.Global.Wearable.AMBIENT_LOW_BIT_ENABLED,
Settings.Global.Wearable.AMBIENT_PLUGGED_TIMEOUT_MIN);
private static final Set<String> BACKUP_DENY_LIST_SECURE_SETTINGS =
newHashSet(