From 222db525ed2642caa87cadcb48c4078ce6339b34 Mon Sep 17 00:00:00 2001 From: Evan Charlton Date: Thu, 17 Jul 2014 16:59:18 -0700 Subject: [PATCH] Add a notion of the subscription number Expose the actual subscription number so that it can be exposed when necessary (such as during emergency calls, when it doesn't match the line 1 number). Bug: 13333595 Change-Id: I0d3b2cfcea08aeba760c392c116303f21beb70d3 --- api/current.txt | 5 +++-- telecomm/java/android/telecomm/PhoneAccount.java | 2 -- .../android/telecomm/PhoneAccountMetadata.java | 16 ++++++++++++++++ .../java/android/telecomm/TelecommConstants.java | 13 +++++++------ 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/api/current.txt b/api/current.txt index 9336473e257a4..f20c720f4af7b 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28608,7 +28608,7 @@ package android.telecomm { } public class PhoneAccountMetadata implements android.os.Parcelable { - ctor public PhoneAccountMetadata(android.telecomm.PhoneAccount, android.net.Uri, int, int, java.lang.String, java.lang.String, boolean); + ctor public PhoneAccountMetadata(android.telecomm.PhoneAccount, android.net.Uri, java.lang.String, int, int, java.lang.String, java.lang.String, boolean); method public int describeContents(); method public android.telecomm.PhoneAccount getAccount(); method public int getCapabilities(); @@ -28617,6 +28617,7 @@ package android.telecomm { method public int getIconResId(); method public java.lang.String getLabel(); method public java.lang.String getShortDescription(); + method public java.lang.String getSubscriptionNumber(); method public boolean isVideoCallingSupported(); method public void writeToParcel(android.os.Parcel, int); field public static final int CAPABILITY_CALL_PROVIDER = 2; // 0x2 @@ -28720,10 +28721,10 @@ package android.telecomm { field public static final java.lang.String ACTION_INCOMING_CALL = "android.intent.action.INCOMING_CALL"; field public static final char DTMF_CHARACTER_PAUSE = 44; // 0x002c ',' field public static final char DTMF_CHARACTER_WAIT = 59; // 0x003b ';' + field public static final java.lang.String EXTRA_CALL_BACK_NUMBER = "android.telecomm.extra.CALL_BACK_NUMBER"; field public static final java.lang.String EXTRA_CALL_DISCONNECT_CAUSE = "android.telecomm.extra.CALL_DISCONNECT_CAUSE"; field public static final java.lang.String EXTRA_CALL_DISCONNECT_MESSAGE = "android.telecomm.extra.CALL_DISCONNECT_MESSAGE"; field public static final java.lang.String EXTRA_CONNECTION_SERVICE = "android.telecomm.extra.CONNECTION_SERVICE"; - field public static final java.lang.String EXTRA_EMERGENCY_CALL_BACK_NUMBER = "android.telecomm.extra.EMERGENCY_CALL_BACK_NUMBER"; field public static final java.lang.String EXTRA_INCOMING_CALL_EXTRAS = "android.intent.extra.INCOMING_CALL_EXTRAS"; field public static final java.lang.String EXTRA_PHONE_ACCOUNT = "android.intent.extra.PHONE_ACCOUNT"; field public static final java.lang.String EXTRA_START_CALL_WITH_SPEAKERPHONE = "android.intent.extra.START_CALL_WITH_SPEAKERPHONE"; diff --git a/telecomm/java/android/telecomm/PhoneAccount.java b/telecomm/java/android/telecomm/PhoneAccount.java index edfd846e36863..4d7638b1525f1 100644 --- a/telecomm/java/android/telecomm/PhoneAccount.java +++ b/telecomm/java/android/telecomm/PhoneAccount.java @@ -73,8 +73,6 @@ public class PhoneAccount implements Parcelable { return new StringBuilder().append(mComponentName) .append(", ") .append(mId) - .append(", ") - .append(", ") .toString(); } diff --git a/telecomm/java/android/telecomm/PhoneAccountMetadata.java b/telecomm/java/android/telecomm/PhoneAccountMetadata.java index 899317095ecbf..c52a6fc42d6f6 100644 --- a/telecomm/java/android/telecomm/PhoneAccountMetadata.java +++ b/telecomm/java/android/telecomm/PhoneAccountMetadata.java @@ -66,6 +66,7 @@ public class PhoneAccountMetadata implements Parcelable { private final PhoneAccount mAccount; private final Uri mHandle; + private final String mSubscriptionNumber; private final int mCapabilities; private final int mIconResId; private final String mLabel; @@ -75,6 +76,7 @@ public class PhoneAccountMetadata implements Parcelable { public PhoneAccountMetadata( PhoneAccount account, Uri handle, + String subscriptionNumber, int capabilities, int iconResId, String label, @@ -82,6 +84,7 @@ public class PhoneAccountMetadata implements Parcelable { boolean supportsVideoCalling) { mAccount = account; mHandle = handle; + mSubscriptionNumber = subscriptionNumber; mCapabilities = capabilities; mIconResId = iconResId; mLabel = label; @@ -110,6 +113,17 @@ public class PhoneAccountMetadata implements Parcelable { return mHandle; } + /** + * The subscription number associated with the underlying transport. This may differ from the + * {@link #getHandle()} number; for example, if the number used to talk to the network is not + * the same number that will be on the remote party's caller ID display. + * + * @return The subscription number, suitable for display to the user. + */ + public String getSubscriptionNumber() { + return mSubscriptionNumber; + } + /** * The capabilities of this {@code PhoneAccount}. * @@ -195,6 +209,7 @@ public class PhoneAccountMetadata implements Parcelable { public void writeToParcel(Parcel out, int flags) { out.writeParcelable(mAccount, 0); out.writeParcelable(mHandle, 0); + out.writeString(mSubscriptionNumber); out.writeInt(mCapabilities); out.writeInt(mIconResId); out.writeString(mLabel); @@ -218,6 +233,7 @@ public class PhoneAccountMetadata implements Parcelable { private PhoneAccountMetadata(Parcel in) { mAccount = in.readParcelable(getClass().getClassLoader()); mHandle = in.readParcelable(getClass().getClassLoader()); + mSubscriptionNumber = in.readString(); mCapabilities = in.readInt(); mIconResId = in.readInt(); mLabel = in.readString(); diff --git a/telecomm/java/android/telecomm/TelecommConstants.java b/telecomm/java/android/telecomm/TelecommConstants.java index 0ede387aeb0ae..0ae0c83659f90 100644 --- a/telecomm/java/android/telecomm/TelecommConstants.java +++ b/telecomm/java/android/telecomm/TelecommConstants.java @@ -111,14 +111,15 @@ public final class TelecommConstants { "android.telecomm.extra.CONNECTION_SERVICE"; /** - * The number which emergency services will use to return calls, if necessary. The in-call UI - * will take care of displaying this to the user. + * The number which the party on the other side of the line will see (and use to return the + * call). *

- * Note that this should only be populated for emergency numbers, and if the number emergency - * services will see is different than the user's known phone number. + * {@link android.telecomm.ConnectionService}s which interact with + * {@link android.telecomm.RemoteConnection}s should only populate this if the + * {@link android.telephony.TelephonyManager#getLine1Number()} value, as that is the user's + * expected caller ID. */ - public static final String EXTRA_EMERGENCY_CALL_BACK_NUMBER = - "android.telecomm.extra.EMERGENCY_CALL_BACK_NUMBER"; + public static final String EXTRA_CALL_BACK_NUMBER = "android.telecomm.extra.CALL_BACK_NUMBER"; /** * The dual tone multi-frequency signaling character sent to indicate the dialing system should