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

Commit fd030200 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "RingtoneManager: allow video ringtone URI" into main

parents 58dcbe83 525db8ea
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -921,9 +921,13 @@ public class RingtoneManager {
                        + " ignored: failure to find mimeType (no access from this context?)");
                        + " ignored: failure to find mimeType (no access from this context?)");
                return;
                return;
            }
            }
            if (!(mimeType.startsWith("audio/") || mimeType.equals("application/ogg"))) {
            if (!(mimeType.startsWith("audio/") || mimeType.equals("application/ogg")
                    || mimeType.equals("application/x-flac")
                    // also check for video ringtones
                    || mimeType.startsWith("video/") || mimeType.equals("application/mp4"))) {
                Log.e(TAG, "setActualDefaultRingtoneUri for URI:" + ringtoneUri
                Log.e(TAG, "setActualDefaultRingtoneUri for URI:" + ringtoneUri
                        + " ignored: associated mimeType:" + mimeType + " is not an audio type");
                        + " ignored: associated MIME type:" + mimeType
                        + " is not a recognized audio or video type");
                return;
                return;
            }
            }
        }
        }
+7 −4
Original line number Original line Diff line number Diff line
@@ -1972,7 +1972,7 @@ public class SettingsProvider extends ContentProvider {


        File cacheFile = getCacheFile(name, callingUserId);
        File cacheFile = getCacheFile(name, callingUserId);
        if (cacheFile != null) {
        if (cacheFile != null) {
            if (!isValidAudioUri(name, value)) {
            if (!isValidMediaUri(name, value)) {
                return false;
                return false;
            }
            }
            // Invalidate any relevant cache files
            // Invalidate any relevant cache files
@@ -2031,7 +2031,7 @@ public class SettingsProvider extends ContentProvider {
        return true;
        return true;
    }
    }


    private boolean isValidAudioUri(String name, String uri) {
    private boolean isValidMediaUri(String name, String uri) {
        if (uri != null) {
        if (uri != null) {
            Uri audioUri = Uri.parse(uri);
            Uri audioUri = Uri.parse(uri);
            if (Settings.AUTHORITY.equals(
            if (Settings.AUTHORITY.equals(
@@ -2049,10 +2049,13 @@ public class SettingsProvider extends ContentProvider {
                return false;
                return false;
            }
            }
            if (!(mimeType.startsWith("audio/") || mimeType.equals("application/ogg")
            if (!(mimeType.startsWith("audio/") || mimeType.equals("application/ogg")
                    || mimeType.equals("application/x-flac"))) {
                    || mimeType.equals("application/x-flac")
                    // also check for video ringtones
                    || mimeType.startsWith("video/") || mimeType.equals("application/mp4"))) {
                Slog.e(LOG_TAG,
                Slog.e(LOG_TAG,
                        "mutateSystemSetting for setting: " + name + " URI: " + audioUri
                        "mutateSystemSetting for setting: " + name + " URI: " + audioUri
                        + " ignored: associated mimeType: " + mimeType + " is not an audio type");
                        + " ignored: associated MIME type:" + mimeType
                        + " is not a recognized audio or video type");
                return false;
                return false;
            }
            }
        }
        }