Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 318e3c94 authored by Bruno Martins's avatar Bruno Martins
Browse files

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
parent de23e398
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -61,15 +61,6 @@
         1==on -->
    <integer name="def_heads_up_enabled">1</integer>

    <!-- Default for LineageSettings.Global.POWER_NOTIFICATIONS_ENABLED -->
    <bool name="def_power_notifications_enabled">true</bool>

    <!-- 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>

    <!-- Default value for the battery LEDs brightness -->
    <integer name="def_battery_brightness_level">255</integer>

+3 −28
Original line number Diff line number Diff line
@@ -428,22 +428,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;
        }

@@ -617,18 +604,6 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
            stmt = db.compileStatement("INSERT OR IGNORE INTO global(name,value)"
                    + " VALUES(?,?);");
            // Global
            loadBooleanSetting(stmt,
                    LineageSettings.Global.POWER_NOTIFICATIONS_ENABLED,
                    R.bool.def_power_notifications_enabled);

            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);

            loadIntegerSetting(stmt, LineageSettings.Global.WEATHER_TEMPERATURE_UNIT,
                    R.integer.def_temperature_unit);
        } finally {
+0 −9
Original line number Diff line number Diff line
@@ -92,15 +92,6 @@ public class LineageSettingsProviderDefaultsTest extends AndroidTestCase {

    //GLOBAL
    static {
        GLOBAL_SETTINGS_DEFAULTS.add(new Setting(
                LineageSettings.Global.POWER_NOTIFICATIONS_ENABLED,
                "R.bool.def_power_notifications_enabled"));
        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"));
        GLOBAL_SETTINGS_DEFAULTS.add(new Setting(
                LineageSettings.Global.WEATHER_TEMPERATURE_UNIT,
                "R.integer.def_temperature_unit"));
+4 −0
Original line number Diff line number Diff line
@@ -3773,13 +3773,17 @@ public final class LineageSettings {
        /**
         * Whether to vibrate when charger power is connected/disconnected
         * @hide
         * @deprecated Use {@link android.provider.Settings.Secure#CHARGING_VIBRATION_ENABLED} instead
         */
        @Deprecated
        public static final String POWER_NOTIFICATIONS_VIBRATE = "power_notifications_vibrate";

        /**
         * URI for power notification sounds
         * @hide
         * @deprecated Use {@link android.provider.Settings.Global#CHARGING_STARTED_SOUND} instead
         */
        @Deprecated
        public static final String POWER_NOTIFICATIONS_RINGTONE = "power_notifications_ringtone";

        /**