diff --git a/api/current.txt b/api/current.txt index f5b510725e470..009655c3734f4 100644 --- a/api/current.txt +++ b/api/current.txt @@ -22870,6 +22870,7 @@ package android.provider { field public static final java.lang.String CACHED_NUMBER_LABEL = "numberlabel"; field public static final java.lang.String CACHED_NUMBER_TYPE = "numbertype"; field public static final java.lang.String CACHED_PHOTO_ID = "photo_id"; + field public static final java.lang.String SUBSCRIPTION_COMPONENT_NAME = "component_name"; field public static final android.net.Uri CONTENT_FILTER_URI; field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/calls"; field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/calls"; @@ -22893,6 +22894,7 @@ package android.provider { field public static final int PRESENTATION_PAYPHONE = 4; // 0x4 field public static final int PRESENTATION_RESTRICTED = 2; // 0x2 field public static final int PRESENTATION_UNKNOWN = 3; // 0x3 + field public static final java.lang.String SUBSCRIPTION_ID = "subscription_id"; field public static final java.lang.String TYPE = "type"; field public static final int VOICEMAIL_TYPE = 4; // 0x4 field public static final java.lang.String VOICEMAIL_URI = "voicemail_uri"; @@ -27594,6 +27596,7 @@ package android.telecomm { method public java.lang.String getId(); method public android.net.Uri getOriginalHandle(); method public android.telecomm.CallState getState(); + method public android.telecomm.Subscription getSubscription(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; } @@ -27872,6 +27875,7 @@ package android.telecomm { method public android.telecomm.CallServiceDescriptor getHandoffCallServiceDescriptor(); method public java.lang.String getId(); method public android.telecomm.CallState getState(); + method public android.telecomm.Subscription getSubscription(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; } diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java index 3b0d7ff171f4f..8eefd9ce998af 100644 --- a/core/java/android/provider/CallLog.java +++ b/core/java/android/provider/CallLog.java @@ -25,6 +25,7 @@ import android.net.Uri; import android.provider.ContactsContract.CommonDataKinds.Callable; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.DataUsageFeedback; +import android.telecomm.Subscription; import android.text.TextUtils; import com.android.internal.telephony.CallerInfo; @@ -275,6 +276,18 @@ public class CallLog { */ public static final String CACHED_FORMATTED_NUMBER = "formatted_number"; + /** + * The component name of the subscription in string form. + *
Type: TEXT
+ */ + public static final String SUBSCRIPTION_COMPONENT_NAME = "subscription_component_name"; + + /** + * The identifier of a subscription that is unique to a specified component. + *Type: TEXT
+ */ + public static final String SUBSCRIPTION_ID = "subscription_id"; + /** * Adds a call to the call log. * @@ -286,13 +299,14 @@ public class CallLog { * is set by the network and denotes the number presenting rules for * "allowed", "payphone", "restricted" or "unknown" * @param callType enumerated values for "incoming", "outgoing", or "missed" + * @param subscription The subscription object describing the provider of the call * @param start time stamp for the call in milliseconds * @param duration call duration in seconds * * {@hide} */ public static Uri addCall(CallerInfo ci, Context context, String number, - int presentation, int callType, long start, int duration) { + int presentation, int callType, Subscription subscription, long start, int duration) { final ContentResolver resolver = context.getContentResolver(); int numberPresentation = PRESENTATION_ALLOWED; @@ -316,6 +330,14 @@ public class CallLog { } } + // subscription information + String subscriptionComponentString = null; + String subscriptionId = null; + if (subscription != null) { + subscriptionComponentString = subscription.getComponentName().flattenToString(); + subscriptionId = subscription.getId(); + } + ContentValues values = new ContentValues(6); values.put(NUMBER, number); @@ -323,6 +345,8 @@ public class CallLog { values.put(TYPE, Integer.valueOf(callType)); values.put(DATE, Long.valueOf(start)); values.put(DURATION, Long.valueOf(duration)); + values.put(SUBSCRIPTION_COMPONENT_NAME, subscriptionComponentString); + values.put(SUBSCRIPTION_ID, subscriptionId); values.put(NEW, Integer.valueOf(1)); if (callType == MISSED_TYPE) { values.put(IS_READ, Integer.valueOf(0)); diff --git a/telecomm/java/android/telecomm/CallInfo.java b/telecomm/java/android/telecomm/CallInfo.java index 4de9373ddce4d..17efed5508d73 100644 --- a/telecomm/java/android/telecomm/CallInfo.java +++ b/telecomm/java/android/telecomm/CallInfo.java @@ -24,7 +24,7 @@ import android.os.Parcelable; import java.util.Date; /** - * A parcelable holder class of Call information data. This class is intended for transfering call + * A parcelable holder class of Call information data. This class is intended for transferring call * information from Telecomm to call services and thus is read-only. * TODO(santoscordon): Need final public-facing comments in this file. */ @@ -51,6 +51,11 @@ public final class CallInfo implements Parcelable { */ private final GatewayInfo mGatewayInfo; + /** + * Subscription information for the call. + */ + private final Subscription mSubscription; + /** * Additional information that can be persisted. */ @@ -60,7 +65,7 @@ public final class CallInfo implements Parcelable { private final CallServiceDescriptor mCurrentCallServiceDescriptor; public CallInfo(String id, CallState state, Uri handle) { - this(id, state, handle, null, Bundle.EMPTY, null); + this(id, state, handle, null, null, Bundle.EMPTY, null); } /** @@ -70,6 +75,7 @@ public final class CallInfo implements Parcelable { * @param state The state of the call. * @param handle The handle to the other party in this call. * @param gatewayInfo Gateway information pertaining to this call. + * @param subscription Subscription information pertaining to this call. * @param extras Additional information that can be persisted. * @param currentCallServiceDescriptor The descriptor for the call service currently routing * this call. @@ -81,12 +87,14 @@ public final class CallInfo implements Parcelable { CallState state, Uri handle, GatewayInfo gatewayInfo, + Subscription subscription, Bundle extras, CallServiceDescriptor currentCallServiceDescriptor) { mId = id; mState = state; mHandle = handle; mGatewayInfo = gatewayInfo; + mSubscription = subscription; mExtras = extras; mCurrentCallServiceDescriptor = currentCallServiceDescriptor; } @@ -119,6 +127,10 @@ public final class CallInfo implements Parcelable { return mGatewayInfo; } + public Subscription getSubscription() { + return mSubscription; + } + public Bundle getExtras() { return mExtras; } @@ -137,16 +149,13 @@ public final class CallInfo implements Parcelable { CallState state = CallState.valueOf(source.readString()); Uri handle = Uri.CREATOR.createFromParcel(source); - boolean gatewayInfoPresent = source.readByte() != 0; - GatewayInfo gatewayInfo = null; - if (gatewayInfoPresent) { - gatewayInfo = GatewayInfo.CREATOR.createFromParcel(source); - } + GatewayInfo gatewayInfo = readProviderInfoIfExists(source, GatewayInfo.CREATOR); + Subscription subscription = readProviderInfoIfExists(source, Subscription.CREATOR); ClassLoader classLoader = CallInfo.class.getClassLoader(); Bundle extras = source.readParcelable(classLoader); CallServiceDescriptor descriptor = source.readParcelable(classLoader); - return new CallInfo(id, state, handle, gatewayInfo, extras, descriptor); + return new CallInfo(id, state, handle, gatewayInfo, subscription, extras, descriptor); } @Override @@ -172,14 +181,35 @@ public final class CallInfo implements Parcelable { destination.writeString(mState.name()); mHandle.writeToParcel(destination, 0); - if (mGatewayInfo != null) { - destination.writeByte((byte) 1); - mGatewayInfo.writeToParcel(destination, 0); - } else { - destination.writeByte((byte) 0); - } + writeProviderInfoIfExists(destination, mGatewayInfo); + writeProviderInfoIfExists(destination, mSubscription); destination.writeParcelable(mExtras, 0); destination.writeParcelable(mCurrentCallServiceDescriptor, 0); } + + /** + * Helper function to write provider information (either GatewayInfo or Subscription) to + * parcel. Will write a false byte if the information does not exist. + */ + private void writeProviderInfoIfExists(Parcel destination, Parcelable provider) { + if (provider != null) { + destination.writeByte((byte) 1); + provider.writeToParcel(destination, 0); + } else { + destination.writeByte((byte) 0); + } + } + + /** + * Helper function to read provider information (either GatewayInfo or Subscription) from + * parcel. + */ + private static