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
This commit is contained in:
Yorke Lee
2015-05-13 14:14:54 -07:00
parent 4201be08a1
commit 4af5935c71
15 changed files with 479 additions and 81 deletions

View File

@@ -90,7 +90,7 @@ public abstract class ConnectionService extends Service {
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 @@ public abstract class ConnectionService extends Service {
}
@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 @@ public abstract class ConnectionService extends Service {
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 @@ public abstract class ConnectionService extends Service {
}
}
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);
}
}