summaryrefslogtreecommitdiffstats
path: root/telecomm/java/android/telecom/Phone.java
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-05-13 14:14:54 -0700
committerYorke Lee <yorkelee@google.com>2015-05-13 14:58:15 -0700
commit4af5935c71f1e31ef1aec27661c4ef60545a0924 (patch)
treed04fc16471211040e00b7ce66665c461ab0a0dfa /telecomm/java/android/telecom/Phone.java
parent4201be08a1cb1358e7ee30f81927b7c11f477ea3 (diff)
downloadframeworks_base-4af5935c71f1e31ef1aec27661c4ef60545a0924.zip
frameworks_base-4af5935c71f1e31ef1aec27661c4ef60545a0924.tar.gz
frameworks_base-4af5935c71f1e31ef1aec27661c4ef60545a0924.tar.bz2
Rename AudioState to CallAudioState
Deprecate AudioState class and make methods @SystemApi where necessary to minimize impact to SystemApi Replace usages of AudioState inside Telecom sub-systems Fire both onCallAudioStateChanged and onAudioStateChanged callbacks for backward compatibility Support both setAudioState and setCallAudioState for all classes Bug: 21040387 Bug: 21088300 Change-Id: I3ec7b3afdaa344c6d639d1c421f1842d67f7d0f7
Diffstat (limited to 'telecomm/java/android/telecom/Phone.java')
-rw-r--r--telecomm/java/android/telecom/Phone.java39
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));
}
}