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:
@@ -20,6 +20,7 @@ import com.android.internal.os.SomeArgs;
|
||||
import com.android.internal.telecom.IVideoCallback;
|
||||
import com.android.internal.telecom.IVideoProvider;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
@@ -817,7 +818,7 @@ public abstract class Connection implements Conferenceable {
|
||||
Collections.unmodifiableList(mConferenceables);
|
||||
|
||||
private int mState = STATE_NEW;
|
||||
private AudioState mAudioState;
|
||||
private CallAudioState mCallAudioState;
|
||||
private Uri mAddress;
|
||||
private int mAddressPresentation;
|
||||
private String mCallerDisplayName;
|
||||
@@ -892,9 +893,22 @@ public abstract class Connection implements Conferenceable {
|
||||
* @return The audio state of the connection, describing how its audio is currently
|
||||
* being routed by the system. This is {@code null} if this Connection
|
||||
* does not directly know about its audio state.
|
||||
* @deprecated Use {@link #getCallAudioState()} instead.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@Deprecated
|
||||
public final AudioState getAudioState() {
|
||||
return mAudioState;
|
||||
return new AudioState(mCallAudioState);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The audio state of the connection, describing how its audio is currently
|
||||
* being routed by the system. This is {@code null} if this Connection
|
||||
* does not directly know about its audio state.
|
||||
*/
|
||||
public final CallAudioState getCallAudioState() {
|
||||
return mCallAudioState;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -968,11 +982,12 @@ public abstract class Connection implements Conferenceable {
|
||||
* @param state The new audio state.
|
||||
* @hide
|
||||
*/
|
||||
final void setAudioState(AudioState state) {
|
||||
final void setCallAudioState(CallAudioState state) {
|
||||
checkImmutable();
|
||||
Log.d(this, "setAudioState %s", state);
|
||||
mAudioState = state;
|
||||
onAudioStateChanged(state);
|
||||
mCallAudioState = state;
|
||||
onAudioStateChanged(getAudioState());
|
||||
onCallAudioStateChanged(state);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1359,9 +1374,20 @@ public abstract class Connection implements Conferenceable {
|
||||
* Notifies this Connection that the {@link #getAudioState()} property has a new value.
|
||||
*
|
||||
* @param state The new connection audio state.
|
||||
* @deprecated Use {@link #onCallAudioStateChanged(CallAudioState)} instead.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@Deprecated
|
||||
public void onAudioStateChanged(AudioState state) {}
|
||||
|
||||
/**
|
||||
* Notifies this Connection that the {@link #getCallAudioState()} property has a new value.
|
||||
*
|
||||
* @param state The new connection audio state.
|
||||
*/
|
||||
public void onCallAudioStateChanged(CallAudioState state) {}
|
||||
|
||||
/**
|
||||
* Notifies this Connection of an internal state change. This method is called after the
|
||||
* state is changed.
|
||||
|
||||
Reference in New Issue
Block a user