Loading res/values/config.xml +0 −5 Original line number Diff line number Diff line Loading @@ -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> Loading src/com/android/server/telecom/AsyncRingtonePlayer.java +6 −58 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 Loading Loading @@ -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; Loading Loading @@ -241,11 +218,6 @@ 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."); Loading @@ -253,31 +225,11 @@ public class AsyncRingtonePlayer { } 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. */ Loading @@ -292,10 +244,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 { Loading src/com/android/server/telecom/components/TelecomService.java +1 −3 Original line number Diff line number Diff line Loading @@ -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, Loading Loading @@ -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, Loading Loading
res/values/config.xml +0 −5 Original line number Diff line number Diff line Loading @@ -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> Loading
src/com/android/server/telecom/AsyncRingtonePlayer.java +6 −58 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 Loading Loading @@ -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; Loading Loading @@ -241,11 +218,6 @@ 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."); Loading @@ -253,31 +225,11 @@ public class AsyncRingtonePlayer { } 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. */ Loading @@ -292,10 +244,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 { Loading
src/com/android/server/telecom/components/TelecomService.java +1 −3 Original line number Diff line number Diff line Loading @@ -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, Loading Loading @@ -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, Loading