summaryrefslogtreecommitdiffstats
path: root/telecomm/java/android
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-04-15 14:09:50 -0700
committerAndrew Lee <anwlee@google.com>2015-04-16 17:11:35 -0700
commit8eb87f0da838c5ca371a54ff2fc5924bf8664ba9 (patch)
tree593e492aa46a7e2b5188839d4fc0260b2524da47 /telecomm/java/android
parent7e24657d07868739754fd53fa7da97cb05e2e27d (diff)
downloadframeworks_base-8eb87f0da838c5ca371a54ff2fc5924bf8664ba9.zip
frameworks_base-8eb87f0da838c5ca371a54ff2fc5924bf8664ba9.tar.gz
frameworks_base-8eb87f0da838c5ca371a54ff2fc5924bf8664ba9.tar.bz2
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
Diffstat (limited to 'telecomm/java/android')
-rw-r--r--telecomm/java/android/telecom/Call.java88
-rw-r--r--telecomm/java/android/telecom/InCallService.java25
-rw-r--r--telecomm/java/android/telecom/Phone.java4
-rw-r--r--telecomm/java/android/telecom/VideoCallImpl.java26
4 files changed, 89 insertions, 54 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 43ca153..e30b3bc 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -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.
@@ -828,25 +837,52 @@ public final class Call {
}
/**
+ * 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);
}
}
diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java
index a910712..846768f 100644
--- a/telecomm/java/android/telecom/InCallService.java
+++ b/telecomm/java/android/telecom/InCallService.java
@@ -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
diff --git a/telecomm/java/android/telecom/Phone.java b/telecomm/java/android/telecom/Phone.java
index d456dfa..42256da 100644
--- a/telecomm/java/android/telecom/Phone.java
+++ b/telecomm/java/android/telecom/Phone.java
@@ -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();
diff --git a/telecomm/java/android/telecom/VideoCallImpl.java b/telecomm/java/android/telecom/VideoCallImpl.java
index fa2dbb1..3779d1a 100644
--- a/telecomm/java/android/telecom/VideoCallImpl.java
+++ b/telecomm/java/android/telecom/VideoCallImpl.java
@@ -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) {