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

Commit 28230632 authored by padarshr's avatar padarshr Committed by Ed Carrigan
Browse files

Provider: Add multi SIM ringtone support in SettingsProvider

This change will handle multi-sim queries in
SettingsProvider.java when openFile and
openAssetFile APIs are called by other components.
Thus, it will ensure to play the correct ringtone
corresponding to the SIM.

CRs-Fixed: 661216
Change-Id: I7b22c233b9c41669c1ad948b83a7aa2c55442af1
parent c0ac4b6a
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -1003,6 +1003,19 @@ public class SettingsProvider extends ContentProvider {
        return count;
    }

    public Uri getCurrentRingtoneUriByType(int ringtoneType, Uri uri) {
        Uri soundUri = null;
        Context context = getContext();
        if (ringtoneType == RingtoneManager.TYPE_RINGTONE) {
            soundUri = RingtoneManager.getActualRingtoneUriBySubId(context,
                    RingtoneManager.getDefaultRingtoneSubIdByUri(uri));
        } else {
            soundUri = RingtoneManager.getActualDefaultRingtoneUri(context,
                    ringtoneType);
        }
        return soundUri;
    }

    @Override
    public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {

@@ -1017,7 +1030,7 @@ public class SettingsProvider extends ContentProvider {
            Context context = getContext();

            // Get the current value for the default sound
            Uri soundUri = RingtoneManager.getActualDefaultRingtoneUri(context, ringtoneType);
            Uri soundUri = getCurrentRingtoneUriByType(ringtoneType,uri);

            if (soundUri != null) {
                // Proxy the openFile call to media provider
@@ -1045,7 +1058,7 @@ public class SettingsProvider extends ContentProvider {
            Context context = getContext();

            // Get the current value for the default sound
            Uri soundUri = RingtoneManager.getActualDefaultRingtoneUri(context, ringtoneType);
            Uri soundUri = getCurrentRingtoneUriByType(ringtoneType,uri);

            if (soundUri != null) {
                // Proxy the openFile call to media provider