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

Commit f364d7cd authored by Beverly's avatar Beverly
Browse files

Play different sounds for wired/wireless charging

- Allow different sounds to be played for wired and wireless
charging
- Only show the wireless charging animation if
config_showBuiltinWirelessCharging_anim is true

Test: manual
Bug: 135716837
Change-Id: I16161bed84fe586c50adb29f49e395f1f7a4dfe4
parent 30f59237
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -8595,12 +8595,18 @@ public final class Settings {
        public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
        /**
         * URI for the "wireless charging started" and "wired charging started" sound.
         * URI for the "wireless charging started" sound.
         * @hide
         */
        public static final String CHARGING_STARTED_SOUND =
        public static final String WIRELESS_CHARGING_STARTED_SOUND =
                "wireless_charging_started_sound";
        /**
         * URI for "wired charging started" sound.
         * @hide
         */
        public static final String CHARGING_STARTED_SOUND = "charging_started_sound";
        /**
         * Whether to play a sound for charging events.
         * @deprecated Use {@link android.provider.Settings.Secure#CHARGING_SOUNDS_ENABLED} instead
+1 −0
Original line number Diff line number Diff line
@@ -853,6 +853,7 @@ message GlobalSettingsProto {
        optional SettingProto low_battery_sounds_enabled = 12 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto trusted = 13;
        optional SettingProto unlock = 14;
        optional SettingProto wireless_charging_started = 15;
    }
    optional Sounds sounds = 110;

+4 −0
Original line number Diff line number Diff line
@@ -4345,4 +4345,8 @@
         create additional screen real estate outside beyond the keyboard. Note that the user needs
         to have a confirmed way to dismiss the keyboard when desired. -->
    <bool name="config_automotiveHideNavBarForKeyboard">false</bool>

    <!-- Whether or not to show the built-in charging animation when the device begins charging
         wirelessly. -->
    <bool name="config_showBuiltinWirelessChargingAnim">true</bool>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -3863,4 +3863,6 @@

  <java-symbol type="bool" name="config_automotiveHideNavBarForKeyboard" />

  <java-symbol type="bool" name="config_showBuiltinWirelessChargingAnim" />

</resources>
+1 −17
Original line number Diff line number Diff line
@@ -1497,21 +1497,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
        }

        if (upgradeVersion == 94) {
            // Add wireless charging started sound setting
            if (mUserHandle == UserHandle.USER_SYSTEM) {
                db.beginTransaction();
                SQLiteStatement stmt = null;
                try {
                    stmt = db.compileStatement("INSERT OR REPLACE INTO global(name,value)"
                            + " VALUES(?,?);");
                    loadStringSetting(stmt, Settings.Global.CHARGING_STARTED_SOUND,
                            R.string.def_wireless_charging_started_sound);
                    db.setTransactionSuccessful();
                } finally {
                    db.endTransaction();
                    if (stmt != null) stmt.close();
                }
            }
            // charging sound moved to SettingsProvider version 184
            upgradeVersion = 95;
        }

@@ -2562,8 +2548,6 @@ class DatabaseHelper extends SQLiteOpenHelper {
                    R.string.def_car_dock_sound);
            loadStringSetting(stmt, Settings.Global.CAR_UNDOCK_SOUND,
                    R.string.def_car_undock_sound);
            loadStringSetting(stmt, Settings.Global.CHARGING_STARTED_SOUND,
                    R.string.def_wireless_charging_started_sound);

            loadIntegerSetting(stmt, Settings.Global.DOCK_AUDIO_MEDIA_ENABLED,
                    R.integer.def_dock_audio_media_enabled);
Loading