diff options
| -rw-r--r-- | res/values/config.xml | 5 | ||||
| -rw-r--r-- | src/com/android/server/telecom/AsyncRingtonePlayer.java | 64 | ||||
| -rw-r--r-- | src/com/android/server/telecom/components/TelecomService.java | 4 |
3 files changed, 7 insertions, 66 deletions
diff --git a/res/values/config.xml b/res/values/config.xml index 5b9636d50..9cbbf46cd 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -53,11 +53,6 @@ Devices should overlay this value based on the type of vibration hardware they employ. --> <bool name="use_simple_vibration_pattern">false</bool> - <!-- When true, if Telecom is playing the ringtone, it will attempt to pause for some time - between repeats of the ringtone. - When false, the ringtone will be looping with no pause. --> - <bool name="should_pause_between_ringtone_repeats">true</bool> - <!-- Threshold for the X+Y component of gravity needed for the device orientation to be classified as being on a user's ear. --> <item name="device_on_ear_xy_gravity_threshold" format="float" type="dimen">5.5</item> diff --git a/src/com/android/server/telecom/AsyncRingtonePlayer.java b/src/com/android/server/telecom/AsyncRingtonePlayer.java index 93041c856..53c5f071d 100644 --- a/src/com/android/server/telecom/AsyncRingtonePlayer.java +++ b/src/com/android/server/telecom/AsyncRingtonePlayer.java @@ -43,10 +43,6 @@ public class AsyncRingtonePlayer { // Message codes used with the ringtone thread. private static final int EVENT_PLAY = 1; private static final int EVENT_STOP = 2; - private static final int EVENT_REPEAT = 3; - - // The interval in which to restart the ringer. - private static final int RESTART_RINGER_MILLIS = 3000; /** Handler running on the ringtone thread. */ private Handler mHandler; @@ -60,26 +56,10 @@ public class AsyncRingtonePlayer { */ private CompletableFuture<Boolean> mHapticsFuture = null; - /** - * Determines if the {@link AsyncRingtonePlayer} should pause between repeats of the ringtone. - * When {@code true}, the system will check if the ringtone has stopped every - * {@link #RESTART_RINGER_MILLIS} and restart the ringtone if it has stopped. This does not - * guarantee that there is {@link #RESTART_RINGER_MILLIS} between each repeat of the ringtone, - * rather it ensures that for short ringtones, or ringtones which are not a multiple of - * {@link #RESTART_RINGER_MILLIS} in duration that there will be some pause between repetitions. - * When {@code false}, the ringtone will be looped continually with no attempt to pause between - * repeats. - */ - private boolean mShouldPauseBetweenRepeat = true; - public AsyncRingtonePlayer() { // Empty } - public AsyncRingtonePlayer(boolean shouldPauseBetweenRepeat) { - mShouldPauseBetweenRepeat = shouldPauseBetweenRepeat; - } - /** * Plays the appropriate ringtone for the specified call. * If {@link VolumeShaper.Configuration} is specified, it is applied to the ringtone to change @@ -156,9 +136,6 @@ public class AsyncRingtonePlayer { case EVENT_PLAY: handlePlay((SomeArgs) msg.obj); break; - case EVENT_REPEAT: - handleRepeat(); - break; case EVENT_STOP: handleStop(); break; @@ -242,43 +219,18 @@ public class AsyncRingtonePlayer { } } - if (mShouldPauseBetweenRepeat) { - // We're trying to pause between repeats, so the ringtone will not intentionally loop. - // Instead, we'll use a handler message to perform repeats. - handleRepeat(); - } else { - mRingtone.setLooping(true); - if (mRingtone.isPlaying()) { - Log.d(this, "Ringtone already playing."); - return; - } - mRingtone.play(); - Log.i(this, "Play ringtone, looping."); + mRingtone.setLooping(true); + if (mRingtone.isPlaying()) { + Log.d(this, "Ringtone already playing."); + return; } + mRingtone.play(); + Log.i(this, "Play ringtone, looping."); } finally { Log.cancelSubsession(session); } } - private void handleRepeat() { - if (mRingtone == null) { - return; - } - if (mRingtone.isPlaying()) { - Log.d(this, "Ringtone already playing."); - } else { - mRingtone.play(); - Log.i(this, "Repeat ringtone."); - } - - // Repost event to restart ringer in {@link RESTART_RINGER_MILLIS}. - synchronized(this) { - if (!mHandler.hasMessages(EVENT_REPEAT)) { - mHandler.sendEmptyMessageDelayed(EVENT_REPEAT, RESTART_RINGER_MILLIS); - } - } - } - /** * Stops the playback of the ringtone. Executes on the ringtone-thread. */ @@ -293,10 +245,6 @@ public class AsyncRingtonePlayer { } synchronized(this) { - // At the time that STOP is handled, there should be no need for repeat messages in the - // queue. - mHandler.removeMessages(EVENT_REPEAT); - if (mHandler.hasMessages(EVENT_PLAY)) { Log.v(this, "Keeping alive ringtone thread for subsequent play request."); } else { diff --git a/src/com/android/server/telecom/components/TelecomService.java b/src/com/android/server/telecom/components/TelecomService.java index 2acc54842..e20da809d 100644 --- a/src/com/android/server/telecom/components/TelecomService.java +++ b/src/com/android/server/telecom/components/TelecomService.java @@ -90,8 +90,6 @@ public class TelecomService extends Service implements TelecomSystem.Component { new NotificationChannelManager(); notificationChannelManager.createChannels(context); - boolean shouldPauseBetweenRingtoneRepeat = context.getResources().getBoolean( - R.bool.should_pause_between_ringtone_repeats); TelecomSystem.setInstance( new TelecomSystem( context, @@ -173,7 +171,7 @@ public class TelecomService extends Service implements TelecomSystem.Component { }, ConnectionServiceFocusManager::new, new Timeouts.Adapter(), - new AsyncRingtonePlayer(shouldPauseBetweenRingtoneRepeat), + new AsyncRingtonePlayer(), new PhoneNumberUtilsAdapterImpl(), new IncomingCallNotifier(context), ToneGenerator::new, |
