DO NOT MERGE Rename Call*Listener to Call*Callback.

Deprecate the existing Listener methods and interfaces so that they
can be replaced.

Bug: 20160491
Change-Id: I11c104c625b03751f3792fc4367883c18c6e2d54
This commit is contained in:
Andrew Lee
2015-04-15 14:09:50 -07:00
parent 7e24657d07
commit 8eb87f0da8
6 changed files with 130 additions and 89 deletions

View File

@@ -28320,7 +28320,6 @@ package android.telecom {
}
public final class Call {
method public void addListener(android.telecom.Call.Listener);
method public void answer(int);
method public void conference(android.telecom.Call);
method public void disconnect();
@@ -28337,12 +28336,13 @@ package android.telecom {
method public void phoneAccountSelected(android.telecom.PhoneAccountHandle, boolean);
method public void playDtmfTone(char);
method public void postDialContinue(boolean);
method public void registerCallback(android.telecom.Call.Callback);
method public void reject(boolean, java.lang.String);
method public void removeListener(android.telecom.Call.Listener);
method public void splitFromConference();
method public void stopDtmfTone();
method public void swapConference();
method public void unhold();
method public void unregisterCallback(android.telecom.Call.Callback);
field public static final java.lang.String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts";
field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_CONNECTING = 9; // 0x9
@@ -28355,6 +28355,19 @@ package android.telecom {
field public static final int STATE_RINGING = 2; // 0x2
}
public static abstract class Call.Callback {
ctor public Call.Callback();
method public void onCallDestroyed(android.telecom.Call);
method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
method public void onParentChanged(android.telecom.Call, android.telecom.Call);
method public void onPostDialWait(android.telecom.Call, java.lang.String);
method public void onStateChanged(android.telecom.Call, int);
method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
}
public static class Call.Details {
method public static boolean can(int, int);
method public boolean can(int);
@@ -28393,19 +28406,6 @@ package android.telecom {
field public static final int CAPABILITY_WIFI = 65536; // 0x10000
}
public static abstract class Call.Listener {
ctor public Call.Listener();
method public void onCallDestroyed(android.telecom.Call);
method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
method public void onParentChanged(android.telecom.Call, android.telecom.Call);
method public void onPostDialWait(android.telecom.Call, java.lang.String);
method public void onStateChanged(android.telecom.Call, int);
method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
}
public class CallProperties {
ctor public CallProperties();
field public static final int CONFERENCE = 1; // 0x1
@@ -28655,7 +28655,7 @@ package android.telecom {
public static abstract class InCallService.VideoCall {
ctor public InCallService.VideoCall();
method public abstract void removeVideoCallListener();
method public abstract void registerCallback(android.telecom.InCallService.VideoCall.Callback);
method public abstract void requestCallDataUsage();
method public abstract void requestCameraCapabilities();
method public abstract void sendSessionModifyRequest(android.telecom.VideoProfile);
@@ -28665,12 +28665,12 @@ package android.telecom {
method public abstract void setDisplaySurface(android.view.Surface);
method public abstract void setPauseImage(java.lang.String);
method public abstract void setPreviewSurface(android.view.Surface);
method public abstract void setVideoCallListener(android.telecom.InCallService.VideoCall.Listener);
method public abstract void setZoom(float);
method public abstract void unregisterCallback();
}
public static abstract class InCallService.VideoCall.Listener {
ctor public InCallService.VideoCall.Listener();
public static abstract class InCallService.VideoCall.Callback {
ctor public InCallService.VideoCall.Callback();
method public abstract void onCallDataUsageChanged(long);
method public abstract void onCallSessionEvent(int);
method public abstract void onCameraCapabilitiesChanged(android.telecom.CameraCapabilities);

View File

@@ -30136,7 +30136,7 @@ package android.telecom {
}
public final class Call {
method public void addListener(android.telecom.Call.Listener);
method public deprecated void addListener(android.telecom.Call.Listener);
method public void answer(int);
method public void conference(android.telecom.Call);
method public void disconnect();
@@ -30153,12 +30153,14 @@ package android.telecom {
method public void phoneAccountSelected(android.telecom.PhoneAccountHandle, boolean);
method public void playDtmfTone(char);
method public void postDialContinue(boolean);
method public void registerCallback(android.telecom.Call.Callback);
method public void reject(boolean, java.lang.String);
method public void removeListener(android.telecom.Call.Listener);
method public deprecated void removeListener(android.telecom.Call.Listener);
method public void splitFromConference();
method public void stopDtmfTone();
method public void swapConference();
method public void unhold();
method public void unregisterCallback(android.telecom.Call.Callback);
field public static final java.lang.String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts";
field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_CONNECTING = 9; // 0x9
@@ -30171,6 +30173,19 @@ package android.telecom {
field public static final int STATE_RINGING = 2; // 0x2
}
public static abstract class Call.Callback {
ctor public Call.Callback();
method public void onCallDestroyed(android.telecom.Call);
method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
method public void onParentChanged(android.telecom.Call, android.telecom.Call);
method public void onPostDialWait(android.telecom.Call, java.lang.String);
method public void onStateChanged(android.telecom.Call, int);
method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
}
public static class Call.Details {
method public static boolean can(int, int);
method public boolean can(int);
@@ -30209,17 +30224,8 @@ package android.telecom {
field public static final int CAPABILITY_WIFI = 65536; // 0x10000
}
public static abstract class Call.Listener {
public static abstract deprecated class Call.Listener extends android.telecom.Call.Callback {
ctor public Call.Listener();
method public void onCallDestroyed(android.telecom.Call);
method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
method public void onParentChanged(android.telecom.Call, android.telecom.Call);
method public void onPostDialWait(android.telecom.Call, java.lang.String);
method public void onStateChanged(android.telecom.Call, int);
method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
}
public class CallProperties {
@@ -30474,7 +30480,7 @@ package android.telecom {
public static abstract class InCallService.VideoCall {
ctor public InCallService.VideoCall();
method public abstract void removeVideoCallListener();
method public abstract void registerCallback(android.telecom.InCallService.VideoCall.Callback);
method public abstract void requestCallDataUsage();
method public abstract void requestCameraCapabilities();
method public abstract void sendSessionModifyRequest(android.telecom.VideoProfile);
@@ -30484,12 +30490,12 @@ package android.telecom {
method public abstract void setDisplaySurface(android.view.Surface);
method public abstract void setPauseImage(java.lang.String);
method public abstract void setPreviewSurface(android.view.Surface);
method public abstract void setVideoCallListener(android.telecom.InCallService.VideoCall.Listener);
method public abstract void setZoom(float);
method public abstract void unregisterCallback();
}
public static abstract class InCallService.VideoCall.Listener {
ctor public InCallService.VideoCall.Listener();
public static abstract class InCallService.VideoCall.Callback {
ctor public InCallService.VideoCall.Callback();
method public abstract void onCallDataUsageChanged(long);
method public abstract void onCallSessionEvent(int);
method public abstract void onCameraCapabilitiesChanged(android.telecom.CameraCapabilities);

View File

@@ -16,6 +16,7 @@
package android.telecom;
import android.annotation.SystemApi;
import android.net.Uri;
import android.os.Bundle;
@@ -501,7 +502,7 @@ public final class Call {
}
}
public static abstract class Listener {
public static abstract class Callback {
/**
* Invoked when the state of this {@code Call} has changed. See {@link #getState()}.
*
@@ -585,13 +586,21 @@ public final class Call {
public void onConferenceableCallsChanged(Call call, List<Call> conferenceableCalls) {}
}
/**
* @deprecated Use {@code Call.Callback} instead.
* @hide
*/
@Deprecated
@SystemApi
public static abstract class Listener extends Callback { }
private final Phone mPhone;
private final String mTelecomCallId;
private final InCallAdapter mInCallAdapter;
private final List<String> mChildrenIds = new ArrayList<>();
private final List<Call> mChildren = new ArrayList<>();
private final List<Call> mUnmodifiableChildren = Collections.unmodifiableList(mChildren);
private final List<Listener> mListeners = new CopyOnWriteArrayList<>();
private final List<Callback> mCallbacks = new CopyOnWriteArrayList<>();
private final List<Call> mConferenceableCalls = new ArrayList<>();
private final List<Call> mUnmodifiableConferenceableCalls =
Collections.unmodifiableList(mConferenceableCalls);
@@ -686,8 +695,8 @@ public final class Call {
* {@code Call} will temporarily pause playing the tones for a pre-defined period of time.
*
* If the DTMF string contains a {@link TelecomManager#DTMF_CHARACTER_WAIT} symbol, this
* {@code Call} will pause playing the tones and notify listeners via
* {@link Listener#onPostDialWait(Call, String)}. At this point, the in-call app
* {@code Call} will pause playing the tones and notify callbacks via
* {@link Callback#onPostDialWait(Call, String)}. At this point, the in-call app
* should display to the user an indication of this state and an affordance to continue
* the postdial sequence. When the user decides to continue the postdial sequence, the in-call
* app should invoke the {@link #postDialContinue(boolean)} method.
@@ -827,26 +836,53 @@ public final class Call {
return mDetails;
}
/**
* Registers a callback to this {@code Call}.
*
* @param callback A {@code Callback}.
*/
public void registerCallback(Callback callback) {
mCallbacks.add(callback);
}
/**
* Unregisters a callback from this {@code Call}.
*
* @param callback A {@code Callback}.
*/
public void unregisterCallback(Callback callback) {
if (callback != null) {
mCallbacks.remove(callback);
}
}
/**
* Adds a listener to this {@code Call}.
*
* @param listener A {@code Listener}.
* @deprecated Use {@link #registerCallback} instead.
* @hide
*/
@Deprecated
@SystemApi
public void addListener(Listener listener) {
mListeners.add(listener);
registerCallback(listener);
}
/**
* Removes a listener from this {@code Call}.
*
* @param listener A {@code Listener}.
* @deprecated Use {@link #unregisterCallback} instead.
* @hide
*/
@Deprecated
@SystemApi
public void removeListener(Listener listener) {
if (listener != null) {
mListeners.remove(listener);
}
unregisterCallback(listener);
}
/** {@hide} */
Call(Phone phone, String telecomCallId, InCallAdapter inCallAdapter) {
mPhone = phone;
@@ -978,56 +1014,56 @@ public final class Call {
}
private void fireStateChanged(int newState) {
for (Listener listener : mListeners) {
listener.onStateChanged(this, newState);
for (Callback callback : mCallbacks) {
callback.onStateChanged(this, newState);
}
}
private void fireParentChanged(Call newParent) {
for (Listener listener : mListeners) {
listener.onParentChanged(this, newParent);
for (Callback callback : mCallbacks) {
callback.onParentChanged(this, newParent);
}
}
private void fireChildrenChanged(List<Call> children) {
for (Listener listener : mListeners) {
listener.onChildrenChanged(this, children);
for (Callback callback : mCallbacks) {
callback.onChildrenChanged(this, children);
}
}
private void fireDetailsChanged(Details details) {
for (Listener listener : mListeners) {
listener.onDetailsChanged(this, details);
for (Callback callback : mCallbacks) {
callback.onDetailsChanged(this, details);
}
}
private void fireCannedTextResponsesLoaded(List<String> cannedTextResponses) {
for (Listener listener : mListeners) {
listener.onCannedTextResponsesLoaded(this, cannedTextResponses);
for (Callback callback : mCallbacks) {
callback.onCannedTextResponsesLoaded(this, cannedTextResponses);
}
}
private void fireVideoCallChanged(InCallService.VideoCall videoCall) {
for (Listener listener : mListeners) {
listener.onVideoCallChanged(this, videoCall);
for (Callback callback : mCallbacks) {
callback.onVideoCallChanged(this, videoCall);
}
}
private void firePostDialWait(String remainingPostDialSequence) {
for (Listener listener : mListeners) {
listener.onPostDialWait(this, remainingPostDialSequence);
for (Callback callback : mCallbacks) {
callback.onPostDialWait(this, remainingPostDialSequence);
}
}
private void fireCallDestroyed() {
for (Listener listener : mListeners) {
listener.onCallDestroyed(this);
for (Callback callback : mCallbacks) {
callback.onCallDestroyed(this);
}
}
private void fireConferenceableCallsChanged() {
for (Listener listener : mListeners) {
listener.onConferenceableCallsChanged(this, mUnmodifiableConferenceableCalls);
for (Callback callback : mCallbacks) {
callback.onConferenceableCallsChanged(this, mUnmodifiableConferenceableCalls);
}
}

View File

@@ -357,17 +357,16 @@ public abstract class InCallService extends Service {
public static abstract class VideoCall {
/**
* Sets a listener to invoke callback methods in the InCallUI after performing video
* telephony actions.
* Registers a callback to receive commands and state changes for video calls.
*
* @param videoCallListener The call video client.
* @param callback The video call callback.
*/
public abstract void setVideoCallListener(VideoCall.Listener videoCallListener);
public abstract void registerCallback(VideoCall.Callback callback);
/**
* Clears the video call listener set via {@link #setVideoCallListener(Listener)}.
* Unregisters the callback set via {@link #registerCallback(Callback)}.
*/
public abstract void removeVideoCallListener();
public abstract void unregisterCallback();
/**
* Sets the camera to be used for video recording in a video call.
@@ -410,7 +409,7 @@ public abstract class InCallService extends Service {
/**
* Issues a request to modify the properties of the current session. The request is sent to
* the remote device where it it handled by
* {@link VideoCall.Listener#onSessionModifyRequestReceived}.
* {@link VideoCall.Callback#onSessionModifyRequestReceived}.
* Some examples of session modification requests: upgrade call from audio to video,
* downgrade call from video to audio, pause video.
*
@@ -422,9 +421,9 @@ public abstract class InCallService extends Service {
* Provides a response to a request to change the current call session video
* properties.
* This is in response to a request the InCall UI has received via
* {@link VideoCall.Listener#onSessionModifyRequestReceived}.
* {@link VideoCall.Callback#onSessionModifyRequestReceived}.
* The response is handled on the remove device by
* {@link VideoCall.Listener#onSessionModifyResponseReceived}.
* {@link VideoCall.Callback#onSessionModifyResponseReceived}.
*
* @param responseProfile The response call video properties.
*/
@@ -433,14 +432,14 @@ public abstract class InCallService extends Service {
/**
* Issues a request to the video provider to retrieve the camera capabilities.
* Camera capabilities are reported back to the caller via
* {@link VideoCall.Listener#onCameraCapabilitiesChanged(CameraCapabilities)}.
* {@link VideoCall.Callback#onCameraCapabilitiesChanged(CameraCapabilities)}.
*/
public abstract void requestCameraCapabilities();
/**
* Issues a request to the video telephony framework to retrieve the cumulative data usage for
* the current call. Data usage is reported back to the caller via
* {@link VideoCall.Listener#onCallDataUsageChanged}.
* {@link VideoCall.Callback#onCallDataUsageChanged}.
*/
public abstract void requestCallDataUsage();
@@ -453,9 +452,9 @@ public abstract class InCallService extends Service {
public abstract void setPauseImage(String uri);
/**
* Listener class which invokes callbacks after video call actions occur.
* Callback class which invokes callbacks after video call actions occur.
*/
public static abstract class Listener {
public static abstract class Callback {
/**
* Called when a session modification request is received from the remote device.
* The remote request is sent via

View File

@@ -122,7 +122,7 @@ public final class Phone {
InCallService.VideoCall videoCall = call.getVideoCall();
if (videoCall != null) {
videoCall.removeVideoCallListener();
videoCall.unregisterCallback();
}
fireCallRemoved(call);
}
@@ -178,7 +178,7 @@ public final class Phone {
for (Call call : mCalls) {
InCallService.VideoCall videoCall = call.getVideoCall();
if (videoCall != null) {
videoCall.removeVideoCallListener();
videoCall.unregisterCallback();
}
if (call.getState() != Call.STATE_DISCONNECTED) {
call.internalSetDisconnected();

View File

@@ -46,7 +46,7 @@ public class VideoCallImpl extends VideoCall {
private final IVideoProvider mVideoProvider;
private final VideoCallListenerBinder mBinder;
private VideoCall.Listener mVideoCallListener;
private VideoCall.Callback mCallback;
private IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() {
@Override
@@ -109,14 +109,14 @@ public class VideoCallImpl extends VideoCall {
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
if (mVideoCallListener == null) {
if (mCallback == null) {
return;
}
SomeArgs args;
switch (msg.what) {
case MSG_RECEIVE_SESSION_MODIFY_REQUEST:
mVideoCallListener.onSessionModifyRequestReceived((VideoProfile) msg.obj);
mCallback.onSessionModifyRequestReceived((VideoProfile) msg.obj);
break;
case MSG_RECEIVE_SESSION_MODIFY_RESPONSE:
args = (SomeArgs) msg.obj;
@@ -125,34 +125,34 @@ public class VideoCallImpl extends VideoCall {
VideoProfile requestProfile = (VideoProfile) args.arg2;
VideoProfile responseProfile = (VideoProfile) args.arg3;
mVideoCallListener.onSessionModifyResponseReceived(
mCallback.onSessionModifyResponseReceived(
status, requestProfile, responseProfile);
} finally {
args.recycle();
}
break;
case MSG_HANDLE_CALL_SESSION_EVENT:
mVideoCallListener.onCallSessionEvent((int) msg.obj);
mCallback.onCallSessionEvent((int) msg.obj);
break;
case MSG_CHANGE_PEER_DIMENSIONS:
args = (SomeArgs) msg.obj;
try {
int width = (int) args.arg1;
int height = (int) args.arg2;
mVideoCallListener.onPeerDimensionsChanged(width, height);
mCallback.onPeerDimensionsChanged(width, height);
} finally {
args.recycle();
}
break;
case MSG_CHANGE_CALL_DATA_USAGE:
mVideoCallListener.onCallDataUsageChanged((long) msg.obj);
mCallback.onCallDataUsageChanged((long) msg.obj);
break;
case MSG_CHANGE_CAMERA_CAPABILITIES:
mVideoCallListener.onCameraCapabilitiesChanged(
mCallback.onCameraCapabilitiesChanged(
(CameraCapabilities) msg.obj);
break;
case MSG_CHANGE_VIDEO_QUALITY:
mVideoCallListener.onVideoQualityChanged(msg.arg1);
mCallback.onVideoQualityChanged(msg.arg1);
break;
default:
break;
@@ -170,13 +170,13 @@ public class VideoCallImpl extends VideoCall {
}
/** {@inheritDoc} */
public void setVideoCallListener(VideoCall.Listener videoCallListener) {
mVideoCallListener = videoCallListener;
public void registerCallback(VideoCall.Callback callback) {
mCallback = callback;
}
/** {@inheritDoc} */
public void removeVideoCallListener() {
mVideoCallListener = null;
public void unregisterCallback() {
mCallback = null;
try {
mVideoProvider.removeVideoCallback(mBinder);
} catch (RemoteException e) {