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

Unverified Commit 6dd29186 authored by Han Wang's avatar Han Wang Committed by Michael Bestas
Browse files

power: Keep file scheme when not using content URI

 * Settings.Global.CHARGING_STARTED_SOUND and
   Settings.Global.WIRELESS_CHARGING_STARTED_SOUND are
   in old format and do not use content URI.

   Therefore, we should preserve AOSP logic and prefix sound URI path
   with "file://" or there will be warnings like this:

     W MediaPlayer: java.io.FileNotFoundException: No content provider: /system/product/media/audio/ui/WirelessChargingStarted.ogg

   If users have changed charging sound at some point, then it is fine,
   because we have switched to content URI.

Change-Id: I63bdbe1003390310facbb50175e961129ecb3118
parent 876b513f
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1160,8 +1160,11 @@ public class Notifier {
                return;
            }

            final Uri soundUri = Uri.parse("file://" + soundPath);
            Uri soundUri = Uri.parse(soundPath);
            if (soundUri != null) {
                if (!soundUri.isAbsolute()) {
                    soundUri = Uri.parse("file://" + soundPath);
                }
                final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri);
                if (sfx != null) {
                    sfx.setStreamType(AudioManager.STREAM_SYSTEM);