LineageSettings: Deprecate charging sound settings in favor of AOSP ones

There's no need to have our own settings for this when we can simply
override the existing AOSP ones.

Change-Id: I84e1f7286cd6b4ee68c62f17ad104c76031ee0ff
This commit is contained in:
Bruno Martins
2021-06-05 15:09:10 +01:00
parent 9256c6841b
commit ea5bec56fd
5 changed files with 8 additions and 64 deletions

View File

@@ -889,18 +889,6 @@ public final class LineageSettings {
public static final String
BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX = "bluetooth_a2dp_src_priority_";
/**
* Whether to vibrate when charger power is connected/disconnected
* @hide
*/
public static final String POWER_NOTIFICATIONS_VIBRATE = "power_notifications_vibrate";
/**
* URI for power notification sounds
* @hide
*/
public static final String POWER_NOTIFICATIONS_RINGTONE = "power_notifications_ringtone";
/**
* @hide
*/
@@ -921,8 +909,6 @@ public final class LineageSettings {
*/
public static final String[] LEGACY_GLOBAL_SETTINGS = new String[]{
LineageSettings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED,
LineageSettings.Global.POWER_NOTIFICATIONS_VIBRATE,
LineageSettings.Global.POWER_NOTIFICATIONS_RINGTONE,
LineageSettings.Global.ZEN_DISABLE_DUCKING_DURING_MEDIA_PLAYBACK,
LineageSettings.Global.WIFI_AUTO_PRIORITIES_CONFIGURATION};

View File

@@ -78,12 +78,4 @@
-->
<integer name="def_clock_position">2</integer>
<!-- Defaults for Global -->
<!-- Default for LineageSettings.Global.POWER_NOTIFICATIONS_VIBRATE -->
<bool name="def_power_notifications_vibrate">false</bool>
<!-- Default for LineageSettings.Global.POWER_NOTIFICATIONS_RINGTONE -->
<string name="def_power_notifications_ringtone" translatable="false">/system/product/media/audio/ui/WirelessChargingStarted.ogg</string>
</resources>

View File

@@ -358,22 +358,9 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
}
if (upgradeVersion < 13) {
// Update custom charging sound setting
if (mUserHandle == UserHandle.USER_OWNER) {
db.beginTransaction();
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("UPDATE global SET value=? WHERE name=?");
stmt.bindString(1, mContext.getResources()
.getString(R.string.def_power_notifications_ringtone));
stmt.bindString(2, LineageSettings.Global.POWER_NOTIFICATIONS_RINGTONE);
stmt.execute();
db.setTransactionSuccessful();
} finally {
if (stmt != null) stmt.close();
db.endTransaction();
}
}
/* Was used to migrate LineageSettings.Global.POWER_NOTIFICATIONS_RINGTONE,
* but this setting has been deprecated
*/
upgradeVersion = 13;
}
@@ -540,13 +527,7 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
stmt = db.compileStatement("INSERT OR IGNORE INTO global(name,value)"
+ " VALUES(?,?);");
// Global
loadBooleanSetting(stmt,
LineageSettings.Global.POWER_NOTIFICATIONS_VIBRATE,
R.bool.def_power_notifications_vibrate);
loadStringSetting(stmt,
LineageSettings.Global.POWER_NOTIFICATIONS_RINGTONE,
R.string.def_power_notifications_ringtone);
// this is a placeholder
} finally {
if (stmt != null) stmt.close();
}

View File

@@ -85,14 +85,13 @@ public class LineageSettingsProviderDefaultsTest extends AndroidTestCase {
}
//GLOBAL
/*
static {
GLOBAL_SETTINGS_DEFAULTS.add(new Setting(
LineageSettings.Global.POWER_NOTIFICATIONS_VIBRATE,
"R.bool.def_power_notifications_vibrate"));
GLOBAL_SETTINGS_DEFAULTS.add(new Setting(
LineageSettings.Global.POWER_NOTIFICATIONS_RINGTONE,
"R.string.def_power_notifications_ringtone"));
LineageSettings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED,
false));
}
*/
@Override
protected void setUp() throws Exception {

View File

@@ -3441,18 +3441,6 @@ public final class LineageSettings {
public static final String WAKE_WHEN_PLUGGED_OR_UNPLUGGED =
"wake_when_plugged_or_unplugged";
/**
* Whether to vibrate when charger power is connected/disconnected
* @hide
*/
public static final String POWER_NOTIFICATIONS_VIBRATE = "power_notifications_vibrate";
/**
* URI for power notification sounds
* @hide
*/
public static final String POWER_NOTIFICATIONS_RINGTONE = "power_notifications_ringtone";
/**
* @hide
*/
@@ -3488,8 +3476,6 @@ public final class LineageSettings {
*/
public static final String[] LEGACY_GLOBAL_SETTINGS = new String[]{
LineageSettings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED,
LineageSettings.Global.POWER_NOTIFICATIONS_VIBRATE,
LineageSettings.Global.POWER_NOTIFICATIONS_RINGTONE,
LineageSettings.Global.ZEN_DISABLE_DUCKING_DURING_MEDIA_PLAYBACK,
LineageSettings.Global.WIFI_AUTO_PRIORITIES_CONFIGURATION
};