diff options
Diffstat (limited to 'telecomm/java/android')
-rw-r--r-- | telecomm/java/android/telecom/Call.java | 1 | ||||
-rw-r--r-- | telecomm/java/android/telecom/Connection.java | 69 | ||||
-rw-r--r-- | telecomm/java/android/telecom/ConnectionRequest.java | 5 | ||||
-rw-r--r-- | telecomm/java/android/telecom/ConnectionService.java | 38 | ||||
-rw-r--r-- | telecomm/java/android/telecom/DisconnectCause.java | 27 | ||||
-rw-r--r-- | telecomm/java/android/telecom/TelecomManager.java | 23 | ||||
-rwxr-xr-x | telecomm/java/android/telecom/TransformationInfo.java | 127 |
7 files changed, 241 insertions, 49 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index 2341f03d2ec5..8c18518a6d67 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -422,7 +422,6 @@ public final class Call { /** * Indicates the call used Assisted Dialing. * See also {@link Connection#PROPERTY_ASSISTED_DIALING_USED} - * @hide */ public static final int PROPERTY_ASSISTED_DIALING_USED = 0x00000200; diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 69cc3dedf256..322970544281 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -23,7 +23,6 @@ import com.android.internal.telecom.IVideoProvider; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; -import android.annotation.TestApi; import android.app.Notification; import android.bluetooth.BluetoothDevice; import android.content.Intent; @@ -36,6 +35,7 @@ import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.ParcelFileDescriptor; +import android.os.Parcelable; import android.os.RemoteException; import android.os.SystemClock; import android.util.ArraySet; @@ -400,14 +400,11 @@ public abstract class Connection extends Conferenceable { /** * Set by the framework to indicate that a connection has an active RTT session associated with * it. - * @hide */ - @TestApi public static final int PROPERTY_IS_RTT = 1 << 8; /** * Set by the framework to indicate that a connection is using assisted dialing. - * @hide */ public static final int PROPERTY_ASSISTED_DIALING_USED = 1 << 9; @@ -796,6 +793,10 @@ public abstract class Connection extends Conferenceable { builder.append(isLong ? " PROPERTY_HAS_CDMA_VOICE_PRIVACY" : " priv"); } + if (can(properties, PROPERTY_IS_RTT)) { + builder.append(isLong ? " PROPERTY_IS_RTT" : " rtt"); + } + builder.append("]"); return builder.toString(); } @@ -843,9 +844,7 @@ public abstract class Connection extends Conferenceable { /** * Provides methods to read and write RTT data to/from the in-call app. - * @hide */ - @TestApi public static final class RttTextStream { private static final int READ_BUFFER_SIZE = 1000; private final InputStreamReader mPipeFromInCall; @@ -1696,6 +1695,8 @@ public abstract class Connection extends Conferenceable { // The internal telecom call ID associated with this connection. private String mTelecomCallId; + // The PhoneAccountHandle associated with this connection. + private PhoneAccountHandle mPhoneAccountHandle; private int mState = STATE_NEW; private CallAudioState mCallAudioState; private Uri mAddress; @@ -2547,6 +2548,19 @@ public abstract class Connection extends Conferenceable { } /** + * Adds a parcelable extra to this {@code Connection}. + * + * @param key The extra key. + * @param value The value. + * @hide + */ + public final void putExtra(@NonNull String key, @NonNull Parcelable value) { + Bundle newExtras = new Bundle(); + newExtras.putParcelable(key, value); + putExtras(newExtras); + } + + /** * Removes extras from this {@code Connection}. * * @param keys The keys of the extras to remove. @@ -2618,10 +2632,8 @@ public abstract class Connection extends Conferenceable { /** * Informs listeners that a previously requested RTT session via * {@link ConnectionRequest#isRequestingRtt()} or - * {@link #onStartRtt(ParcelFileDescriptor, ParcelFileDescriptor)} has succeeded. - * @hide + * {@link #onStartRtt(RttTextStream)} has succeeded. */ - @TestApi public final void sendRttInitiationSuccess() { setRttProperty(); mListeners.forEach((l) -> l.onRttInitiationSuccess(Connection.this)); @@ -2629,14 +2641,11 @@ public abstract class Connection extends Conferenceable { /** * Informs listeners that a previously requested RTT session via - * {@link ConnectionRequest#isRequestingRtt()} or - * {@link #onStartRtt(ParcelFileDescriptor, ParcelFileDescriptor)} + * {@link ConnectionRequest#isRequestingRtt()} or {@link #onStartRtt(RttTextStream)} * has failed. * @param reason One of the reason codes defined in {@link RttModifyStatus}, with the * exception of {@link RttModifyStatus#SESSION_MODIFY_REQUEST_SUCCESS}. - * @hide */ - @TestApi public final void sendRttInitiationFailure(int reason) { unsetRttProperty(); mListeners.forEach((l) -> l.onRttInitiationFailure(Connection.this, reason)); @@ -2645,19 +2654,16 @@ public abstract class Connection extends Conferenceable { /** * Informs listeners that a currently active RTT session has been terminated by the remote * side of the coll. - * @hide */ - @TestApi public final void sendRttSessionRemotelyTerminated() { + unsetRttProperty(); mListeners.forEach((l) -> l.onRttSessionRemotelyTerminated(Connection.this)); } /** * Informs listeners that the remote side of the call has requested an upgrade to include an * RTT session in the call. - * @hide */ - @TestApi public final void sendRemoteRttRequest() { mListeners.forEach((l) -> l.onRemoteRttRequest(Connection.this)); } @@ -2856,7 +2862,7 @@ public abstract class Connection extends Conferenceable { * Notifies this {@link Connection} that a handover has completed. * <p> * A handover is initiated with {@link android.telecom.Call#handoverTo(PhoneAccountHandle, int, - * Bundle)} on the initiating side of the handover, and on the receiving side with + * Bundle)} on the initiating side of the handover, and * {@link TelecomManager#acceptHandover(Uri, int, PhoneAccountHandle)}. */ public void onHandoverComplete() {} @@ -2931,17 +2937,13 @@ public abstract class Connection extends Conferenceable { * request, respectively. * @param rttTextStream The object that should be used to send text to or receive text from * the in-call app. - * @hide */ - @TestApi public void onStartRtt(@NonNull RttTextStream rttTextStream) {} /** * Notifies this {@link Connection} that it should terminate any existing RTT communication * channel. No response to Telecom is needed for this method. - * @hide */ - @TestApi public void onStopRtt() {} /** @@ -2949,11 +2951,9 @@ public abstract class Connection extends Conferenceable { * request sent via {@link #sendRemoteRttRequest}. Acceptance of the request is * indicated by the supplied {@link RttTextStream} being non-null, and rejection is * indicated by {@code rttTextStream} being {@code null} - * @hide * @param rttTextStream The object that should be used to send text to or receive text from * the in-call app. */ - @TestApi public void handleRttUpgradeResponse(@Nullable RttTextStream rttTextStream) {} /** @@ -3168,6 +3168,27 @@ public abstract class Connection extends Conferenceable { } /** + * Sets the {@link PhoneAccountHandle} associated with this connection. + * + * @hide + */ + public void setPhoneAccountHandle(PhoneAccountHandle phoneAccountHandle) { + if (mPhoneAccountHandle != phoneAccountHandle) { + mPhoneAccountHandle = phoneAccountHandle; + notifyPhoneAccountChanged(phoneAccountHandle); + } + } + + /** + * Returns the {@link PhoneAccountHandle} associated with this connection. + * + * @hide + */ + public PhoneAccountHandle getPhoneAccountHandle() { + return mPhoneAccountHandle; + } + + /** * Sends an event associated with this {@code Connection} with associated event extras to the * {@link InCallService}. * <p> diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java index e169e5f80741..658b4734b0b5 100644 --- a/telecomm/java/android/telecom/ConnectionRequest.java +++ b/telecomm/java/android/telecom/ConnectionRequest.java @@ -16,7 +16,6 @@ package android.telecom; -import android.annotation.TestApi; import android.net.Uri; import android.os.Bundle; import android.os.Parcel; @@ -310,9 +309,7 @@ public final class ConnectionRequest implements Parcelable { * send and receive RTT text to/from the in-call app. * @return An instance of {@link android.telecom.Connection.RttTextStream}, or {@code null} * if this connection request is not requesting an RTT session upon connection establishment. - * @hide */ - @TestApi public Connection.RttTextStream getRttTextStream() { if (isRequestingRtt()) { return new Connection.RttTextStream(mRttPipeToInCall, mRttPipeFromInCall); @@ -324,9 +321,7 @@ public final class ConnectionRequest implements Parcelable { /** * Convenience method for determining whether the ConnectionRequest is requesting an RTT session * @return {@code true} if RTT is requested, {@code false} otherwise. - * @hide */ - @TestApi public boolean isRequestingRtt() { return mRttPipeFromInCall != null && mRttPipeToInCall != null; } diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 46d6b4201497..1547857f23e3 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -145,9 +145,9 @@ public abstract class ConnectionService extends Service { private static final String SESSION_START_RTT = "CS.+RTT"; private static final String SESSION_STOP_RTT = "CS.-RTT"; private static final String SESSION_RTT_UPGRADE_RESPONSE = "CS.rTRUR"; - private static final String SESSION_HANDOVER_FAILED = "CS.haF"; private static final String SESSION_CONNECTION_SERVICE_FOCUS_LOST = "CS.cSFL"; private static final String SESSION_CONNECTION_SERVICE_FOCUS_GAINED = "CS.cSFG"; + private static final String SESSION_HANDOVER_FAILED = "CS.haF"; private static final int MSG_ADD_CONNECTION_SERVICE_ADAPTER = 1; private static final int MSG_CREATE_CONNECTION = 2; @@ -1532,7 +1532,7 @@ public abstract class ConnectionService extends Service { connection.setTelecomCallId(callId); if (connection.getState() != Connection.STATE_DISCONNECTED) { - addConnection(callId, connection); + addConnection(request.getAccountHandle(), callId, connection); } Uri address = connection.getAddress(); @@ -2021,6 +2021,7 @@ public abstract class ConnectionService extends Service { mAdapter.setIsConferenced(connectionId, id); } } + onConferenceAdded(conference); } } @@ -2278,6 +2279,30 @@ public abstract class ConnectionService extends Service { public void onConference(Connection connection1, Connection connection2) {} /** + * Called when a connection is added. + * @hide + */ + public void onConnectionAdded(Connection connection) {} + + /** + * Called when a connection is removed. + * @hide + */ + public void onConnectionRemoved(Connection connection) {} + + /** + * Called when a conference is added. + * @hide + */ + public void onConferenceAdded(Conference conference) {} + + /** + * Called when a conference is removed. + * @hide + */ + public void onConferenceRemoved(Conference conference) {} + + /** * Indicates that a remote conference has been created for existing {@link RemoteConnection}s. * When this method is invoked, this {@link ConnectionService} should create its own * representation of the conference call and send it to telecom using {@link #addConference}. @@ -2358,16 +2383,18 @@ public abstract class ConnectionService extends Service { // prefix for a unique incremental call ID. id = handle.getComponentName().getClassName() + "@" + getNextCallId(); } - addConnection(id, connection); + addConnection(handle, id, connection); return id; } - private void addConnection(String callId, Connection connection) { + private void addConnection(PhoneAccountHandle handle, String callId, Connection connection) { connection.setTelecomCallId(callId); mConnectionById.put(callId, connection); mIdByConnection.put(connection, callId); connection.addConnectionListener(mConnectionListener); connection.setConnectionService(this); + connection.setPhoneAccountHandle(handle); + onConnectionAdded(connection); } /** {@hide} */ @@ -2379,6 +2406,7 @@ public abstract class ConnectionService extends Service { mConnectionById.remove(id); mIdByConnection.remove(connection); mAdapter.removeCall(id); + onConnectionRemoved(connection); } } @@ -2415,6 +2443,8 @@ public abstract class ConnectionService extends Service { mConferenceById.remove(id); mIdByConference.remove(conference); mAdapter.removeCall(id); + + onConferenceRemoved(conference); } } diff --git a/telecomm/java/android/telecom/DisconnectCause.java b/telecomm/java/android/telecom/DisconnectCause.java index dcf5c271d0eb..1de67a5883e3 100644 --- a/telecomm/java/android/telecom/DisconnectCause.java +++ b/telecomm/java/android/telecom/DisconnectCause.java @@ -33,47 +33,48 @@ import java.util.Objects; public final class DisconnectCause implements Parcelable { /** Disconnected because of an unknown or unspecified reason. */ - public static final int UNKNOWN = 0; + public static final int UNKNOWN = TelecomProtoEnums.UNKNOWN; // = 0 /** Disconnected because there was an error, such as a problem with the network. */ - public static final int ERROR = 1; + public static final int ERROR = TelecomProtoEnums.ERROR; // = 1 /** Disconnected because of a local user-initiated action, such as hanging up. */ - public static final int LOCAL = 2; + public static final int LOCAL = TelecomProtoEnums.LOCAL; // = 2 /** * Disconnected because of a remote user-initiated action, such as the other party hanging up * up. */ - public static final int REMOTE = 3; + public static final int REMOTE = TelecomProtoEnums.REMOTE; // = 3 /** Disconnected because it has been canceled. */ - public static final int CANCELED = 4; + public static final int CANCELED = TelecomProtoEnums.CANCELED; // = 4 /** Disconnected because there was no response to an incoming call. */ - public static final int MISSED = 5; + public static final int MISSED = TelecomProtoEnums.MISSED; // = 5 /** Disconnected because the user rejected an incoming call. */ - public static final int REJECTED = 6; + public static final int REJECTED = TelecomProtoEnums.REJECTED; // = 6 /** Disconnected because the other party was busy. */ - public static final int BUSY = 7; + public static final int BUSY = TelecomProtoEnums.BUSY; // = 7 /** * Disconnected because of a restriction on placing the call, such as dialing in airplane * mode. */ - public static final int RESTRICTED = 8; + public static final int RESTRICTED = TelecomProtoEnums.RESTRICTED; // = 8 /** Disconnected for reason not described by other disconnect codes. */ - public static final int OTHER = 9; + public static final int OTHER = TelecomProtoEnums.OTHER; // = 9 /** * Disconnected because the connection manager did not support the call. The call will be tried * again without a connection manager. See {@link PhoneAccount#CAPABILITY_CONNECTION_MANAGER}. */ - public static final int CONNECTION_MANAGER_NOT_SUPPORTED = 10; + public static final int CONNECTION_MANAGER_NOT_SUPPORTED = + TelecomProtoEnums.CONNECTION_MANAGER_NOT_SUPPORTED; // = 10 /** * Disconnected because the user did not locally answer the incoming call, but it was answered * on another device where the call was ringing. */ - public static final int ANSWERED_ELSEWHERE = 11; + public static final int ANSWERED_ELSEWHERE = TelecomProtoEnums.ANSWERED_ELSEWHERE; // = 11 /** * Disconnected because the call was pulled from the current device to another device. */ - public static final int CALL_PULLED = 12; + public static final int CALL_PULLED = TelecomProtoEnums.CALL_PULLED; // = 12 /** * Reason code (returned via {@link #getReason()}) which indicates that a call could not be diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index c848f77c2c0e..a180da6d6480 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -111,6 +111,12 @@ public class TelecomManager { "android.telecom.action.SHOW_RESPOND_VIA_SMS_SETTINGS"; /** + * The {@link android.content.Intent} action used to show the assisted dialing settings. + */ + public static final String ACTION_SHOW_ASSISTED_DIALING_SETTINGS = + "android.telecom.action.SHOW_ASSISTED_DIALING_SETTINGS"; + + /** * The {@link android.content.Intent} action used to show the settings page used to configure * {@link PhoneAccount} preferences. */ @@ -603,21 +609,34 @@ public class TelecomManager { "android.telecom.extra.CALL_BACK_INTENT"; /** + * The dialer activity responsible for placing emergency calls from, for example, a locked + * keyguard. + * @hide + */ + public static final ComponentName EMERGENCY_DIALER_COMPONENT = + ComponentName.createRelative("com.android.phone", ".EmergencyDialer"); + + /** * The boolean indicated by this extra controls whether or not a call is eligible to undergo * assisted dialing. This extra is stored under {@link #EXTRA_OUTGOING_CALL_EXTRAS}. - * @hide */ public static final String EXTRA_USE_ASSISTED_DIALING = "android.telecom.extra.USE_ASSISTED_DIALING"; /** + * The bundle indicated by this extra store information related to the assisted dialing action. + */ + public static final String EXTRA_ASSISTED_DIALING_TRANSFORMATION_INFO = + "android.telecom.extra.ASSISTED_DIALING_TRANSFORMATION_INFO"; + + /** * The following 4 constants define how properties such as phone numbers and names are * displayed to the user. */ /** * Indicates that the address or number of a call is allowed to be displayed for caller ID. - */ + */ public static final int PRESENTATION_ALLOWED = 1; /** diff --git a/telecomm/java/android/telecom/TransformationInfo.java b/telecomm/java/android/telecom/TransformationInfo.java new file mode 100755 index 000000000000..3e848c6f2f80 --- /dev/null +++ b/telecomm/java/android/telecom/TransformationInfo.java @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2017 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.telecom; + +import android.os.Parcelable; +import android.os.Parcel; + +/** + * A container class to hold information related to the Assisted Dialing operation. All member + * variables must be set when constructing a new instance of this class. + */ +public final class TransformationInfo implements Parcelable { + private String mOriginalNumber; + private String mTransformedNumber; + private String mUserHomeCountryCode; + private String mUserRoamingCountryCode; + private int mTransformedNumberCountryCallingCode; + + public TransformationInfo(String originalNumber, + String transformedNumber, + String userHomeCountryCode, + String userRoamingCountryCode, + int transformedNumberCountryCallingCode) { + String missing = ""; + if (originalNumber == null) { + missing += " mOriginalNumber"; + } + if (transformedNumber == null) { + missing += " mTransformedNumber"; + } + if (userHomeCountryCode == null) { + missing += " mUserHomeCountryCode"; + } + if (userRoamingCountryCode == null) { + missing += " mUserRoamingCountryCode"; + } + + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing required properties:" + missing); + } + this.mOriginalNumber = originalNumber; + this.mTransformedNumber = transformedNumber; + this.mUserHomeCountryCode = userHomeCountryCode; + this.mUserRoamingCountryCode = userRoamingCountryCode; + this.mTransformedNumberCountryCallingCode = transformedNumberCountryCallingCode; + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel out, int flags) { + out.writeString(mOriginalNumber); + out.writeString(mTransformedNumber); + out.writeString(mUserHomeCountryCode); + out.writeString(mUserRoamingCountryCode); + out.writeInt(mTransformedNumberCountryCallingCode); + } + + public static final Parcelable.Creator<TransformationInfo> CREATOR + = new Parcelable.Creator<TransformationInfo>() { + public TransformationInfo createFromParcel(Parcel in) { + return new TransformationInfo(in); + } + + public TransformationInfo[] newArray(int size) { + return new TransformationInfo[size]; + } + }; + + private TransformationInfo(Parcel in) { + mOriginalNumber = in.readString(); + mTransformedNumber = in.readString(); + mUserHomeCountryCode = in.readString(); + mUserRoamingCountryCode = in.readString(); + mTransformedNumberCountryCallingCode = in.readInt(); + } + + /** + * The original number that underwent Assisted Dialing. + */ + public String getOriginalNumber() { + return mOriginalNumber; + } + + /** + * The number after it underwent Assisted Dialing. + */ + public String getTransformedNumber() { + return mTransformedNumber; + } + + /** + * The user's home country code that was used when attempting to transform the number. + */ + public String getUserHomeCountryCode() { + return mUserHomeCountryCode; + } + + /** + * The users's roaming country code that was used when attempting to transform the number. + */ + public String getUserRoamingCountryCode() { + return mUserRoamingCountryCode; + } + + /** + * The country calling code that was used in the transformation. + */ + public int getTransformedNumberCountryCallingCode() { + return mTransformedNumberCountryCallingCode; + } +} |