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

Commit cd1a2e3a authored by Josh Guilfoyle's avatar Josh Guilfoyle
Browse files

ESPRESSO-182: Fixed theme ringtone from playing back during incoming call.

This issue was two part: one, the check for the package resources
provider authority was in the wrong place (needed to be in
openAssetFile, not openFile).  And two, the openAssetFile implementation
was calling openFileDescriptor and wrapping, preventing actual asset fds
from working properly.

CR: Ed Carrigan
parent 65fae351
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -191,7 +191,10 @@ public class RingtoneManager {
    public static final String EXTRA_RINGTONE_PICKED_URI =
            "android.intent.extra.ringtone.PICKED_URI";
    
    static final String THEME_AUTHORITY = "com.tmobile.thememanager.packageresources";
    /**
     * @hide
     */
    public static final String THEME_AUTHORITY = "com.tmobile.thememanager.packageresources";

    // Make sure the column ordering and then ..._COLUMN_INDEX are in sync
    
+4 −6
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import android.util.Log;
public class SettingsProvider extends ContentProvider {
    private static final String TAG = "SettingsProvider";
    private static final boolean LOCAL_LOGV = false;
    private static String EXTRA_AUTHORITY = "com.tmobile.thememanager.packageresources";

    private static final String TABLE_FAVORITES = "favorites";
    private static final String TABLE_OLD_FAVORITES = "old_favorites";
@@ -406,7 +405,7 @@ public class SettingsProvider extends ContentProvider {
                String authority = soundUri.getAuthority();
                boolean isDrmAuthority = authority.equals(DrmStore.AUTHORITY);
                if (isDrmAuthority || authority.equals(MediaStore.AUTHORITY) ||
                        (EXTRA_AUTHORITY != null && authority.equals(EXTRA_AUTHORITY))) {
                        authority.equals(RingtoneManager.THEME_AUTHORITY)) {

                    if (isDrmAuthority) {
                        try {
@@ -447,7 +446,8 @@ public class SettingsProvider extends ContentProvider {
                // Only proxy the openFile call to drm or media providers
                String authority = soundUri.getAuthority();
                boolean isDrmAuthority = authority.equals(DrmStore.AUTHORITY);
                if (isDrmAuthority || authority.equals(MediaStore.AUTHORITY)) {
                if (isDrmAuthority || authority.equals(MediaStore.AUTHORITY) ||
                        authority.equals(RingtoneManager.THEME_AUTHORITY)) {

                    if (isDrmAuthority) {
                        try {
@@ -460,10 +460,8 @@ public class SettingsProvider extends ContentProvider {
                        }
                    }

                    ParcelFileDescriptor pfd = null;
                    try {
                        pfd = context.getContentResolver().openFileDescriptor(soundUri, mode);
                        return new AssetFileDescriptor(pfd, 0, -1);
                        return context.getContentResolver().openAssetFileDescriptor(soundUri, mode);
                    } catch (FileNotFoundException ex) {
                        // fall through and open the fallback ringtone below
                    }