* commit '3fa46d4e13f21d982db63402ad89f5fe0ce6cc36': Add setting to mute wireless charging sound.
This commit is contained in:
@@ -5950,6 +5950,12 @@ public final class Settings {
|
|||||||
public static final String WIRELESS_CHARGING_STARTED_SOUND =
|
public static final String WIRELESS_CHARGING_STARTED_SOUND =
|
||||||
"wireless_charging_started_sound";
|
"wireless_charging_started_sound";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to play a sound for charging events.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether we keep the device on while the device is plugged in.
|
* Whether we keep the device on while the device is plugged in.
|
||||||
* Supported values are:
|
* Supported values are:
|
||||||
|
|||||||
@@ -539,9 +539,11 @@ final class Notifier {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private void playWirelessChargingStartedSound() {
|
private void playWirelessChargingStartedSound() {
|
||||||
|
final boolean enabled = Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.Global.CHARGING_SOUNDS_ENABLED, 1) != 0;
|
||||||
final String soundPath = Settings.Global.getString(mContext.getContentResolver(),
|
final String soundPath = Settings.Global.getString(mContext.getContentResolver(),
|
||||||
Settings.Global.WIRELESS_CHARGING_STARTED_SOUND);
|
Settings.Global.WIRELESS_CHARGING_STARTED_SOUND);
|
||||||
if (soundPath != null) {
|
if (enabled && soundPath != null) {
|
||||||
final Uri soundUri = Uri.parse("file://" + soundPath);
|
final Uri soundUri = Uri.parse("file://" + soundPath);
|
||||||
if (soundUri != null) {
|
if (soundUri != null) {
|
||||||
final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
|
final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
|
||||||
|
|||||||
Reference in New Issue
Block a user