diff options
author | Ihab Awad <ihab@google.com> | 2014-06-10 13:29:47 -0700 |
---|---|---|
committer | Ihab Awad <ihab@google.com> | 2014-06-13 18:05:29 -0700 |
commit | c067754a85017ac16a9b438d807c6004f35c095f (patch) | |
tree | a57e5c1076ff709afe7fb83e54e4596b9aa0d7a4 /telecomm | |
parent | a8e9529b739a5ef2b1de6561122e21b778329fcc (diff) | |
download | frameworks_base-c067754a85017ac16a9b438d807c6004f35c095f.zip frameworks_base-c067754a85017ac16a9b438d807c6004f35c095f.tar.gz frameworks_base-c067754a85017ac16a9b438d807c6004f35c095f.tar.bz2 |
DO NOT MERGE. Port "respond via SMS message" feature to new Telecomm. (1/4)
Bug: 15275904
Bug: 15196474
Change-Id: If9aeae519047b221aa2c178d8d2903c4e2054a6d
Diffstat (limited to 'telecomm')
5 files changed, 38 insertions, 9 deletions
diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java index 7aee770..164eeff 100644 --- a/telecomm/java/android/telecomm/Connection.java +++ b/telecomm/java/android/telecomm/Connection.java @@ -107,6 +107,13 @@ public abstract class Connection { protected Connection() {} /** + * The handle (e.g., phone number) to which this Connection is currently communicating. + * + * IMPORTANT: If an incoming connection has a phone number (or other handle) that the user + * is not supposed to be able to see (e.g. it is PRESENTATION_RESTRICTED), then a compliant + * ConnectionService implementation MUST NOT reveal this phone number and MUST return + * {@code null} from this method. + * * @return The handle (e.g., phone number) to which this Connection * is currently communicating. */ diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java index 9dfad2d..d974509 100644 --- a/telecomm/java/android/telecomm/ConnectionService.java +++ b/telecomm/java/android/telecomm/ConnectionService.java @@ -386,6 +386,11 @@ public abstract class ConnectionService extends CallService { /** * Create a Connection to match an incoming connection notification. * + * IMPORTANT: If the incoming connection has a phone number (or other handle) that the user + * is not supposed to be able to see (e.g. it is PRESENTATION_RESTRICTED), then a compliant + * ConnectionService implementation MUST NOT reveal this phone number as part of the Intent + * it sends to notify Telecomm of an incoming connection. + * * @param request Data encapsulating details of the desired Connection. * @param callback A callback for providing the result. */ diff --git a/telecomm/java/android/telecomm/InCallAdapter.java b/telecomm/java/android/telecomm/InCallAdapter.java index 86b7a50..ce52d19 100644 --- a/telecomm/java/android/telecomm/InCallAdapter.java +++ b/telecomm/java/android/telecomm/InCallAdapter.java @@ -59,10 +59,12 @@ public final class InCallAdapter { * is ported over. * * @param callId The identifier of the call to reject. + * @param rejectWithMessage Whether to reject with a text message. + * @param textMessage An optional text message with which to respond. */ - public void rejectCall(String callId) { + public void rejectCall(String callId, boolean rejectWithMessage, String textMessage) { try { - mAdapter.rejectCall(callId); + mAdapter.rejectCall(callId, rejectWithMessage, textMessage); } catch (RemoteException e) { } } diff --git a/telecomm/java/android/telecomm/InCallCall.java b/telecomm/java/android/telecomm/InCallCall.java index 432e378..66974f9 100644 --- a/telecomm/java/android/telecomm/InCallCall.java +++ b/telecomm/java/android/telecomm/InCallCall.java @@ -33,6 +33,7 @@ public final class InCallCall implements Parcelable { private final CallState mState; private final int mDisconnectCauseCode; private final String mDisconnectCauseMsg; + private final List<String> mCannedSmsResponses; private final int mCapabilities; private final long mConnectTimeMillis; private final Uri mHandle; @@ -49,14 +50,16 @@ public final class InCallCall implements Parcelable { CallState state, int disconnectCauseCode, String disconnectCauseMsg, + List<String> cannedSmsResponses, int capabilities, long connectTimeMillis, Uri handle, GatewayInfo gatewayInfo, CallServiceDescriptor descriptor, CallServiceDescriptor handoffDescriptor) { - this(id, state, disconnectCauseCode, disconnectCauseMsg, capabilities, connectTimeMillis, - handle, gatewayInfo, descriptor, handoffDescriptor, null, Collections.EMPTY_LIST); + this(id, state, disconnectCauseCode, disconnectCauseMsg, cannedSmsResponses, + capabilities, connectTimeMillis, handle, gatewayInfo, descriptor, handoffDescriptor, + null, Collections.EMPTY_LIST); } /** @hide */ @@ -65,6 +68,7 @@ public final class InCallCall implements Parcelable { CallState state, int disconnectCauseCode, String disconnectCauseMsg, + List<String> cannedSmsResponses, int capabilities, long connectTimeMillis, Uri handle, @@ -77,6 +81,7 @@ public final class InCallCall implements Parcelable { mState = state; mDisconnectCauseCode = disconnectCauseCode; mDisconnectCauseMsg = disconnectCauseMsg; + mCannedSmsResponses = cannedSmsResponses; mCapabilities = capabilities; mConnectTimeMillis = connectTimeMillis; mHandle = handle; @@ -113,6 +118,13 @@ public final class InCallCall implements Parcelable { return mDisconnectCauseMsg; } + /** + * The set of possible text message responses when this call is incoming. + */ + public List<String> getCannedSmsResponses() { + return mCannedSmsResponses; + } + // Bit mask of actions a call supports, values are defined in {@link CallCapabilities}. public int getCapabilities() { return mCapabilities; @@ -168,13 +180,15 @@ public final class InCallCall implements Parcelable { new Parcelable.Creator<InCallCall> () { @Override public InCallCall createFromParcel(Parcel source) { + ClassLoader classLoader = InCallCall.class.getClassLoader(); String id = source.readString(); CallState state = CallState.valueOf(source.readString()); int disconnectCauseCode = source.readInt(); String disconnectCauseMsg = source.readString(); + List<String> cannedSmsResponses = new ArrayList<>(); + source.readList(cannedSmsResponses, classLoader); int capabilities = source.readInt(); long connectTimeMillis = source.readLong(); - ClassLoader classLoader = InCallCall.class.getClassLoader(); Uri handle = source.readParcelable(classLoader); GatewayInfo gatewayInfo = source.readParcelable(classLoader); CallServiceDescriptor descriptor = source.readParcelable(classLoader); @@ -182,9 +196,9 @@ public final class InCallCall implements Parcelable { String parentCallId = source.readString(); List<String> childCallIds = new ArrayList<>(); source.readList(childCallIds, classLoader); - return new InCallCall(id, state, disconnectCauseCode, disconnectCauseMsg, capabilities, - connectTimeMillis, handle, gatewayInfo, descriptor, handoffDescriptor, - parentCallId, childCallIds); + return new InCallCall(id, state, disconnectCauseCode, disconnectCauseMsg, + cannedSmsResponses, capabilities, connectTimeMillis, handle, gatewayInfo, + descriptor, handoffDescriptor, parentCallId, childCallIds); } @Override @@ -206,6 +220,7 @@ public final class InCallCall implements Parcelable { destination.writeString(mState.name()); destination.writeInt(mDisconnectCauseCode); destination.writeString(mDisconnectCauseMsg); + destination.writeList(mCannedSmsResponses); destination.writeInt(mCapabilities); destination.writeLong(mConnectTimeMillis); destination.writeParcelable(mHandle, 0); diff --git a/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl b/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl index 5717456..b66995a 100644 --- a/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl +++ b/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl @@ -28,7 +28,7 @@ import android.telecomm.CallAudioState; oneway interface IInCallAdapter { void answerCall(String callId); - void rejectCall(String callId); + void rejectCall(String callId, boolean rejectWithMessage, String textMessage); void disconnectCall(String callId); |