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
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 13eb016..6b8ca69 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -90,7 +90,7 @@
private static final int MSG_DISCONNECT = 6;
private static final int MSG_HOLD = 7;
private static final int MSG_UNHOLD = 8;
- private static final int MSG_ON_AUDIO_STATE_CHANGED = 9;
+ private static final int MSG_ON_CALL_AUDIO_STATE_CHANGED = 9;
private static final int MSG_PLAY_DTMF_TONE = 10;
private static final int MSG_STOP_DTMF_TONE = 11;
private static final int MSG_CONFERENCE = 12;
@@ -180,11 +180,11 @@
}
@Override
- public void onAudioStateChanged(String callId, AudioState audioState) {
+ public void onCallAudioStateChanged(String callId, CallAudioState callAudioState) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
- args.arg2 = audioState;
- mHandler.obtainMessage(MSG_ON_AUDIO_STATE_CHANGED, args).sendToTarget();
+ args.arg2 = callAudioState;
+ mHandler.obtainMessage(MSG_ON_CALL_AUDIO_STATE_CHANGED, args).sendToTarget();
}
@Override
@@ -304,12 +304,12 @@
case MSG_UNHOLD:
unhold((String) msg.obj);
break;
- case MSG_ON_AUDIO_STATE_CHANGED: {
+ case MSG_ON_CALL_AUDIO_STATE_CHANGED: {
SomeArgs args = (SomeArgs) msg.obj;
try {
String callId = (String) args.arg1;
- AudioState audioState = (AudioState) args.arg2;
- onAudioStateChanged(callId, audioState);
+ CallAudioState audioState = (CallAudioState) args.arg2;
+ onCallAudioStateChanged(callId, new CallAudioState(audioState));
} finally {
args.recycle();
}
@@ -688,12 +688,14 @@
}
}
- private void onAudioStateChanged(String callId, AudioState audioState) {
- Log.d(this, "onAudioStateChanged %s %s", callId, audioState);
+ private void onCallAudioStateChanged(String callId, CallAudioState callAudioState) {
+ Log.d(this, "onAudioStateChanged %s %s", callId, callAudioState);
if (mConnectionById.containsKey(callId)) {
- findConnectionForAction(callId, "onAudioStateChanged").setAudioState(audioState);
+ findConnectionForAction(callId, "onCallAudioStateChanged").setCallAudioState(
+ callAudioState);
} else {
- findConferenceForAction(callId, "onAudioStateChanged").setAudioState(audioState);
+ findConferenceForAction(callId, "onCallAudioStateChanged").setCallAudioState(
+ callAudioState);
}
}