diff --git a/api/current.txt b/api/current.txt index f9ba7814c4d8a..39f67f79808ca 100644 --- a/api/current.txt +++ b/api/current.txt @@ -27451,6 +27451,12 @@ package android.telecomm { field public static final int SWAP_CALLS = 8; // 0x8 } + public final class CallFeatures { + field public static final int NONE = 0; // 0x0 + field public static final int VoLTE = 1; // 0x1 + field public static final int VoWIFI = 2; // 0x2 + } + public final class CallInfo implements android.os.Parcelable { ctor public CallInfo(java.lang.String, android.telecomm.CallState, android.net.Uri); method public int describeContents(); @@ -27487,6 +27493,7 @@ package android.telecomm { method protected void onAdapterAttached(android.telecomm.CallServiceAdapter); method public abstract void onAudioStateChanged(java.lang.String, android.telecomm.CallAudioState); method public final android.os.IBinder onBind(android.content.Intent); + method public abstract void onFeaturesChanged(java.lang.String, int); method public void onPostDialContinue(java.lang.String, boolean); method public abstract void playDtmfTone(java.lang.String, char); method public abstract void reject(java.lang.String); @@ -27508,6 +27515,7 @@ package android.telecomm { method public void setCallVideoProvider(java.lang.String, android.telecomm.CallVideoProvider); method public void setDialing(java.lang.String); method public void setDisconnected(java.lang.String, int, java.lang.String); + method public void setFeatures(java.lang.String, int); method public void setOnHold(java.lang.String); method public void setRequestingRingback(java.lang.String, boolean); method public void setRinging(java.lang.String); @@ -27590,6 +27598,7 @@ package android.telecomm { ctor protected Connection(); method public final android.telecomm.CallAudioState getCallAudioState(); method public final java.util.List getChildConnections(); + method public final int getFeatures(); method public final android.net.Uri getHandle(); method public final android.telecomm.Connection getParentConnection(); method public final int getState(); @@ -27615,6 +27624,7 @@ package android.telecomm { method public final void setDestroyed(); method public final void setDialing(); method public final void setDisconnected(int, java.lang.String); + method public final void setFeatures(int); method public final void setHandle(android.net.Uri); method public final void setIsConferenceCapable(boolean); method public final void setOnHold(); @@ -27626,6 +27636,35 @@ package android.telecomm { method public static java.lang.String stateToString(int); } + public static abstract interface Connection.Listener { + method public abstract void onAudioStateChanged(android.telecomm.Connection, android.telecomm.CallAudioState); + method public abstract void onConferenceCapableChanged(android.telecomm.Connection, boolean); + method public abstract void onDestroyed(android.telecomm.Connection); + method public abstract void onDisconnected(android.telecomm.Connection, int, java.lang.String); + method public abstract void onFeaturesChanged(android.telecomm.Connection, int); + method public abstract void onHandleChanged(android.telecomm.Connection, android.net.Uri); + method public abstract void onParentConnectionChanged(android.telecomm.Connection, android.telecomm.Connection); + method public abstract void onRequestingRingback(android.telecomm.Connection, boolean); + method public abstract void onSetCallVideoProvider(android.telecomm.Connection, android.telecomm.CallVideoProvider); + method public abstract void onSignalChanged(android.telecomm.Connection, android.os.Bundle); + method public abstract void onStateChanged(android.telecomm.Connection, int); + } + + public static class Connection.ListenerBase implements android.telecomm.Connection.Listener { + ctor public Connection.ListenerBase(); + method public void onAudioStateChanged(android.telecomm.Connection, android.telecomm.CallAudioState); + method public void onConferenceCapableChanged(android.telecomm.Connection, boolean); + method public void onDestroyed(android.telecomm.Connection); + method public void onDisconnected(android.telecomm.Connection, int, java.lang.String); + method public void onFeaturesChanged(android.telecomm.Connection, int); + method public void onHandleChanged(android.telecomm.Connection, android.net.Uri); + method public void onParentConnectionChanged(android.telecomm.Connection, android.telecomm.Connection); + method public void onRequestingRingback(android.telecomm.Connection, boolean); + method public void onSetCallVideoProvider(android.telecomm.Connection, android.telecomm.CallVideoProvider); + method public void onSignalChanged(android.telecomm.Connection, android.os.Bundle); + method public void onStateChanged(android.telecomm.Connection, int); + } + public final class Connection.State { field public static final int ACTIVE = 3; // 0x3 field public static final int DIALING = 2; // 0x2 @@ -27665,6 +27704,9 @@ package android.telecomm { method protected void onCreateConferenceConnection(java.lang.String, android.telecomm.Connection, android.telecomm.Response); method protected void onCreateConnections(android.telecomm.ConnectionRequest, android.telecomm.ConnectionService.OutgoingCallResponse); method protected void onCreateIncomingConnection(android.telecomm.ConnectionRequest, android.telecomm.Response); + method public final void onFeaturesChanged(java.lang.String, int); + method public final void onPostDialContinue(java.lang.String, boolean); + method public final void onPostDialWait(android.telecomm.Connection, java.lang.String); method public final void playDtmfTone(java.lang.String, char); method public final void reject(java.lang.String); method public final void setIncomingCallId(java.lang.String, android.os.Bundle); @@ -27711,6 +27753,7 @@ package android.telecomm { method public android.telecomm.CallServiceDescriptor getCurrentCallServiceDescriptor(); method public int getDisconnectCauseCode(); method public java.lang.String getDisconnectCauseMsg(); + method public int getFeatures(); method public android.telecomm.GatewayInfo getGatewayInfo(); method public android.net.Uri getHandle(); method public android.telecomm.CallServiceDescriptor getHandoffCallServiceDescriptor(); diff --git a/telecomm/java/android/telecomm/CallFeatures.java b/telecomm/java/android/telecomm/CallFeatures.java new file mode 100644 index 0000000000000..076d25afdbae8 --- /dev/null +++ b/telecomm/java/android/telecomm/CallFeatures.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package android.telecomm; + +/** + * Defines features of a call. These features represent properties of a call for which it may be + * desirable to display an in-call indicator. + */ +public final class CallFeatures { + private CallFeatures() {}; + + public static final int NONE = 0x0; + public static final int VoLTE = 0x1; + public static final int VoWIFI = 0x2; +} \ No newline at end of file diff --git a/telecomm/java/android/telecomm/CallService.java b/telecomm/java/android/telecomm/CallService.java index d2caca06b2c81..44380e2e7a8eb 100644 --- a/telecomm/java/android/telecomm/CallService.java +++ b/telecomm/java/android/telecomm/CallService.java @@ -408,4 +408,16 @@ public abstract class CallService extends Service { public abstract void splitFromConference(String callId); public void onPostDialContinue(String callId, boolean proceed) {} + + public void onPostDialWait(Connection conn, String remaining) {} + + /** + * Called when changes to the features of a call occurs. Features are defined in + * {@link android.telecomm.CallFeatures}. The active features for the call are represented as + * bits in the features bit-mask. + * + * @param callId The call to set the features for. + * @param features The new features of the call. + */ + public abstract void onFeaturesChanged(String callId, int features); } diff --git a/telecomm/java/android/telecomm/CallServiceAdapter.java b/telecomm/java/android/telecomm/CallServiceAdapter.java index 8412e806d6d18..1b3c0a3b7c5c7 100644 --- a/telecomm/java/android/telecomm/CallServiceAdapter.java +++ b/telecomm/java/android/telecomm/CallServiceAdapter.java @@ -354,4 +354,22 @@ public final class CallServiceAdapter implements DeathRecipient { } } } + + /** + * Set the features associated with the given call. + * Features are defined in {@link android.telecomm.CallFeatures} and are passed in as a + * bit-mask. + * + * @param callId The unique ID of the call to set features for. + * @param features The features. + */ + public void setFeatures(String callId, int features) { + Log.v(this, "setFeatures: %d", features); + for (ICallServiceAdapter adapter : mAdapters) { + try { + adapter.setFeatures(callId, features); + } catch (RemoteException ignored) { + } + } + } } diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java index f80e4a951411d..73aac2c08025a 100644 --- a/telecomm/java/android/telecomm/Connection.java +++ b/telecomm/java/android/telecomm/Connection.java @@ -34,6 +34,7 @@ public abstract class Connection { /** @hide */ public interface Listener { void onStateChanged(Connection c, int state); + void onFeaturesChanged(Connection c, int features); void onAudioStateChanged(Connection c, CallAudioState state); void onHandleChanged(Connection c, Uri newHandle); void onSignalChanged(Connection c, Bundle details); @@ -51,6 +52,11 @@ public abstract class Connection { @Override public void onStateChanged(Connection c, int state) {} + /** {@inheritDoc} */ + @Override + public void onFeaturesChanged(Connection c, int features) {} + + /** {@inheritDoc} */ @Override public void onAudioStateChanged(Connection c, CallAudioState state) {} @@ -97,6 +103,7 @@ public abstract class Connection { private final List mChildConnections = new ArrayList<>(); private int mState = State.NEW; + private int mFeatures = CallFeatures.NONE; private CallAudioState mCallAudioState; private Uri mHandle; private boolean mRequestingRingback = false; @@ -130,6 +137,12 @@ public abstract class Connection { return mState; } + /** + * @return The features of the call. These are items for which the InCall UI may wish to + * display a visual indicator. + */ + public final int getFeatures() { return mFeatures; } + /** * @return The audio state of the call, describing how its audio is currently * being routed by the system. This is {@code null} if this Connection @@ -283,6 +296,22 @@ public abstract class Connection { onConference(); } + /** + * Set the features applicable to the connection. These are items for which the InCall UI may + * wish to display a visual indicator. + * Features are defined in {@link android.telecomm.CallFeatures} and are passed in as a + * bit-mask. + * + * @param features The features active. + */ + public final void setFeatures(int features) { + Log.d(this, "setFeatures %d", features); + this.mFeatures = features; + for (Listener l : mListeners) { + l.onFeaturesChanged(this, mFeatures); + } + } + /** * Inform this Connection that the state of its audio output has been changed externally. * diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java index e68efea5b19e1..530e9771bbf37 100644 --- a/telecomm/java/android/telecomm/ConnectionService.java +++ b/telecomm/java/android/telecomm/ConnectionService.java @@ -108,6 +108,14 @@ public abstract class ConnectionService extends CallService { } } + /** {@inheritDoc} */ + @Override + public void onFeaturesChanged(Connection c, int features) { + String id = mIdByConnection.get(c); + Log.d(this, "Adapter set features %d", features); + getAdapter().setFeatures(id, features); + } + @Override public void onDisconnected(Connection c, int cause, String message) { String id = mIdByConnection.get(c); @@ -561,4 +569,18 @@ public abstract class ConnectionService extends CallService { Log.w(this, "%s - Cannot find Connection %s", action, callId); return NULL_CONNECTION; } + + /** + * Handles changes to the features of a connection. + * Features are defined in {@link android.telecomm.CallFeatures} and are passed in as a + * bit-mask. + * + * @param callId The call to set the features for. + * @param features The new features of the call. + */ + @Override + public final void onFeaturesChanged(String callId, int features) { + Log.d(this, "onFeaturesChanged %s %d", callId, features); + findConnectionForAction(callId, "onFeaturesChanged").setFeatures(features); + } } diff --git a/telecomm/java/android/telecomm/InCallCall.java b/telecomm/java/android/telecomm/InCallCall.java index cf31cec5f9cb6..44dd567f78911 100644 --- a/telecomm/java/android/telecomm/InCallCall.java +++ b/telecomm/java/android/telecomm/InCallCall.java @@ -48,6 +48,7 @@ public final class InCallCall implements Parcelable { private RemoteCallVideoProvider mRemoteCallVideoProvider; private final String mParentCallId; private final List mChildCallIds; + private final int mFeatures; /** @hide */ public InCallCall( @@ -65,7 +66,8 @@ public final class InCallCall implements Parcelable { CallServiceDescriptor handoffDescriptor, ICallVideoProvider callVideoProvider, String parentCallId, - List childCallIds) { + List childCallIds, + int features) { mId = id; mState = state; mDisconnectCauseCode = disconnectCauseCode; @@ -81,6 +83,7 @@ public final class InCallCall implements Parcelable { mCallVideoProvider = callVideoProvider; mParentCallId = parentCallId; mChildCallIds = childCallIds; + mFeatures = features; } /** The unique ID of the call. */ @@ -187,6 +190,15 @@ public final class InCallCall implements Parcelable { return mChildCallIds; } + /** + * The features of this call (e.g. VoLTE, VoWIFI). + * + * @return Features. + */ + public int getFeatures() { + return mFeatures; + } + /** Responsible for creating InCallCall objects for deserialized Parcels. */ public static final Parcelable.Creator CREATOR = new Parcelable.Creator () { @@ -211,10 +223,11 @@ public final class InCallCall implements Parcelable { String parentCallId = source.readString(); List childCallIds = new ArrayList<>(); source.readList(childCallIds, classLoader); + int features = source.readInt(); return new InCallCall(id, state, disconnectCauseCode, disconnectCauseMsg, cannedSmsResponses, capabilities, connectTimeMillis, handle, gatewayInfo, subscription, descriptor, handoffDescriptor, callVideoProvider, parentCallId, - childCallIds); + childCallIds, features); } @Override @@ -248,6 +261,7 @@ public final class InCallCall implements Parcelable { mCallVideoProvider != null ? mCallVideoProvider.asBinder() : null); destination.writeString(mParentCallId); destination.writeList(mChildCallIds); + destination.writeInt(mFeatures); } @Override diff --git a/telecomm/java/android/telecomm/RemoteConnectionService.java b/telecomm/java/android/telecomm/RemoteConnectionService.java index 02a100ec4a84f..f6fc69f760afd 100644 --- a/telecomm/java/android/telecomm/RemoteConnectionService.java +++ b/telecomm/java/android/telecomm/RemoteConnectionService.java @@ -193,6 +193,12 @@ public final class RemoteConnectionService implements DeathRecipient { } catch (RemoteException e) { } } + + /** ${inheritDoc} */ + @Override + public void setFeatures(String connectionId, int features) { + // not supported for remote connections. + } }; RemoteConnectionService(ComponentName componentName, ICallService callService) diff --git a/telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl b/telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl index b81ef3745e339..e78762d34eb47 100644 --- a/telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl @@ -65,4 +65,6 @@ oneway interface ICallServiceAdapter { void queryRemoteConnectionServices(RemoteServiceCallback callback); void setCallVideoProvider(String callId, ICallVideoProvider callVideoProvider); + + void setFeatures(String callId, int features); }