mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2025-01-22 21:31:15 -05:00
af360bc9ea
wgetc873988898
.patch -O telecomm-01.patch wget0fb5786dbf
.patch -O mediaprovider-01.patch wget1a4b9ef510
.patch -O wifi-01.patch wget364a1d9962
.patch -O bluetooth-01.patch wget87a06448b9
.patch -O settings-01.patch wgetaaba724a68
.patch -O settings-02.patch wget507304e1f5
.patch -O native-01.patch wget89489ff5dd
.patch -O base-01.patch wgetd1765c4715
.patch -O base-02.patch wgetcbb1a0ecd6
.patch -O base-03.patch wget4725772c0b
.patch -O base-04.patch wget19747f6923
.patch -O base-05.patch wgete7a1aa9ed0
.patch -O base-06.patch wget922a7860b1
.patch -O base-07.patch wgeted183ed912
.patch -O base-08.patch wgetc6fbe1330a
.patch -O base-09.patch wget9141cac175
.patch -O base-10.patch wget41235bcc67
.patch -O av-01.patch wgeta89f704701
.patch -O av-02.patch wget6d7cd80d77
.patch -O av-03.patch wget75fc175a08
.patch -O av-04.patch wgetb023ec300f
.patch -O av-05.patch wgetc8117d1539
.patch -O av-06.patch wgetf06d23d824
.patch -O av-07.patch wget9c7408ab07
.patch -O av-08.patch wgetcfbfcefb3c
.patch -O launcher-01.patch wget4a27a7f162
.patch -O libxml-01.patch Signed-off-by: Tad <tad@spotco.us>
61 lines
2.7 KiB
Diff
61 lines
2.7 KiB
Diff
From 89489ff5dd9b7717f0421ca4e90bc060af1ba8b7 Mon Sep 17 00:00:00 2001
|
|
From: Jean-Michel Trivi <jmtrivi@google.com>
|
|
Date: Wed, 7 Dec 2022 04:36:46 +0000
|
|
Subject: [PATCH] RingtoneManager: verify default ringtone is audio
|
|
|
|
When a ringtone picker tries to set a ringtone through
|
|
RingtoneManager.setActualDefaultRingtoneUri (also
|
|
called by com.android.settings.DefaultRingtonePreference),
|
|
verify the mimeType can be obtained (not found when caller
|
|
doesn't have access to it) and it is an audio resource.
|
|
|
|
Bug: 205837340
|
|
Test: atest android.media.audio.cts.RingtoneManagerTest
|
|
(cherry picked from commit 38618f9fb16d3b5617e2289354d47abe5af17dad)
|
|
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:b8c2d03b720f0cc200ac59f6cfb411fddc3b119c)
|
|
Merged-In: I3f2c487ded405c0c1a83ef0a2fe99cff7cc9328e
|
|
Change-Id: I3f2c487ded405c0c1a83ef0a2fe99cff7cc9328e
|
|
---
|
|
media/java/android/media/RingtoneManager.java | 19 +++++++++++++++++--
|
|
1 file changed, 17 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/media/java/android/media/RingtoneManager.java b/media/java/android/media/RingtoneManager.java
|
|
index 27db41cb9f4e..d3c3c370a641 100644
|
|
--- a/media/java/android/media/RingtoneManager.java
|
|
+++ b/media/java/android/media/RingtoneManager.java
|
|
@@ -814,10 +814,10 @@ public static Uri getActualDefaultRingtoneUri(Context context, int type) {
|
|
|
|
return ringtoneUri;
|
|
}
|
|
-
|
|
+
|
|
/**
|
|
* Sets the {@link Uri} of the default sound for a given sound type.
|
|
- *
|
|
+ *
|
|
* @param context A context used for querying.
|
|
* @param type The type whose default sound should be set. One of
|
|
* {@link #TYPE_RINGTONE}, {@link #TYPE_NOTIFICATION}, or
|
|
@@ -833,6 +833,21 @@ public static void setActualDefaultRingtoneUri(Context context, int type, Uri ri
|
|
if(!isInternalRingtoneUri(ringtoneUri)) {
|
|
ringtoneUri = ContentProvider.maybeAddUserId(ringtoneUri, context.getUserId());
|
|
}
|
|
+
|
|
+ if (ringtoneUri != null) {
|
|
+ final String mimeType = resolver.getType(ringtoneUri);
|
|
+ if (mimeType == null) {
|
|
+ Log.e(TAG, "setActualDefaultRingtoneUri for URI:" + ringtoneUri
|
|
+ + " ignored: failure to find mimeType (no access from this context?)");
|
|
+ return;
|
|
+ }
|
|
+ if (!(mimeType.startsWith("audio/") || mimeType.equals("application/ogg"))) {
|
|
+ Log.e(TAG, "setActualDefaultRingtoneUri for URI:" + ringtoneUri
|
|
+ + " ignored: associated mimeType:" + mimeType + " is not an audio type");
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+
|
|
Settings.System.putStringForUser(resolver, setting,
|
|
ringtoneUri != null ? ringtoneUri.toString() : null, context.getUserId());
|
|
|