Merge "Update default charging sound to new sound" into pi-dev
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml
index d59df6c..c173225 100644
--- a/packages/SettingsProvider/res/values/defaults.xml
+++ b/packages/SettingsProvider/res/values/defaults.xml
@@ -80,6 +80,7 @@
<string name="def_unlock_sound" translatable="false">/system/media/audio/ui/Unlock.ogg</string>
<string name="def_trusted_sound" translatable="false">/system/media/audio/ui/Trusted.ogg</string>
<string name="def_wireless_charging_started_sound" translatable="false">/system/media/audio/ui/WirelessChargingStarted.ogg</string>
+ <string name="def_charging_started_sound" translatable="false">/system/media/audio/ui/ChargingStarted.ogg</string>
<bool name="def_lockscreen_disabled">false</bool>
<bool name="def_device_provisioned">false</bool>
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index bbb4fc8..a317e3e 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -3028,7 +3028,7 @@
}
private final class UpgradeController {
- private static final int SETTINGS_VERSION = 155;
+ private static final int SETTINGS_VERSION = 156;
private final int mUserId;
@@ -3673,6 +3673,28 @@
currentVersion = 155;
}
+ if (currentVersion == 155) {
+ // Version 155: Set the default value for CHARGING_STARTED_SOUND.
+ final SettingsState globalSettings = getGlobalSettingsLocked();
+ final String oldValue = globalSettings.getSettingLocked(
+ Global.CHARGING_STARTED_SOUND).getValue();
+ final String oldDefault = getContext().getResources().getString(
+ R.string.def_wireless_charging_started_sound);
+ if (TextUtils.equals(null, oldValue)
+ || TextUtils.equals(oldValue, oldDefault)) {
+ final String defaultValue = getContext().getResources().getString(
+ R.string.def_charging_started_sound);
+ if (!TextUtils.isEmpty(defaultValue)) {
+ globalSettings.insertSettingLocked(
+ Settings.Global.CHARGING_STARTED_SOUND, defaultValue,
+ null, true, SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+
+ }
+ currentVersion = 156;
+ }
+
+
// vXXX: Add new settings above this point.
if (currentVersion != newVersion) {