diff options
author | 2023-12-28 16:35:42 -0800 | |
---|---|---|
committer | 2024-02-08 23:51:50 +0000 | |
commit | 4fab083a476a2896bc09b45c7a6065c144ebf600 (patch) | |
tree | 8a3cad2a1532fed1a5bb2afed670623ef86d7445 | |
parent | 2ed8d5176c3ca95e127bed919a1df5176e7c5c75 (diff) |
add new APIs for Enriched Calling
This feature lets users know if a verified business is calling and the
name of the business calling.
Bug: 324325516
Bug: 226518586 (root)
Test: CTS
Change-Id: Ie25ef3d4952f7a21655015b8a1234a9ca22b5493
-rw-r--r-- | core/api/current.txt | 7 | ||||
-rw-r--r-- | core/api/system-current.txt | 1 | ||||
-rw-r--r-- | core/java/android/provider/CallLog.java | 104 | ||||
-rw-r--r-- | telecomm/java/android/telecom/Call.java | 21 | ||||
-rw-r--r-- | telephony/java/android/telephony/CarrierConfigManager.java | 8 | ||||
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 24 | ||||
-rw-r--r-- | telephony/java/android/telephony/ims/ImsCallProfile.java | 11 | ||||
-rw-r--r-- | telephony/java/android/telephony/ims/feature/MmTelFeature.java | 17 |
8 files changed, 178 insertions, 15 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 55ea2f4da526..7a719860a131 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -35146,6 +35146,7 @@ package android.provider { ctor public CallLog.Calls(); method public static String getLastOutgoingCall(android.content.Context); field public static final int ANSWERED_EXTERNALLY_TYPE = 7; // 0x7 + field @FlaggedApi("com.android.server.telecom.flags.business_call_composer") public static final String ASSERTED_DISPLAY_NAME = "asserted_display_name"; field public static final long AUTO_MISSED_EMERGENCY_CALL = 1L; // 0x1L field public static final long AUTO_MISSED_MAXIMUM_DIALING = 4L; // 0x4L field public static final long AUTO_MISSED_MAXIMUM_RINGING = 2L; // 0x2L @@ -35192,6 +35193,7 @@ package android.provider { field public static final int FEATURES_WIFI = 8; // 0x8 field public static final String GEOCODED_LOCATION = "geocoded_location"; field public static final int INCOMING_TYPE = 1; // 0x1 + field @FlaggedApi("com.android.server.telecom.flags.business_call_composer") public static final String IS_BUSINESS_CALL = "is_business_call"; field public static final String IS_READ = "is_read"; field public static final String LAST_MODIFIED = "last_modified"; field public static final String LIMIT_PARAM_KEY = "limit"; @@ -41659,8 +41661,10 @@ package android.telecom { field @Deprecated public static final String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts"; field public static final String EVENT_CLEAR_DIAGNOSTIC_MESSAGE = "android.telecom.event.CLEAR_DIAGNOSTIC_MESSAGE"; field public static final String EVENT_DISPLAY_DIAGNOSTIC_MESSAGE = "android.telecom.event.DISPLAY_DIAGNOSTIC_MESSAGE"; + field @FlaggedApi("com.android.server.telecom.flags.business_call_composer") public static final String EXTRA_ASSERTED_DISPLAY_NAME = "android.telecom.extra.ASSERTED_DISPLAY_NAME"; field public static final String EXTRA_DIAGNOSTIC_MESSAGE = "android.telecom.extra.DIAGNOSTIC_MESSAGE"; field public static final String EXTRA_DIAGNOSTIC_MESSAGE_ID = "android.telecom.extra.DIAGNOSTIC_MESSAGE_ID"; + field @FlaggedApi("com.android.server.telecom.flags.business_call_composer") public static final String EXTRA_IS_BUSINESS_CALL = "android.telecom.extra.IS_BUSINESS_CALL"; field public static final String EXTRA_IS_SUPPRESSED_BY_DO_NOT_DISTURB = "android.telecom.extra.IS_SUPPRESSED_BY_DO_NOT_DISTURB"; field public static final String EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS = "android.telecom.extra.LAST_EMERGENCY_CALLBACK_TIME_MILLIS"; field public static final String EXTRA_SILENT_RINGING_REQUESTED = "android.telecom.extra.SILENT_RINGING_REQUESTED"; @@ -43286,6 +43290,7 @@ package android.telephony { field public static final String KEY_SMS_REQUIRES_DESTINATION_NUMBER_CONVERSION_BOOL = "sms_requires_destination_number_conversion_bool"; field public static final String KEY_SUBSCRIPTION_GROUP_UUID_STRING = "subscription_group_uuid_string"; field public static final String KEY_SUPPORTED_PREMIUM_CAPABILITIES_INT_ARRAY = "supported_premium_capabilities_int_array"; + field @FlaggedApi("com.android.server.telecom.flags.business_call_composer") public static final String KEY_SUPPORTS_BUSINESS_CALL_COMPOSER_BOOL = "supports_business_call_composer_bool"; field public static final String KEY_SUPPORTS_CALL_COMPOSER_BOOL = "supports_call_composer_bool"; field public static final String KEY_SUPPORTS_DEVICE_TO_DEVICE_COMMUNICATION_USING_DTMF_BOOL = "supports_device_to_device_communication_using_dtmf_bool"; field public static final String KEY_SUPPORTS_DEVICE_TO_DEVICE_COMMUNICATION_USING_RTP_BOOL = "supports_device_to_device_communication_using_rtp_bool"; @@ -45519,6 +45524,7 @@ package android.telephony { field public static final int AUTHTYPE_EAP_SIM = 128; // 0x80 field public static final int AUTHTYPE_GBA_BOOTSTRAP = 132; // 0x84 field public static final int AUTHTYPE_GBA_NAF_KEY_EXTERNAL = 133; // 0x85 + field @FlaggedApi("com.android.server.telecom.flags.business_call_composer") public static final int CALL_COMPOSER_STATUS_BUSINESS_ONLY = 2; // 0x2 field public static final int CALL_COMPOSER_STATUS_OFF = 0; // 0x0 field public static final int CALL_COMPOSER_STATUS_ON = 1; // 0x1 field public static final int CALL_STATE_IDLE = 0; // 0x0 @@ -46553,6 +46559,7 @@ package android.telephony.ims.feature { public static class MmTelFeature.MmTelCapabilities { method public final boolean isCapable(int); field public static final int CAPABILITY_TYPE_CALL_COMPOSER = 16; // 0x10 + field @FlaggedApi("com.android.server.telecom.flags.business_call_composer") public static final int CAPABILITY_TYPE_CALL_COMPOSER_BUSINESS_ONLY = 32; // 0x20 field public static final int CAPABILITY_TYPE_SMS = 8; // 0x8 field public static final int CAPABILITY_TYPE_UT = 4; // 0x4 field public static final int CAPABILITY_TYPE_VIDEO = 2; // 0x2 diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 2c1f2fd0c1cd..8a3ded17344d 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -15801,6 +15801,7 @@ package android.telephony.ims { field public static final int DIALSTRING_USSD = 2; // 0x2 field public static final String EXTRA_ADDITIONAL_CALL_INFO = "AdditionalCallInfo"; field public static final String EXTRA_ADDITIONAL_SIP_INVITE_FIELDS = "android.telephony.ims.extra.ADDITIONAL_SIP_INVITE_FIELDS"; + field @FlaggedApi("com.android.server.telecom.flags.business_call_composer") public static final String EXTRA_ASSERTED_DISPLAY_NAME = "android.telephony.ims.extra.ASSERTED_DISPLAY_NAME"; field public static final String EXTRA_CALL_DISCONNECT_CAUSE = "android.telephony.ims.extra.CALL_DISCONNECT_CAUSE"; field public static final String EXTRA_CALL_NETWORK_TYPE = "android.telephony.ims.extra.CALL_NETWORK_TYPE"; field @Deprecated public static final String EXTRA_CALL_RAT_TYPE = "CallRadioTech"; diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java index 5d6dfc760b02..ef4594f3679f 100644 --- a/core/java/android/provider/CallLog.java +++ b/core/java/android/provider/CallLog.java @@ -19,6 +19,7 @@ package android.provider; import android.Manifest; import android.annotation.CallbackExecutor; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.LongDef; import android.annotation.NonNull; @@ -55,6 +56,8 @@ import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.util.Log; +import com.android.server.telecom.flags.Flags; + import java.io.ByteArrayOutputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; @@ -427,6 +430,8 @@ public class CallLog { private double mLongitude = Double.NaN; private Uri mPictureUri; private int mIsPhoneAccountMigrationPending; + private boolean mIsBusinessCall; + private String mBusinessName; /** * @param callerInfo the CallerInfo object to get the target contact from. @@ -645,15 +650,44 @@ public class CallLog { } /** + * @param isBusinessCall should be set if the caller is a business call + */ + @FlaggedApi(Flags.FLAG_BUSINESS_CALL_COMPOSER) + public @NonNull AddCallParametersBuilder setIsBusinessCall(boolean isBusinessCall) { + mIsBusinessCall = isBusinessCall; + return this; + } + + /** + * @param businessName should be set if the caller is a business call + */ + @FlaggedApi(Flags.FLAG_BUSINESS_CALL_COMPOSER) + public @NonNull AddCallParametersBuilder setBusinessName(String businessName) { + mBusinessName = businessName; + return this; + } + + /** * Builds the object */ public @NonNull AddCallParams build() { - return new AddCallParams(mCallerInfo, mNumber, mPostDialDigits, mViaNumber, - mPresentation, mCallType, mFeatures, mAccountHandle, mStart, mDuration, - mDataUsage, mAddForAllUsers, mUserToBeInsertedTo, mIsRead, mCallBlockReason, - mCallScreeningAppName, mCallScreeningComponentName, mMissedReason, - mPriority, mSubject, mLatitude, mLongitude, mPictureUri, - mIsPhoneAccountMigrationPending); + if (Flags.businessCallComposer()) { + return new AddCallParams(mCallerInfo, mNumber, mPostDialDigits, mViaNumber, + mPresentation, mCallType, mFeatures, mAccountHandle, mStart, mDuration, + mDataUsage, mAddForAllUsers, mUserToBeInsertedTo, mIsRead, + mCallBlockReason, + mCallScreeningAppName, mCallScreeningComponentName, mMissedReason, + mPriority, mSubject, mLatitude, mLongitude, mPictureUri, + mIsPhoneAccountMigrationPending, mIsBusinessCall, mBusinessName); + } else { + return new AddCallParams(mCallerInfo, mNumber, mPostDialDigits, mViaNumber, + mPresentation, mCallType, mFeatures, mAccountHandle, mStart, mDuration, + mDataUsage, mAddForAllUsers, mUserToBeInsertedTo, mIsRead, + mCallBlockReason, + mCallScreeningAppName, mCallScreeningComponentName, mMissedReason, + mPriority, mSubject, mLatitude, mLongitude, mPictureUri, + mIsPhoneAccountMigrationPending); + } } } @@ -681,6 +715,8 @@ public class CallLog { private double mLongitude = Double.NaN; private Uri mPictureUri; private int mIsPhoneAccountMigrationPending; + private boolean mIsBusinessCall; + private String mBusinessName; private AddCallParams(CallerInfo callerInfo, String number, String postDialDigits, String viaNumber, int presentation, int callType, int features, @@ -717,6 +753,43 @@ public class CallLog { mIsPhoneAccountMigrationPending = isPhoneAccountMigrationPending; } + private AddCallParams(CallerInfo callerInfo, String number, String postDialDigits, + String viaNumber, int presentation, int callType, int features, + PhoneAccountHandle accountHandle, long start, int duration, long dataUsage, + boolean addForAllUsers, UserHandle userToBeInsertedTo, boolean isRead, + int callBlockReason, + CharSequence callScreeningAppName, String callScreeningComponentName, + long missedReason, + int priority, String subject, double latitude, double longitude, Uri pictureUri, + int isPhoneAccountMigrationPending, boolean isBusinessCall, String businessName) { + mCallerInfo = callerInfo; + mNumber = number; + mPostDialDigits = postDialDigits; + mViaNumber = viaNumber; + mPresentation = presentation; + mCallType = callType; + mFeatures = features; + mAccountHandle = accountHandle; + mStart = start; + mDuration = duration; + mDataUsage = dataUsage; + mAddForAllUsers = addForAllUsers; + mUserToBeInsertedTo = userToBeInsertedTo; + mIsRead = isRead; + mCallBlockReason = callBlockReason; + mCallScreeningAppName = callScreeningAppName; + mCallScreeningComponentName = callScreeningComponentName; + mMissedReason = missedReason; + mPriority = priority; + mSubject = subject; + mLatitude = latitude; + mLongitude = longitude; + mPictureUri = pictureUri; + mIsPhoneAccountMigrationPending = isPhoneAccountMigrationPending; + mIsBusinessCall = isBusinessCall; + mBusinessName = businessName; + } + } /** @@ -915,6 +988,19 @@ public class CallLog { */ public static final String NUMBER = "number"; + + /** + * Boolean indicating whether the call is a business call. + */ + @FlaggedApi(Flags.FLAG_BUSINESS_CALL_COMPOSER) + public static final String IS_BUSINESS_CALL = "is_business_call"; + + /** + * String that stores the asserted display name associated with business call. + */ + @FlaggedApi(Flags.FLAG_BUSINESS_CALL_COMPOSER) + public static final String ASSERTED_DISPLAY_NAME = "asserted_display_name"; + /** * The number presenting rules set by the network. * @@ -1713,7 +1799,6 @@ public class CallLog { } ContentValues values = new ContentValues(14); - values.put(NUMBER, params.mNumber); values.put(POST_DIAL_DIGITS, params.mPostDialDigits); values.put(VIA_NUMBER, params.mViaNumber); @@ -1746,7 +1831,10 @@ public class CallLog { values.put(COMPOSER_PHOTO_URI, params.mPictureUri.toString()); } values.put(IS_PHONE_ACCOUNT_MIGRATION_PENDING, params.mIsPhoneAccountMigrationPending); - + if (Flags.businessCallComposer()) { + values.put(IS_BUSINESS_CALL, Integer.valueOf(params.mIsBusinessCall ? 1 : 0)); + values.put(ASSERTED_DISPLAY_NAME, params.mBusinessName); + } if ((params.mCallerInfo != null) && (params.mCallerInfo.getContactId() > 0)) { // Update usage information for the number associated with the contact ID. // We need to use both the number and the ID for obtaining a data ID since other diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index 874c10c8ea83..a52614d5cda1 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -269,6 +269,27 @@ public final class Call { "android.telecom.extra.DIAGNOSTIC_MESSAGE"; /** + * Boolean indicating that the call is a verified business call. + * + * {@link Connection#setExtras(Bundle)} or {@link Connection#putExtras(Bundle)} + * should be used to notify Telecom this extra has been set. + */ + @FlaggedApi(Flags.FLAG_BUSINESS_CALL_COMPOSER) + public static final String EXTRA_IS_BUSINESS_CALL = + "android.telecom.extra.IS_BUSINESS_CALL"; + + /** + * String value indicating the asserted display name reported via + * ImsCallProfile#EXTRA_ASSERTED_DISPLAY_NAME. + * + * {@link Connection#setExtras(Bundle)} or {@link Connection#putExtras(Bundle)} + * should be used to notify Telecom this extra has been set. + */ + @FlaggedApi(Flags.FLAG_BUSINESS_CALL_COMPOSER) + public static final String EXTRA_ASSERTED_DISPLAY_NAME = + "android.telecom.extra.ASSERTED_DISPLAY_NAME"; + + /** * Reject reason used with {@link #reject(int)} to indicate that the user is rejecting this * call because they have declined to answer it. This typically means that they are unable * to answer the call at this time and would prefer it be sent to voicemail. diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index e5a94c302c89..6f9921b05e08 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -9740,6 +9740,13 @@ public class CarrierConfigManager { public static final String KEY_SUPPORTS_CALL_COMPOSER_BOOL = "supports_call_composer_bool"; /** + * Indicates if the carrier supports a business call composer. + */ + @FlaggedApi(com.android.server.telecom.flags.Flags.FLAG_BUSINESS_CALL_COMPOSER) + public static final String KEY_SUPPORTS_BUSINESS_CALL_COMPOSER_BOOL = + "supports_business_call_composer_bool"; + + /** * Indicates the carrier server url that serves the call composer picture. */ public static final String KEY_CALL_COMPOSER_PICTURE_SERVER_URL_STRING = @@ -10822,6 +10829,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_DISABLE_DUN_APN_WHILE_ROAMING_WITH_PRESET_APN_BOOL, false); sDefaults.putString(KEY_DEFAULT_PREFERRED_APN_NAME_STRING, ""); sDefaults.putBoolean(KEY_SUPPORTS_CALL_COMPOSER_BOOL, false); + sDefaults.putBoolean(KEY_SUPPORTS_BUSINESS_CALL_COMPOSER_BOOL, false); sDefaults.putString(KEY_CALL_COMPOSER_PICTURE_SERVER_URL_STRING, ""); sDefaults.putBoolean(KEY_USE_ACS_FOR_RCS_BOOL, false); sDefaults.putBoolean(KEY_NETWORK_TEMP_NOT_METERED_SUPPORTED_BOOL, true); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index c1ceaef64d5d..941bff49196c 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -10633,20 +10633,27 @@ public class TelephonyManager { } /** - * Call composer status OFF from user setting. + * Call composer status <b>OFF</b> from user setting. */ public static final int CALL_COMPOSER_STATUS_OFF = 0; /** - * Call composer status ON from user setting. + * Call composer status <b>ON</b> from user setting. */ public static final int CALL_COMPOSER_STATUS_ON = 1; + /** + * Call composer status <b>Business Only</b> from user setting. + */ + @FlaggedApi(com.android.server.telecom.flags.Flags.FLAG_BUSINESS_CALL_COMPOSER) + public static final int CALL_COMPOSER_STATUS_BUSINESS_ONLY = 2; + /** @hide */ @IntDef(prefix = {"CALL_COMPOSER_STATUS_"}, value = { CALL_COMPOSER_STATUS_ON, CALL_COMPOSER_STATUS_OFF, + CALL_COMPOSER_STATUS_BUSINESS_ONLY }) @Retention(RetentionPolicy.SOURCE) public @interface CallComposerStatus {} @@ -10667,9 +10674,16 @@ public class TelephonyManager { @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public void setCallComposerStatus(@CallComposerStatus int status) { - if (status > CALL_COMPOSER_STATUS_ON - || status < CALL_COMPOSER_STATUS_OFF) { - throw new IllegalArgumentException("requested status is invalid"); + if (com.android.server.telecom.flags.Flags.businessCallComposer()) { + if (status > CALL_COMPOSER_STATUS_BUSINESS_ONLY + || status < CALL_COMPOSER_STATUS_OFF) { + throw new IllegalArgumentException("requested status is invalid"); + } + } else { + if (status > CALL_COMPOSER_STATUS_ON + || status < CALL_COMPOSER_STATUS_OFF) { + throw new IllegalArgumentException("requested status is invalid"); + } } try { ITelephony telephony = getITelephony(); diff --git a/telephony/java/android/telephony/ims/ImsCallProfile.java b/telephony/java/android/telephony/ims/ImsCallProfile.java index d07edeb971ea..cebfe014a062 100644 --- a/telephony/java/android/telephony/ims/ImsCallProfile.java +++ b/telephony/java/android/telephony/ims/ImsCallProfile.java @@ -16,6 +16,7 @@ package android.telephony.ims; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -299,6 +300,16 @@ public final class ImsCallProfile implements Parcelable { "android.telephony.ims.extra.IS_BUSINESS_CALL"; /** + * The vendor IMS stack populates this {@code string} extra; it is used to hold the display name + * passed via the P-Asserted-Identity SIP header’s display-name field + * + * Reference: RFC3325 + */ + @FlaggedApi(com.android.server.telecom.flags.Flags.FLAG_BUSINESS_CALL_COMPOSER) + public static final String EXTRA_ASSERTED_DISPLAY_NAME = + "android.telephony.ims.extra.ASSERTED_DISPLAY_NAME"; + + /** * Values for EXTRA_OIR / EXTRA_CNAP */ /** diff --git a/telephony/java/android/telephony/ims/feature/MmTelFeature.java b/telephony/java/android/telephony/ims/feature/MmTelFeature.java index 746246c64e8c..9789082e1460 100644 --- a/telephony/java/android/telephony/ims/feature/MmTelFeature.java +++ b/telephony/java/android/telephony/ims/feature/MmTelFeature.java @@ -17,6 +17,7 @@ package android.telephony.ims.feature; import android.annotation.CallbackExecutor; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -59,6 +60,7 @@ import com.android.ims.internal.IImsEcbm; import com.android.ims.internal.IImsMultiEndpoint; import com.android.ims.internal.IImsUt; import com.android.internal.telephony.util.TelephonyUtils; +import com.android.server.telecom.flags.Flags; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -513,7 +515,8 @@ public class MmTelFeature extends ImsFeature { CAPABILITY_TYPE_VIDEO, CAPABILITY_TYPE_UT, CAPABILITY_TYPE_SMS, - CAPABILITY_TYPE_CALL_COMPOSER + CAPABILITY_TYPE_CALL_COMPOSER, + CAPABILITY_TYPE_CALL_COMPOSER_BUSINESS_ONLY }) @Retention(RetentionPolicy.SOURCE) public @interface MmTelCapability {} @@ -550,11 +553,19 @@ public class MmTelFeature extends ImsFeature { */ public static final int CAPABILITY_TYPE_CALL_COMPOSER = 1 << 4; + + /** + * This MmTelFeature supports Business-only Call Composer + */ + @FlaggedApi(Flags.FLAG_BUSINESS_CALL_COMPOSER) + public static final int CAPABILITY_TYPE_CALL_COMPOSER_BUSINESS_ONLY = 1 << 5; + /** * This is used to check the upper range of MmTel capability * @hide */ - public static final int CAPABILITY_TYPE_MAX = CAPABILITY_TYPE_CALL_COMPOSER + 1; + public static final int CAPABILITY_TYPE_MAX = + CAPABILITY_TYPE_CALL_COMPOSER_BUSINESS_ONLY + 1; /** * @hide @@ -601,6 +612,8 @@ public class MmTelFeature extends ImsFeature { builder.append(isCapable(CAPABILITY_TYPE_SMS)); builder.append(" CALL_COMPOSER: "); builder.append(isCapable(CAPABILITY_TYPE_CALL_COMPOSER)); + builder.append(" BUSINESS_COMPOSER_ONLY: "); + builder.append(isCapable(CAPABILITY_TYPE_CALL_COMPOSER_BUSINESS_ONLY)); builder.append("]"); return builder.toString(); } |