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

@@ -63,7 +63,7 @@ public abstract class Conference implements Conferenceable {
Collections.unmodifiableList(mConferenceableConnections);
private PhoneAccountHandle mPhoneAccount;
private AudioState mAudioState;
private CallAudioState mCallAudioState;
private int mState = Connection.STATE_NEW;
private DisconnectCause mDisconnectCause;
private int mConnectionCapabilities;
@@ -173,9 +173,22 @@ public abstract class Conference implements Conferenceable {
* @return The audio state of the conference, describing how its audio is currently
* being routed by the system. This is {@code null} if this Conference
* does not directly know about its audio state.
* @deprecated Use {@link #getCallAudioState()} instead.
* @hide
*/
@Deprecated
@SystemApi
public final AudioState getAudioState() {
return mAudioState;
return new AudioState(mCallAudioState);
}
/**
* @return The audio state of the conference, describing how its audio is currently
* being routed by the system. This is {@code null} if this Conference
* does not directly know about its audio state.
*/
public final CallAudioState getCallAudioState() {
return mCallAudioState;
}
/**
@@ -249,9 +262,20 @@ public abstract class Conference implements Conferenceable {
* Notifies this conference that the {@link #getAudioState()} property has a new value.
*
* @param state The new call audio state.
* @deprecated Use {@link #onCallAudioStateChanged(CallAudioState)} instead.
* @hide
*/
@SystemApi
@Deprecated
public void onAudioStateChanged(AudioState state) {}
/**
* Notifies this conference that the {@link #getCallAudioState()} property has a new value.
*
* @param state The new call audio state.
*/
public void onCallAudioStateChanged(CallAudioState state) {}
/**
* Notifies this conference that a connection has been added to it.
*
@@ -515,10 +539,11 @@ public abstract class Conference implements Conferenceable {
* @param state The new audio state.
* @hide
*/
final void setAudioState(AudioState state) {
Log.d(this, "setAudioState %s", state);
mAudioState = state;
onAudioStateChanged(state);
final void setCallAudioState(CallAudioState state) {
Log.d(this, "setCallAudioState %s", state);
mCallAudioState = state;
onAudioStateChanged(getAudioState());
onCallAudioStateChanged(state);
}
private void setState(int newState) {