diff options
author | Andrew Lee <anwlee@google.com> | 2014-09-08 15:34:24 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2014-09-11 13:30:10 -0700 |
commit | 100e293fa8021caed956597daa4e01cb19be1c33 (patch) | |
tree | b2076765d4a024478e479b11674d41d5af9420c0 /telecomm | |
parent | 3e42b339800f5a3ac840e9545c36f3445b5c64b3 (diff) | |
download | frameworks_base-100e293fa8021caed956597daa4e01cb19be1c33.zip frameworks_base-100e293fa8021caed956597daa4e01cb19be1c33.tar.gz frameworks_base-100e293fa8021caed956597daa4e01cb19be1c33.tar.bz2 |
API cleanup for RemoteConnection.
+ Rename handle to address.
+ Rename audioModeIsVoip to IsVoipAudioMode.
+ Rename Listener to Callback.
- Delete getParent() and getChildren() methods.
- Delete onChildrenChanged/onParentChanged methods.
+ Rename Listener to Callback.
+ Rename Callback methods to reflect other changes.
Bug: 17329632
Change-Id: Ie466472e995050f578fbb1c4b9de0ae59e488988
Diffstat (limited to 'telecomm')
9 files changed, 180 insertions, 215 deletions
diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java index 729686d..2f25dcf 100644 --- a/telecomm/java/android/telecomm/Connection.java +++ b/telecomm/java/android/telecomm/Connection.java @@ -68,13 +68,13 @@ public abstract class Connection { /** @hide */ public abstract static class Listener { public void onStateChanged(Connection c, int state) {} - public void onHandleChanged(Connection c, Uri newHandle, int presentation) {} + public void onAddressChanged(Connection c, Uri newAddress, int presentation) {} public void onCallerDisplayNameChanged( Connection c, String callerDisplayName, int presentation) {} public void onVideoStateChanged(Connection c, int videoState) {} public void onDisconnected(Connection c, int cause, String message) {} public void onPostDialWait(Connection c, String remaining) {} - public void onRequestingRingback(Connection c, boolean ringback) {} + public void onRingbackRequested(Connection c, boolean ringback) {} public void onDestroyed(Connection c) {} public void onCallCapabilitiesChanged(Connection c, int callCapabilities) {} public void onVideoProviderChanged( @@ -464,11 +464,11 @@ public abstract class Connection { private int mState = STATE_NEW; private AudioState mAudioState; - private Uri mHandle; - private int mHandlePresentation; + private Uri mAddress; + private int mAddressPresentation; private String mCallerDisplayName; private int mCallerDisplayNamePresentation; - private boolean mRequestingRingback = false; + private boolean mRingbackRequested = false; private int mCallCapabilities; private VideoProvider mVideoProvider; private boolean mAudioModeIsVoip; @@ -485,18 +485,18 @@ public abstract class Connection { public Connection() {} /** - * @return The handle (e.g., phone number) to which this Connection is currently communicating. + * @return The address (e.g., phone number) to which this Connection is currently communicating. */ - public final Uri getHandle() { - return mHandle; + public final Uri getAddress() { + return mAddress; } /** - * @return The presentation requirements for the handle. + * @return The presentation requirements for the address. * See {@link TelecommManager} for valid values. */ - public final int getHandlePresentation() { - return mHandlePresentation; + public final int getAddressPresentation() { + return mAddressPresentation; } /** @@ -556,8 +556,8 @@ public abstract class Connection { * Returns whether this connection is requesting that the system play a ringback tone * on its behalf. */ - public final boolean isRequestingRingback() { - return mRequestingRingback; + public final boolean isRingbackRequested() { + return mRingbackRequested; } /** @@ -662,18 +662,18 @@ public abstract class Connection { } /** - * Sets the value of the {@link #getHandle()} property. + * Sets the value of the {@link #getAddress()} property. * - * @param handle The new handle. - * @param presentation The presentation requirements for the handle. + * @param address The new address. + * @param presentation The presentation requirements for the address. * See {@link TelecommManager} for valid values. */ - public final void setHandle(Uri handle, int presentation) { - Log.d(this, "setHandle %s", handle); - mHandle = handle; - mHandlePresentation = presentation; + public final void setAddress(Uri address, int presentation) { + Log.d(this, "setAddress %s", address); + mAddress = address; + mAddressPresentation = presentation; for (Listener l : mListeners) { - l.onHandleChanged(this, handle, presentation); + l.onAddressChanged(this, address, presentation); } } @@ -716,7 +716,7 @@ public abstract class Connection { * communicate). */ public final void setActive() { - setRequestingRingback(false); + setRingbackRequested(false); setState(STATE_ACTIVE); } @@ -804,11 +804,11 @@ public abstract class Connection { * * @param ringback Whether the ringback tone is to be played. */ - public final void setRequestingRingback(boolean ringback) { - if (mRequestingRingback != ringback) { - mRequestingRingback = ringback; + public final void setRingbackRequested(boolean ringback) { + if (mRingbackRequested != ringback) { + mRingbackRequested = ringback; for (Listener l : mListeners) { - l.onRequestingRingback(this, ringback); + l.onRingbackRequested(this, ringback); } } } diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java index 76e208b..036d397 100644 --- a/telecomm/java/android/telecomm/ConnectionService.java +++ b/telecomm/java/android/telecomm/ConnectionService.java @@ -414,9 +414,9 @@ public abstract class ConnectionService extends Service { } @Override - public void onHandleChanged(Connection c, Uri handle, int presentation) { + public void onAddressChanged(Connection c, Uri address, int presentation) { String id = mIdByConnection.get(c); - mAdapter.setHandle(id, handle, presentation); + mAdapter.setAddress(id, address, presentation); } @Override @@ -439,10 +439,10 @@ public abstract class ConnectionService extends Service { } @Override - public void onRequestingRingback(Connection c, boolean ringback) { + public void onRingbackRequested(Connection c, boolean ringback) { String id = mIdByConnection.get(c); Log.d(this, "Adapter onRingback %b", ringback); - mAdapter.setRequestingRingback(id, ringback); + mAdapter.setRingbackRequested(id, ringback); } @Override @@ -462,7 +462,7 @@ public abstract class ConnectionService extends Service { @Override public void onAudioModeIsVoipChanged(Connection c, boolean isVoip) { String id = mIdByConnection.get(c); - mAdapter.setAudioModeIsVoip(id, isVoip); + mAdapter.setIsVoipAudioMode(id, isVoip); } @Override @@ -523,8 +523,8 @@ public abstract class ConnectionService extends Service { addConnection(callId, connection); } - Uri handle = connection.getHandle(); - String number = handle == null ? "null" : handle.getSchemeSpecificPart(); + Uri address = connection.getAddress(); + String number = address == null ? "null" : address.getSchemeSpecificPart(); Log.v(this, "createConnection, number: %s, state: %s, capabilities: %s", Connection.toLogSafePhoneNumber(number), Connection.stateToString(connection.getState()), @@ -538,14 +538,14 @@ public abstract class ConnectionService extends Service { request.getAccountHandle(), connection.getState(), connection.getCallCapabilities(), - connection.getHandle(), - connection.getHandlePresentation(), + connection.getAddress(), + connection.getAddressPresentation(), connection.getCallerDisplayName(), connection.getCallerDisplayNamePresentation(), connection.getVideoProvider() == null ? null : connection.getVideoProvider().getInterface(), connection.getVideoState(), - connection.isRequestingRingback(), + connection.isRingbackRequested(), connection.getAudioModeIsVoip(), connection.getStatusHints(), connection.getDisconnectCause(), diff --git a/telecomm/java/android/telecomm/ConnectionServiceAdapter.java b/telecomm/java/android/telecomm/ConnectionServiceAdapter.java index e3dc713..19f42d6 100644 --- a/telecomm/java/android/telecomm/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecomm/ConnectionServiceAdapter.java @@ -168,10 +168,10 @@ final class ConnectionServiceAdapter implements DeathRecipient { * @param callId The unique ID of the call whose ringback is being changed. * @param ringback Whether Telecomm should start playing a ringback tone. */ - void setRequestingRingback(String callId, boolean ringback) { + void setRingbackRequested(String callId, boolean ringback) { for (IConnectionServiceAdapter adapter : mAdapters) { try { - adapter.setRequestingRingback(callId, ringback); + adapter.setRingbackRequested(callId, ringback); } catch (RemoteException e) { } } @@ -280,10 +280,10 @@ final class ConnectionServiceAdapter implements DeathRecipient { * @param callId The unique ID of the call to set with the given call video provider. * @param isVoip True if the audio mode is VOIP. */ - void setAudioModeIsVoip(String callId, boolean isVoip) { + void setIsVoipAudioMode(String callId, boolean isVoip) { for (IConnectionServiceAdapter adapter : mAdapters) { try { - adapter.setAudioModeIsVoip(callId, isVoip); + adapter.setIsVoipAudioMode(callId, isVoip); } catch (RemoteException e) { } } @@ -298,10 +298,10 @@ final class ConnectionServiceAdapter implements DeathRecipient { } } - void setHandle(String callId, Uri handle, int presentation) { + void setAddress(String callId, Uri address, int presentation) { for (IConnectionServiceAdapter adapter : mAdapters) { try { - adapter.setHandle(callId, handle, presentation); + adapter.setAddress(callId, address, presentation); } catch (RemoteException e) { } } diff --git a/telecomm/java/android/telecomm/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecomm/ConnectionServiceAdapterServant.java index 21e99db..2aac7fc 100644 --- a/telecomm/java/android/telecomm/ConnectionServiceAdapterServant.java +++ b/telecomm/java/android/telecomm/ConnectionServiceAdapterServant.java @@ -44,7 +44,7 @@ final class ConnectionServiceAdapterServant { private static final int MSG_SET_DIALING = 4; private static final int MSG_SET_DISCONNECTED = 5; private static final int MSG_SET_ON_HOLD = 6; - private static final int MSG_SET_REQUESTING_RINGBACK = 7; + private static final int MSG_SET_RINGBACK_REQUESTED = 7; private static final int MSG_SET_CALL_CAPABILITIES = 8; private static final int MSG_SET_IS_CONFERENCED = 9; private static final int MSG_ADD_CONFERENCE_CALL = 10; @@ -53,9 +53,9 @@ final class ConnectionServiceAdapterServant { private static final int MSG_QUERY_REMOTE_CALL_SERVICES = 13; private static final int MSG_SET_VIDEO_STATE = 14; private static final int MSG_SET_VIDEO_CALL_PROVIDER = 15; - private static final int MSG_SET_AUDIO_MODE_IS_VOIP = 16; + private static final int MSG_SET_IS_VOIP_AUDIO_MODE = 16; private static final int MSG_SET_STATUS_HINTS = 17; - private static final int MSG_SET_HANDLE = 18; + private static final int MSG_SET_ADDRESS = 18; private static final int MSG_SET_CALLER_DISPLAY_NAME = 19; private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20; @@ -107,8 +107,8 @@ final class ConnectionServiceAdapterServant { case MSG_SET_ON_HOLD: mDelegate.setOnHold((String) msg.obj); break; - case MSG_SET_REQUESTING_RINGBACK: - mDelegate.setRequestingRingback((String) msg.obj, msg.arg1 == 1); + case MSG_SET_RINGBACK_REQUESTED: + mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1); break; case MSG_SET_CALL_CAPABILITIES: mDelegate.setCallCapabilities((String) msg.obj, msg.arg1); @@ -160,8 +160,8 @@ final class ConnectionServiceAdapterServant { } break; } - case MSG_SET_AUDIO_MODE_IS_VOIP: - mDelegate.setAudioModeIsVoip((String) msg.obj, msg.arg1 == 1); + case MSG_SET_IS_VOIP_AUDIO_MODE: + mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1); break; case MSG_SET_STATUS_HINTS: { SomeArgs args = (SomeArgs) msg.obj; @@ -172,10 +172,10 @@ final class ConnectionServiceAdapterServant { } break; } - case MSG_SET_HANDLE: { + case MSG_SET_ADDRESS: { SomeArgs args = (SomeArgs) msg.obj; try { - mDelegate.setHandle((String) args.arg1, (Uri) args.arg2, args.argi1); + mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1); } finally { args.recycle(); } @@ -249,8 +249,8 @@ final class ConnectionServiceAdapterServant { } @Override - public void setRequestingRingback(String connectionId, boolean ringback) { - mHandler.obtainMessage(MSG_SET_REQUESTING_RINGBACK, ringback ? 1 : 0, 0, connectionId) + public void setRingbackRequested(String connectionId, boolean ringback) { + mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId) .sendToTarget(); } @@ -308,8 +308,8 @@ final class ConnectionServiceAdapterServant { } @Override - public final void setAudioModeIsVoip(String connectionId, boolean isVoip) { - mHandler.obtainMessage(MSG_SET_AUDIO_MODE_IS_VOIP, isVoip ? 1 : 0, 0, + public final void setIsVoipAudioMode(String connectionId, boolean isVoip) { + mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0, connectionId).sendToTarget(); } @@ -322,12 +322,12 @@ final class ConnectionServiceAdapterServant { } @Override - public final void setHandle(String connectionId, Uri handle, int presentation) { + public final void setAddress(String connectionId, Uri address, int presentation) { SomeArgs args = SomeArgs.obtain(); args.arg1 = connectionId; - args.arg2 = handle; + args.arg2 = address; args.argi1 = presentation; - mHandler.obtainMessage(MSG_SET_HANDLE, args).sendToTarget(); + mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget(); } @Override diff --git a/telecomm/java/android/telecomm/ParcelableConnection.java b/telecomm/java/android/telecomm/ParcelableConnection.java index 2e21d37..cadcd85 100644 --- a/telecomm/java/android/telecomm/ParcelableConnection.java +++ b/telecomm/java/android/telecomm/ParcelableConnection.java @@ -35,14 +35,14 @@ public final class ParcelableConnection implements Parcelable { private final PhoneAccountHandle mPhoneAccount; private final int mState; private final int mCapabilities; - private final Uri mHandle; - private final int mHandlePresentation; + private final Uri mAddress; + private final int mAddressPresentation; private final String mCallerDisplayName; private final int mCallerDisplayNamePresentation; private final IVideoProvider mVideoProvider; private final int mVideoState; - private final boolean mRequestingRingback; - private final boolean mAudioModeIsVoip; + private final boolean mRingbackRequested; + private final boolean mIsVoipAudioMode; private final StatusHints mStatusHints; private final int mDisconnectCause; private final String mDisconnectMessage; @@ -53,14 +53,14 @@ public final class ParcelableConnection implements Parcelable { PhoneAccountHandle phoneAccount, int state, int capabilities, - Uri handle, - int handlePresentation, + Uri address, + int addressPresentation, String callerDisplayName, int callerDisplayNamePresentation, IVideoProvider videoProvider, int videoState, - boolean requestingRingback, - boolean audioModeIsVoip, + boolean ringbackRequested, + boolean isVoipAudioMode, StatusHints statusHints, int disconnectCause, String disconnectMessage, @@ -68,14 +68,14 @@ public final class ParcelableConnection implements Parcelable { mPhoneAccount = phoneAccount; mState = state; mCapabilities = capabilities; - mHandle = handle; - mHandlePresentation = handlePresentation; + mAddress = address; + mAddressPresentation = addressPresentation; mCallerDisplayName = callerDisplayName; mCallerDisplayNamePresentation = callerDisplayNamePresentation; mVideoProvider = videoProvider; mVideoState = videoState; - mRequestingRingback = requestingRingback; - mAudioModeIsVoip = audioModeIsVoip; + mRingbackRequested = ringbackRequested; + mIsVoipAudioMode = isVoipAudioMode; mStatusHints = statusHints; mDisconnectCause = disconnectCause; mDisconnectMessage = disconnectMessage; @@ -96,11 +96,11 @@ public final class ParcelableConnection implements Parcelable { } public Uri getHandle() { - return mHandle; + return mAddress; } public int getHandlePresentation() { - return mHandlePresentation; + return mAddressPresentation; } public String getCallerDisplayName() { @@ -119,12 +119,12 @@ public final class ParcelableConnection implements Parcelable { return mVideoState; } - public boolean isRequestingRingback() { - return mRequestingRingback; + public boolean isRingbackRequested() { + return mRingbackRequested; } - public boolean getAudioModeIsVoip() { - return mAudioModeIsVoip; + public boolean getIsVoipAudioMode() { + return mIsVoipAudioMode; } public final StatusHints getStatusHints() { @@ -164,14 +164,14 @@ public final class ParcelableConnection implements Parcelable { PhoneAccountHandle phoneAccount = source.readParcelable(classLoader); int state = source.readInt(); int capabilities = source.readInt(); - Uri handle = source.readParcelable(classLoader); - int handlePresentation = source.readInt(); + Uri address = source.readParcelable(classLoader); + int addressPresentation = source.readInt(); String callerDisplayName = source.readString(); int callerDisplayNamePresentation = source.readInt(); IVideoProvider videoCallProvider = IVideoProvider.Stub.asInterface(source.readStrongBinder()); int videoState = source.readInt(); - boolean requestingRingback = source.readByte() == 1; + boolean ringbackRequested = source.readByte() == 1; boolean audioModeIsVoip = source.readByte() == 1; StatusHints statusHints = source.readParcelable(classLoader); int disconnectCauseCode = source.readInt(); @@ -183,13 +183,13 @@ public final class ParcelableConnection implements Parcelable { phoneAccount, state, capabilities, - handle, - handlePresentation, + address, + addressPresentation, callerDisplayName, callerDisplayNamePresentation, videoCallProvider, videoState, - requestingRingback, + ringbackRequested, audioModeIsVoip, statusHints, disconnectCauseCode, @@ -215,15 +215,15 @@ public final class ParcelableConnection implements Parcelable { destination.writeParcelable(mPhoneAccount, 0); destination.writeInt(mState); destination.writeInt(mCapabilities); - destination.writeParcelable(mHandle, 0); - destination.writeInt(mHandlePresentation); + destination.writeParcelable(mAddress, 0); + destination.writeInt(mAddressPresentation); destination.writeString(mCallerDisplayName); destination.writeInt(mCallerDisplayNamePresentation); destination.writeStrongBinder( mVideoProvider != null ? mVideoProvider.asBinder() : null); destination.writeInt(mVideoState); - destination.writeByte((byte) (mRequestingRingback ? 1 : 0)); - destination.writeByte((byte) (mAudioModeIsVoip ? 1 : 0)); + destination.writeByte((byte) (mRingbackRequested ? 1 : 0)); + destination.writeByte((byte) (mIsVoipAudioMode ? 1 : 0)); destination.writeParcelable(mStatusHints, 0); destination.writeInt(mDisconnectCause); destination.writeString(mDisconnectMessage); diff --git a/telecomm/java/android/telecomm/RemoteConference.java b/telecomm/java/android/telecomm/RemoteConference.java index b073827..dbff079 100644 --- a/telecomm/java/android/telecomm/RemoteConference.java +++ b/telecomm/java/android/telecomm/RemoteConference.java @@ -188,11 +188,11 @@ public final class RemoteConference { return mDisconnectMessage; } - public final void addCallback(Callback callback) { + public final void registerCallback(Callback callback) { mCallbacks.add(callback); } - public final void removeCallback(Callback callback) { + public final void unregisterCallback(Callback callback) { mCallbacks.remove(callback); } } diff --git a/telecomm/java/android/telecomm/RemoteConnection.java b/telecomm/java/android/telecomm/RemoteConnection.java index 68367f0..f3a6085 100644 --- a/telecomm/java/android/telecomm/RemoteConnection.java +++ b/telecomm/java/android/telecomm/RemoteConnection.java @@ -42,7 +42,7 @@ import java.util.concurrent.ConcurrentHashMap; */ public final class RemoteConnection { - public static abstract class Listener { + public static abstract class Callback { /** * Invoked when the state of this {@code RemoteConnection} has changed. See * {@link #getState()}. @@ -53,25 +53,6 @@ public final class RemoteConnection { public void onStateChanged(RemoteConnection connection, int state) {} /** - * Invoked when the parent of this {@code RemoteConnection} has changed. See - * {@link #getParent()}. - * - * @param connection The {@code RemoteConnection} invoking this method. - * @param parent The new parent of the {@code RemoteConnection}. - */ - public void onParentChanged(RemoteConnection connection, RemoteConnection parent) {} - - /** - * Invoked when the children of this {@code RemoteConnection} have changed. See - * {@link #getChildren()}. - * - * @param connection The {@code RemoteConnection} invoking this method. - * @param children The new children of the {@code RemoteConnection}. - */ - public void onChildrenChanged( - RemoteConnection connection, List<RemoteConnection> children) {} - - /** * Invoked when this {@code RemoteConnection} is disconnected. * * @param connection The {@code RemoteConnection} invoking this method. @@ -87,12 +68,12 @@ public final class RemoteConnection { /** * Invoked when this {@code RemoteConnection} is requesting ringback. See - * {@link #isRequestingRingback()}. + * {@link #isRingbackRequested()}. * * @param connection The {@code RemoteConnection} invoking this method. * @param ringback Whether the {@code RemoteConnection} is requesting ringback. */ - public void onRequestingRingback(RemoteConnection connection, boolean ringback) {} + public void onRingbackRequested(RemoteConnection connection, boolean ringback) {} /** * Indicates that the call capabilities of this {@code RemoteConnection} have changed. @@ -116,12 +97,12 @@ public final class RemoteConnection { /** * Indicates that the VOIP audio status of this {@code RemoteConnection} has changed. - * See {@link #getAudioModeIsVoip()}. + * See {@link #isVoipAudioMode()}. * * @param connection The {@code RemoteConnection} invoking this method. * @param isVoip Whether the new audio state of the {@code RemoteConnection} is VOIP. */ - public void onAudioModeIsVoipChanged(RemoteConnection connection, boolean isVoip) {} + public void onVoipAudioChanged(RemoteConnection connection, boolean isVoip) {} /** * Indicates that the status hints of this {@code RemoteConnection} have changed. See @@ -133,15 +114,15 @@ public final class RemoteConnection { public void onStatusHintsChanged(RemoteConnection connection, StatusHints statusHints) {} /** - * Indicates that the handle (e.g., phone number) of this {@code RemoteConnection} has - * changed. See {@link #getHandle()} and {@link #getHandlePresentation()}. + * Indicates that the address (e.g., phone number) of this {@code RemoteConnection} has + * changed. See {@link #getAddress()} and {@link #getAddressPresentation()}. * * @param connection The {@code RemoteConnection} invoking this method. - * @param handle The new handle of the {@code RemoteConnection}. - * @param presentation The presentation requirements for the handle. + * @param address The new address of the {@code RemoteConnection}. + * @param presentation The presentation requirements for the address. * See {@link TelecommManager} for valid values. */ - public void onHandleChanged(RemoteConnection connection, Uri handle, int presentation) {} + public void onAddressChanged(RemoteConnection connection, Uri address, int presentation) {} /** * Indicates that the caller display name of this {@code RemoteConnection} has changed. @@ -396,8 +377,8 @@ public final class RemoteConnection { * load factor before resizing, 1 means we only expect a single thread to * access the map so make only a single shard */ - private final Set<Listener> mListeners = Collections.newSetFromMap( - new ConcurrentHashMap<Listener, Boolean>(8, 0.9f, 1)); + private final Set<Callback> mCallbacks = Collections.newSetFromMap( + new ConcurrentHashMap<Callback, Boolean>(8, 0.9f, 1)); private final List<RemoteConnection> mConferenceableConnections = new ArrayList<>(); private final List<RemoteConnection> mUnmodifiableconferenceableConnections = Collections.unmodifiableList(mConferenceableConnections); @@ -405,15 +386,15 @@ public final class RemoteConnection { private int mState = Connection.STATE_NEW; private int mDisconnectCauseCode = DisconnectCause.NOT_VALID; private String mDisconnectCauseMessage; - private boolean mRequestingRingback; + private boolean mRingbackRequested; private boolean mConnected; private int mCallCapabilities; private int mVideoState; private VideoProvider mVideoProvider; - private boolean mAudioModeIsVoip; + private boolean mIsVoipAudioMode; private StatusHints mStatusHints; - private Uri mHandle; - private int mHandlePresentation; + private Uri mAddress; + private int mAddressPresentation; private String mCallerDisplayName; private int mCallerDisplayNamePresentation; private int mFailureCode; @@ -450,42 +431,26 @@ public final class RemoteConnection { } /** - * Adds a listener to this {@code RemoteConnection}. + * Adds a callback to this {@code RemoteConnection}. * - * @param listener A {@code Listener}. + * @param callback A {@code Callback}. */ - public void addListener(Listener listener) { - mListeners.add(listener); + public void registerCallback(Callback callback) { + mCallbacks.add(callback); } /** - * Removes a listener from this {@code RemoteConnection}. + * Removes a callback from this {@code RemoteConnection}. * - * @param listener A {@code Listener}. + * @param callback A {@code Callback}. */ - public void removeListener(Listener listener) { - if (listener != null) { - mListeners.remove(listener); + public void unregisterCallback(Callback callback) { + if (callback != null) { + mCallbacks.remove(callback); } } /** - * Obtains the parent of this {@code RemoteConnection} in a conference, if any. - * - * @return The parent {@code RemoteConnection}, or {@code null} if this {@code RemoteConnection} - * is not a child of any conference {@code RemoteConnection}s. - */ - public RemoteConnection getParent() { return null; } - - /** - * Obtains the children of this conference {@code RemoteConnection}, if any. - * - * @return The children of this {@code RemoteConnection} if this {@code RemoteConnection} is - * a conference, or an empty {@code List} otherwise. - */ - public List<RemoteConnection> getChildren() { return new ArrayList<>(); } - - /** * Obtains the state of this {@code RemoteConnection}. * * @return A state value, chosen from the {@code STATE_*} constants. @@ -522,8 +487,8 @@ public final class RemoteConnection { /** * @return {@code true} if the {@code RemoteConnection}'s current audio mode is VOIP. */ - public boolean getAudioModeIsVoip() { - return mAudioModeIsVoip; + public boolean isVoipAudioMode() { + return mIsVoipAudioMode; } /** @@ -535,25 +500,25 @@ public final class RemoteConnection { } /** - * @return The handle (e.g., phone number) to which the {@code RemoteConnection} is currently + * @return The address (e.g., phone number) to which the {@code RemoteConnection} is currently * connected. */ - public Uri getHandle() { - return mHandle; + public Uri getAddress() { + return mAddress; } /** - * @return The presentation requirements for the handle. See - * {@link TelecommManager} for valid values. + * @return The presentation requirements for the address. See {@link TelecommManager} for valid + * values. */ - public int getHandlePresentation() { - return mHandlePresentation; + public int getAddressPresentation() { + return mAddressPresentation; } /** * @return The display name for the caller. */ - public String getCallerDisplayName() { + public CharSequence getCallerDisplayName() { return mCallerDisplayName; } @@ -601,7 +566,7 @@ public final class RemoteConnection { * @return Whether the {@code RemoteConnection} is requesting that the framework play a * ringback tone on its behalf. */ - public boolean isRequestingRingback() { + public boolean isRingbackRequested() { return false; } @@ -738,8 +703,8 @@ public final class RemoteConnection { * of time. * * If the DTMF string contains a {@link TelecommManager#DTMF_CHARACTER_WAIT} symbol, this - * {@code RemoteConnection} will pause playing the tones and notify listeners via - * {@link Listener#onPostDialWait(RemoteConnection, String)}. At this point, the in-call app + * {@code RemoteConnection} will pause playing the tones and notify callbackss via + * {@link Callback#onPostDialWait(RemoteConnection, 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. @@ -806,8 +771,8 @@ public final class RemoteConnection { void setState(int state) { if (mState != state) { mState = state; - for (Listener l: mListeners) { - l.onStateChanged(this, state); + for (Callback c: mCallbacks) { + c.onStateChanged(this, state); } } } @@ -821,8 +786,8 @@ public final class RemoteConnection { mDisconnectCauseCode = cause; mDisconnectCauseMessage = message; - for (Listener l : mListeners) { - l.onDisconnected(this, cause, message); + for (Callback c : mCallbacks) { + c.onDisconnected(this, cause, message); } } } @@ -830,11 +795,11 @@ public final class RemoteConnection { /** * @hide */ - void setRequestingRingback(boolean ringback) { - if (mRequestingRingback != ringback) { - mRequestingRingback = ringback; - for (Listener l : mListeners) { - l.onRequestingRingback(this, ringback); + void setRingbackRequested(boolean ringback) { + if (mRingbackRequested != ringback) { + mRingbackRequested = ringback; + for (Callback c : mCallbacks) { + c.onRingbackRequested(this, ringback); } } } @@ -844,8 +809,8 @@ public final class RemoteConnection { */ void setCallCapabilities(int callCapabilities) { mCallCapabilities = callCapabilities; - for (Listener l : mListeners) { - l.onCallCapabilitiesChanged(this, callCapabilities); + for (Callback c : mCallbacks) { + c.onCallCapabilitiesChanged(this, callCapabilities); } } @@ -853,16 +818,16 @@ public final class RemoteConnection { * @hide */ void setDestroyed() { - if (!mListeners.isEmpty()) { - // Make sure that the listeners are notified that the call is destroyed first. + if (!mCallbacks.isEmpty()) { + // Make sure that the callbacks are notified that the call is destroyed first. if (mState != Connection.STATE_DISCONNECTED) { setDisconnected(DisconnectCause.ERROR_UNSPECIFIED, "Connection destroyed."); } - for (Listener l : mListeners) { - l.onDestroyed(this); + for (Callback c : mCallbacks) { + c.onDestroyed(this); } - mListeners.clear(); + mCallbacks.clear(); mConnected = false; } @@ -872,8 +837,8 @@ public final class RemoteConnection { * @hide */ void setPostDialWait(String remainingDigits) { - for (Listener l : mListeners) { - l.onPostDialWait(this, remainingDigits); + for (Callback c : mCallbacks) { + c.onPostDialWait(this, remainingDigits); } } @@ -882,8 +847,8 @@ public final class RemoteConnection { */ void setVideoState(int videoState) { mVideoState = videoState; - for (Listener l : mListeners) { - l.onVideoStateChanged(this, videoState); + for (Callback c : mCallbacks) { + c.onVideoStateChanged(this, videoState); } } @@ -892,33 +857,33 @@ public final class RemoteConnection { */ void setVideoProvider(VideoProvider videoProvider) { mVideoProvider = videoProvider; - for (Listener l : mListeners) { - l.onVideoProviderChanged(this, videoProvider); + for (Callback c : mCallbacks) { + c.onVideoProviderChanged(this, videoProvider); } } /** @hide */ - void setAudioModeIsVoip(boolean isVoip) { - mAudioModeIsVoip = isVoip; - for (Listener l : mListeners) { - l.onAudioModeIsVoipChanged(this, isVoip); + void setIsVoipAudioMode(boolean isVoip) { + mIsVoipAudioMode = isVoip; + for (Callback c : mCallbacks) { + c.onVoipAudioChanged(this, isVoip); } } /** @hide */ void setStatusHints(StatusHints statusHints) { mStatusHints = statusHints; - for (Listener l : mListeners) { - l.onStatusHintsChanged(this, statusHints); + for (Callback c : mCallbacks) { + c.onStatusHintsChanged(this, statusHints); } } /** @hide */ - void setHandle(Uri handle, int presentation) { - mHandle = handle; - mHandlePresentation = presentation; - for (Listener l : mListeners) { - l.onHandleChanged(this, handle, presentation); + void setAddress(Uri address, int presentation) { + mAddress = address; + mAddressPresentation = presentation; + for (Callback c : mCallbacks) { + c.onAddressChanged(this, address, presentation); } } @@ -926,8 +891,8 @@ public final class RemoteConnection { void setCallerDisplayName(String callerDisplayName, int presentation) { mCallerDisplayName = callerDisplayName; mCallerDisplayNamePresentation = presentation; - for (Listener l : mListeners) { - l.onCallerDisplayNameChanged(this, callerDisplayName, presentation); + for (Callback c : mCallbacks) { + c.onCallerDisplayNameChanged(this, callerDisplayName, presentation); } } @@ -935,8 +900,8 @@ public final class RemoteConnection { void setConferenceableConnections(List<RemoteConnection> conferenceableConnections) { mConferenceableConnections.clear(); mConferenceableConnections.addAll(conferenceableConnections); - for (Listener l : mListeners) { - l.onConferenceableConnectionsChanged(this, mUnmodifiableconferenceableConnections); + for (Callback c : mCallbacks) { + c.onConferenceableConnectionsChanged(this, mUnmodifiableconferenceableConnections); } } @@ -944,8 +909,8 @@ public final class RemoteConnection { void setConference(RemoteConference conference) { if (mConference != conference) { mConference = conference; - for (Listener l : mListeners) { - l.onConferenceChanged(this, conference); + for (Callback c : mCallbacks) { + c.onConferenceChanged(this, conference); } } } diff --git a/telecomm/java/android/telecomm/RemoteConnectionService.java b/telecomm/java/android/telecomm/RemoteConnectionService.java index 8b8e8eb..d4dd9af 100644 --- a/telecomm/java/android/telecomm/RemoteConnectionService.java +++ b/telecomm/java/android/telecomm/RemoteConnectionService.java @@ -61,7 +61,7 @@ final class RemoteConnectionService { mPendingConnections.remove(connection); // Unconditionally initialize the connection ... connection.setCallCapabilities(parcel.getCapabilities()); - connection.setHandle( + connection.setAddress( parcel.getHandle(), parcel.getHandlePresentation()); connection.setCallerDisplayName( parcel.getCallerDisplayName(), @@ -131,9 +131,9 @@ final class RemoteConnectionService { } @Override - public void setRequestingRingback(String callId, boolean ringing) { - findConnectionForAction(callId, "setRequestingRingback") - .setRequestingRingback(ringing); + public void setRingbackRequested(String callId, boolean ringing) { + findConnectionForAction(callId, "setRingbackRequested") + .setRingbackRequested(ringing); } @Override @@ -192,7 +192,7 @@ final class RemoteConnectionService { conference.setState(parcel.getState()); conference.setCallCapabilities(parcel.getCapabilities()); mConferenceById.put(callId, conference); - conference.addCallback(new RemoteConference.Callback() { + conference.registerCallback(new RemoteConference.Callback() { @Override public void onDestroyed(RemoteConference c) { mConferenceById.remove(callId); @@ -238,9 +238,9 @@ final class RemoteConnectionService { } @Override - public void setAudioModeIsVoip(String callId, boolean isVoip) { - findConnectionForAction(callId, "setAudioModeIsVoip") - .setAudioModeIsVoip(isVoip); + public void setIsVoipAudioMode(String callId, boolean isVoip) { + findConnectionForAction(callId, "setIsVoipAudioMode") + .setIsVoipAudioMode(isVoip); } @Override @@ -250,9 +250,9 @@ final class RemoteConnectionService { } @Override - public void setHandle(String callId, Uri handle, int presentation) { - findConnectionForAction(callId, "setHandle") - .setHandle(handle, presentation); + public void setAddress(String callId, Uri address, int presentation) { + findConnectionForAction(callId, "setAddress") + .setAddress(address, presentation); } @Override @@ -343,7 +343,7 @@ final class RemoteConnectionService { id, newRequest, isIncoming); - connection.addListener(new RemoteConnection.Listener() { + connection.registerCallback(new RemoteConnection.Callback() { @Override public void onDestroyed(RemoteConnection connection) { mConnectionById.remove(id); diff --git a/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl index 610178e..4b636d1 100644 --- a/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecomm/IConnectionServiceAdapter.aidl @@ -49,7 +49,7 @@ oneway interface IConnectionServiceAdapter { void setOnHold(String callId); - void setRequestingRingback(String callId, boolean ringing); + void setRingbackRequested(String callId, boolean ringing); void setCallCapabilities(String callId, int callCapabilities); @@ -67,11 +67,11 @@ oneway interface IConnectionServiceAdapter { void setVideoState(String callId, int videoState); - void setAudioModeIsVoip(String callId, boolean isVoip); + void setIsVoipAudioMode(String callId, boolean isVoip); void setStatusHints(String callId, in StatusHints statusHints); - void setHandle(String callId, in Uri handle, int presentation); + void setAddress(String callId, in Uri address, int presentation); void setCallerDisplayName(String callId, String callerDisplayName, int presentation); |