diff options
Diffstat (limited to 'java/com/android/incallui/ringtone')
-rw-r--r-- | java/com/android/incallui/ringtone/DialerRingtoneManager.java | 24 | ||||
-rw-r--r-- | java/com/android/incallui/ringtone/InCallTonePlayer.java | 36 |
2 files changed, 30 insertions, 30 deletions
diff --git a/java/com/android/incallui/ringtone/DialerRingtoneManager.java b/java/com/android/incallui/ringtone/DialerRingtoneManager.java index 5ebd93378..49badf575 100644 --- a/java/com/android/incallui/ringtone/DialerRingtoneManager.java +++ b/java/com/android/incallui/ringtone/DialerRingtoneManager.java @@ -38,9 +38,9 @@ public class DialerRingtoneManager { * Once we're ready to enable Dialer Ringing, these flags should be removed. */ private static final boolean IS_DIALER_RINGING_ENABLED = false; - private final InCallTonePlayer mInCallTonePlayer; - private final CallList mCallList; - private Boolean mIsDialerRingingEnabledForTesting; + private final InCallTonePlayer inCallTonePlayer; + private final CallList callList; + private Boolean isDialerRingingEnabledForTesting; /** * Creates the DialerRingtoneManager with the given {@link InCallTonePlayer}. @@ -51,8 +51,8 @@ public class DialerRingtoneManager { */ public DialerRingtoneManager( @NonNull InCallTonePlayer inCallTonePlayer, @NonNull CallList callList) { - mInCallTonePlayer = Objects.requireNonNull(inCallTonePlayer); - mCallList = Objects.requireNonNull(callList); + this.inCallTonePlayer = Objects.requireNonNull(inCallTonePlayer); + this.callList = Objects.requireNonNull(callList); } /** @@ -88,13 +88,13 @@ public class DialerRingtoneManager { if (callState != State.INCOMING) { return callState; } - return mCallList.getActiveCall() == null ? State.INCOMING : State.CALL_WAITING; + return callList.getActiveCall() == null ? State.INCOMING : State.CALL_WAITING; } private boolean isDialerRingingEnabled() { boolean enabledFlag = - mIsDialerRingingEnabledForTesting != null - ? mIsDialerRingingEnabledForTesting + isDialerRingingEnabledForTesting != null + ? isDialerRingingEnabledForTesting : IS_DIALER_RINGING_ENABLED; return VERSION.SDK_INT >= VERSION_CODES.N && enabledFlag; } @@ -109,7 +109,7 @@ public class DialerRingtoneManager { public boolean shouldPlayCallWaitingTone(int callState) { return isDialerRingingEnabled() && translateCallStateForCallWaiting(callState) == State.CALL_WAITING - && !mInCallTonePlayer.isPlayingTone(); + && !inCallTonePlayer.isPlayingTone(); } /** Plays the call waiting tone. */ @@ -117,7 +117,7 @@ public class DialerRingtoneManager { if (!isDialerRingingEnabled()) { return; } - mInCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING); + inCallTonePlayer.play(InCallTonePlayer.TONE_CALL_WAITING); } /** Stops playing the call waiting tone. */ @@ -125,10 +125,10 @@ public class DialerRingtoneManager { if (!isDialerRingingEnabled()) { return; } - mInCallTonePlayer.stop(); + inCallTonePlayer.stop(); } void setDialerRingingEnabledForTesting(boolean status) { - mIsDialerRingingEnabledForTesting = status; + isDialerRingingEnabledForTesting = status; } } diff --git a/java/com/android/incallui/ringtone/InCallTonePlayer.java b/java/com/android/incallui/ringtone/InCallTonePlayer.java index c76b41d72..dac244d22 100644 --- a/java/com/android/incallui/ringtone/InCallTonePlayer.java +++ b/java/com/android/incallui/ringtone/InCallTonePlayer.java @@ -36,9 +36,9 @@ public class InCallTonePlayer { public static final int VOLUME_RELATIVE_HIGH_PRIORITY = 80; - @NonNull private final ToneGeneratorFactory mToneGeneratorFactory; - @NonNull private final PausableExecutor mExecutor; - private @Nullable CountDownLatch mNumPlayingTones; + @NonNull private final ToneGeneratorFactory toneGeneratorFactory; + @NonNull private final PausableExecutor executor; + private @Nullable CountDownLatch numPlayingTones; /** * Creates a new InCallTonePlayer. @@ -51,13 +51,13 @@ public class InCallTonePlayer { */ public InCallTonePlayer( @NonNull ToneGeneratorFactory toneGeneratorFactory, @NonNull PausableExecutor executor) { - mToneGeneratorFactory = Objects.requireNonNull(toneGeneratorFactory); - mExecutor = Objects.requireNonNull(executor); + this.toneGeneratorFactory = Objects.requireNonNull(toneGeneratorFactory); + this.executor = Objects.requireNonNull(executor); } /** @return {@code true} if a tone is currently playing, {@code false} otherwise. */ public boolean isPlayingTone() { - return mNumPlayingTones != null && mNumPlayingTones.getCount() > 0; + return numPlayingTones != null && numPlayingTones.getCount() > 0; } /** @@ -72,8 +72,8 @@ public class InCallTonePlayer { throw new IllegalStateException("Tone already playing"); } final ToneGeneratorInfo info = getToneGeneratorInfo(tone); - mNumPlayingTones = new CountDownLatch(1); - mExecutor.execute( + numPlayingTones = new CountDownLatch(1); + executor.execute( new Runnable() { @Override public void run() { @@ -106,17 +106,17 @@ public class InCallTonePlayer { ToneGenerator toneGenerator = null; try { Log.v(this, "Starting tone " + info); - toneGenerator = mToneGeneratorFactory.newInCallToneGenerator(info.stream, info.volume); + toneGenerator = toneGeneratorFactory.newInCallToneGenerator(info.stream, info.volume); toneGenerator.startTone(info.tone); /* * During tests, this will block until the tests call mExecutor.ackMilestone. This call * allows for synchronization to the point where the tone has started playing. */ - mExecutor.milestone(); - if (mNumPlayingTones != null) { - mNumPlayingTones.await(info.toneLengthMillis, TimeUnit.MILLISECONDS); + executor.milestone(); + if (numPlayingTones != null) { + numPlayingTones.await(info.toneLengthMillis, TimeUnit.MILLISECONDS); // Allows for synchronization to the point where the tone has completed playing. - mExecutor.milestone(); + executor.milestone(); } } catch (InterruptedException e) { Log.w(this, "Interrupted while playing in-call tone."); @@ -124,18 +124,18 @@ public class InCallTonePlayer { if (toneGenerator != null) { toneGenerator.release(); } - if (mNumPlayingTones != null) { - mNumPlayingTones.countDown(); + if (numPlayingTones != null) { + numPlayingTones.countDown(); } // Allows for synchronization to the point where this background thread has cleaned up. - mExecutor.milestone(); + executor.milestone(); } } /** Stops playback of the current tone. */ public void stop() { - if (mNumPlayingTones != null) { - mNumPlayingTones.countDown(); + if (numPlayingTones != null) { + numPlayingTones.countDown(); } } |