Loading src/com/android/server/telecom/Call.java +1 −2 Original line number Diff line number Diff line Loading @@ -3119,8 +3119,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, return Contacts.getLookupUri(mCallerInfo.getContactId(), mCallerInfo.lookupKey); } @VisibleForTesting public Uri getRingtone() { Uri getRingtone() { return mCallerInfo == null ? null : mCallerInfo.contactRingtoneUri; } Loading src/com/android/server/telecom/RingtoneFactory.java +6 −27 Original line number Diff line number Diff line Loading @@ -80,19 +80,13 @@ public class RingtoneFactory { 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. // 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."); } } 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."); } } if (ringtone == null) { // Contact didn't specify ringtone or custom Ringtone creation failed. Get default Loading Loading @@ -126,21 +120,6 @@ public class RingtoneFactory { 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) Loading Loading
src/com/android/server/telecom/Call.java +1 −2 Original line number Diff line number Diff line Loading @@ -3119,8 +3119,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, return Contacts.getLookupUri(mCallerInfo.getContactId(), mCallerInfo.lookupKey); } @VisibleForTesting public Uri getRingtone() { Uri getRingtone() { return mCallerInfo == null ? null : mCallerInfo.contactRingtoneUri; } Loading
src/com/android/server/telecom/RingtoneFactory.java +6 −27 Original line number Diff line number Diff line Loading @@ -80,19 +80,13 @@ public class RingtoneFactory { 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. // 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."); } } 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."); } } if (ringtone == null) { // Contact didn't specify ringtone or custom Ringtone creation failed. Get default Loading Loading @@ -126,21 +120,6 @@ public class RingtoneFactory { 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) Loading