diff options
Diffstat (limited to 'telecomm/java/android/telecom/Phone.java')
-rw-r--r-- | telecomm/java/android/telecom/Phone.java | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/telecomm/java/android/telecom/Phone.java b/telecomm/java/android/telecom/Phone.java index 4cdfd2e..8eb091b 100644 --- a/telecomm/java/android/telecom/Phone.java +++ b/telecomm/java/android/telecom/Phone.java @@ -41,10 +41,21 @@ public final class Phone { * * @param phone The {@code Phone} calling this method. * @param audioState The new {@link AudioState}. + * + * @deprecated Use {@link #onCallAudioStateChanged(Phone, CallAudioState)} instead. */ + @Deprecated public void onAudioStateChanged(Phone phone, AudioState audioState) { } /** + * Called when the audio state changes. + * + * @param phone The {@code Phone} calling this method. + * @param callAudioState The new {@link CallAudioState}. + */ + public void onCallAudioStateChanged(Phone phone, CallAudioState callAudioState) { } + + /** * Called to bring the in-call screen to the foreground. The in-call experience should * respond immediately by coming to the foreground to inform the user of the state of * ongoing {@code Call}s. @@ -100,7 +111,7 @@ public final class Phone { private final InCallAdapter mInCallAdapter; - private AudioState mAudioState; + private CallAudioState mCallAudioState; private final List<Listener> mListeners = new CopyOnWriteArrayList<>(); @@ -145,10 +156,10 @@ public final class Phone { } } - final void internalAudioStateChanged(AudioState audioState) { - if (!Objects.equals(mAudioState, audioState)) { - mAudioState = audioState; - fireAudioStateChanged(audioState); + final void internalCallAudioStateChanged(CallAudioState callAudioState) { + if (!Objects.equals(mCallAudioState, callAudioState)) { + mCallAudioState = callAudioState; + fireCallAudioStateChanged(callAudioState); } } @@ -271,9 +282,20 @@ public final class Phone { * Obtains the current phone call audio state of the {@code Phone}. * * @return An object encapsulating the audio state. + * @deprecated Use {@link #getCallAudioState()} instead. */ + @Deprecated public final AudioState getAudioState() { - return mAudioState; + return new AudioState(mCallAudioState); + } + + /** + * Obtains the current phone call audio state of the {@code Phone}. + * + * @return An object encapsulating the audio state. + */ + public final CallAudioState getCallAudioState() { + return mCallAudioState; } private void fireCallAdded(Call call) { @@ -288,9 +310,10 @@ public final class Phone { } } - private void fireAudioStateChanged(AudioState audioState) { + private void fireCallAudioStateChanged(CallAudioState audioState) { for (Listener listener : mListeners) { - listener.onAudioStateChanged(this, audioState); + listener.onCallAudioStateChanged(this, audioState); + listener.onAudioStateChanged(this, new AudioState(audioState)); } } |