Merge "Revert "Resolve cross account user ringtone validation."" into udc-dev am: 84a4532be3
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telecomm/+/31655102
Change-Id: Icde7e70c545878d48772cb6dc3ece00e3650cda0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 0399a80..cf52ce9 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -3119,8 +3119,7 @@
return Contacts.getLookupUri(mCallerInfo.getContactId(), mCallerInfo.lookupKey);
}
- @VisibleForTesting
- public Uri getRingtone() {
+ Uri getRingtone() {
return mCallerInfo == null ? null : mCallerInfo.contactRingtoneUri;
}
diff --git a/src/com/android/server/telecom/RingtoneFactory.java b/src/com/android/server/telecom/RingtoneFactory.java
index 1caa005..6bcfb4c 100644
--- a/src/com/android/server/telecom/RingtoneFactory.java
+++ b/src/com/android/server/telecom/RingtoneFactory.java
@@ -80,18 +80,12 @@
Ringtone ringtone = null;
if (ringtoneUri != null && userContext != null) {
- if (currentUserOwnsRingtone(ringtoneUri, incomingCall)) {
- // Ringtone URI is explicitly specified and owned by the current user - try to
- // create a Ringtone with that.
- try {
- ringtone = RingtoneManager.getRingtone(
- userContext, ringtoneUri, volumeShaperConfig, audioAttrs);
- } catch (Exception e) {
- Log.e(this, e, "getRingtone: exception while getting ringtone.");
- }
- } else {
- Log.w(this, "getRingtone: Failed to verify that the custom ringtone URI"
- + " is owned by the current user. Falling back to the default ringtone.");
+ // Ringtone URI is explicitly specified. First, try to create a Ringtone with that.
+ try {
+ ringtone = RingtoneManager.getRingtone(
+ userContext, ringtoneUri, volumeShaperConfig, audioAttrs);
+ } catch (Exception e) {
+ Log.e(this, e, "getRingtone: exception while getting ringtone.");
}
}
if (ringtone == null) {
@@ -126,21 +120,6 @@
return ringtone;
}
- private static boolean currentUserOwnsRingtone(Uri ringtoneUri, Call incomingCall) {
- if (TextUtils.isEmpty(ringtoneUri.getUserInfo()) ||
- incomingCall.getAssociatedUser() == null) {
- return false;
- }
-
- UserHandle associatedUser = incomingCall.getAssociatedUser();
- if (associatedUser == null) {
- return false;
- }
-
- String currentUserId = String.valueOf(associatedUser.getIdentifier());
- return currentUserId.equals(ringtoneUri.getUserInfo());
- }
-
private AudioAttributes getDefaultRingtoneAudioAttributes(boolean hapticChannelsMuted) {
return new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE)