Loading src/com/android/server/telecom/AsyncRingtonePlayer.java +15 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.Message; import android.provider.Settings; import android.telephony.TelephonyManager; import com.android.internal.util.Preconditions; Loading @@ -47,6 +48,12 @@ class AsyncRingtonePlayer { /** The current ringtone. Only used by the ringtone thread. */ private Ringtone mRingtone; private int mPhoneId = 0; void setPhoneId(int phoneId) { mPhoneId = phoneId; } /** * The context. */ Loading Loading @@ -192,8 +199,15 @@ class AsyncRingtonePlayer { private Ringtone getRingtone(Uri ringtoneUri) { if (ringtoneUri == null) { if (TelephonyManager.getDefault().isMultiSimEnabled()) { ringtoneUri = RingtoneManager.getActualRingtoneUriBySubId(mContext, mPhoneId); if (ringtoneUri == null) { return null; } } else { ringtoneUri = Settings.System.DEFAULT_RINGTONE_URI; } } Ringtone ringtone = RingtoneManager.getRingtone(mContext, ringtoneUri); ringtone.setStreamType(AudioManager.STREAM_RING); Loading src/com/android/server/telecom/Ringer.java +4 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.SystemVibrator; import android.os.Vibrator; import android.provider.Settings; import android.telecom.CallState; import android.telephony.SubscriptionManager; import java.util.LinkedList; import java.util.List; Loading Loading @@ -189,6 +190,9 @@ final class Ringer extends CallsManagerListenerBase { // call (for the purposes of direct-to-voicemail), the information about custom // ringtones should be available by the time this code executes. We can safely // request the custom ringtone from the call and expect it to be current. int phoneId = SubscriptionManager.getPhoneId(Long.valueOf( foregroundCall.getTargetPhoneAccount().getId())); mRingtonePlayer.setPhoneId(phoneId); mRingtonePlayer.play(foregroundCall.getRingtone()); } else { Log.v(this, "startRingingOrCallWaiting, skipping because volume is 0"); Loading Loading
src/com/android/server/telecom/AsyncRingtonePlayer.java +15 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.Message; import android.provider.Settings; import android.telephony.TelephonyManager; import com.android.internal.util.Preconditions; Loading @@ -47,6 +48,12 @@ class AsyncRingtonePlayer { /** The current ringtone. Only used by the ringtone thread. */ private Ringtone mRingtone; private int mPhoneId = 0; void setPhoneId(int phoneId) { mPhoneId = phoneId; } /** * The context. */ Loading Loading @@ -192,8 +199,15 @@ class AsyncRingtonePlayer { private Ringtone getRingtone(Uri ringtoneUri) { if (ringtoneUri == null) { if (TelephonyManager.getDefault().isMultiSimEnabled()) { ringtoneUri = RingtoneManager.getActualRingtoneUriBySubId(mContext, mPhoneId); if (ringtoneUri == null) { return null; } } else { ringtoneUri = Settings.System.DEFAULT_RINGTONE_URI; } } Ringtone ringtone = RingtoneManager.getRingtone(mContext, ringtoneUri); ringtone.setStreamType(AudioManager.STREAM_RING); Loading
src/com/android/server/telecom/Ringer.java +4 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.SystemVibrator; import android.os.Vibrator; import android.provider.Settings; import android.telecom.CallState; import android.telephony.SubscriptionManager; import java.util.LinkedList; import java.util.List; Loading Loading @@ -189,6 +190,9 @@ final class Ringer extends CallsManagerListenerBase { // call (for the purposes of direct-to-voicemail), the information about custom // ringtones should be available by the time this code executes. We can safely // request the custom ringtone from the call and expect it to be current. int phoneId = SubscriptionManager.getPhoneId(Long.valueOf( foregroundCall.getTargetPhoneAccount().getId())); mRingtonePlayer.setPhoneId(phoneId); mRingtonePlayer.play(foregroundCall.getRingtone()); } else { Log.v(this, "startRingingOrCallWaiting, skipping because volume is 0"); Loading