diff options
Diffstat (limited to 'telephony/java')
5 files changed, 129 insertions, 149 deletions
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 9c9670c99c2d..dc05488618cf 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -33,7 +33,11 @@ import android.os.RemoteException; import android.service.carrier.CarrierService; import android.telecom.TelecomManager; import android.telephony.ims.ImsReasonInfo; +import android.telephony.ims.ImsRegistrationAttributes; import android.telephony.ims.ImsSsData; +import android.telephony.ims.SipDelegateManager; +import android.telephony.ims.feature.MmTelFeature; +import android.telephony.ims.feature.RcsFeature; import com.android.internal.telephony.ICarrierConfigLoader; import com.android.telephony.Rlog; @@ -3941,6 +3945,43 @@ public class CarrierConfigManager { KEY_PREFIX + "enable_presence_publish_bool"; /** + * Each string in this array contains a mapping between the service-id and version portion + * of the service-description element and the associated IMS feature tag(s) that are + * associated with each element (see RCC.07 Table 7). + * <p> + * Each string contains 3 parts, which define the mapping between service-description and + * feature tag(s) that must be present in the IMS REGISTER for the RCS service to be + * published as part of the RCS PUBLISH procedure: + * [service-id]|[version]|[desc]|[feature_tag];[feature_tag];... + * <ul> + * <li>[service-id]: the service-id element associated with the RCS capability.</li> + * <li>[version]: The version element associated with that service-id</li> + * <li>[desc]: The optional desecription element associated with that service-id</li> + * <li>[feature_tag];[feature_tag]: The list of all feature tags associated with this + * capability that MUST ALL be present in the IMS registration for this this + * capability to be published to the network.</li> + * </ul> + * <p> + * Features managed by the framework will be considered capable when the ImsService reports + * that those services are capable via the + * {@link MmTelFeature#notifyCapabilitiesStatusChanged(MmTelFeature.MmTelCapabilities)} or + * {@link RcsFeature#notifyCapabilitiesStatusChanged(RcsFeature.RcsImsCapabilities)} APIs. + * For RCS services not managed by the framework, the capability of these services are + * determined by looking at the feature tags associated with the IMS registration using the + * {@link ImsRegistrationAttributes} API and mapping them to the service-description map. + * <p> + * The framework contains a default value of this key, which is based off of RCC.07 + * specification. Capabilities based of carrier extensions may be added to this list on a + * carrier-by-carrier basis as required in order to support additional services in the + * PUBLISH. If this list contains a service-id and version that overlaps with the default, + * it will override the framework default. + * @hide + */ + @SystemApi + public static final String KEY_PUBLISH_SERVICE_DESC_FEATURE_TAG_MAP_OVERRIDE_STRING_ARRAY = + KEY_PREFIX + "publish_service_desc_feature_tag_map_override_string_array"; + + /** * Flag indicating whether or not this carrier supports the exchange of phone numbers with * the carrier's RCS presence server in order to retrieve the RCS capabilities of requested * contacts used in the RCS User Capability Exchange (UCE) procedure. See RCC.71, section 3 @@ -3999,6 +4040,8 @@ public class CarrierConfigManager { defaults.putInt(KEY_WIFI_OFF_DEFERRING_TIME_MILLIS_INT, 4000); defaults.putBoolean(KEY_IMS_SINGLE_REGISTRATION_REQUIRED_BOOL, false); defaults.putBoolean(KEY_ENABLE_PRESENCE_PUBLISH_BOOL, false); + defaults.putStringArray(KEY_PUBLISH_SERVICE_DESC_FEATURE_TAG_MAP_OVERRIDE_STRING_ARRAY, + new String[] {}); defaults.putBoolean(KEY_ENABLE_PRESENCE_CAPABILITY_EXCHANGE_BOOL, false); defaults.putBoolean(KEY_RCS_BULK_CAPABILITY_EXCHANGE_BOOL, false); defaults.putBoolean(KEY_ENABLE_PRESENCE_GROUP_SUBSCRIBE_BOOL, true); diff --git a/telephony/java/android/telephony/ims/RcsContactPresenceTuple.java b/telephony/java/android/telephony/ims/RcsContactPresenceTuple.java index cd1f4c5e9253..9c28c36521f5 100644 --- a/telephony/java/android/telephony/ims/RcsContactPresenceTuple.java +++ b/telephony/java/android/telephony/ims/RcsContactPresenceTuple.java @@ -21,10 +21,10 @@ import android.annotation.Nullable; import android.annotation.StringDef; import android.annotation.SystemApi; import android.net.Uri; +import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; -import android.util.Log; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -46,6 +46,15 @@ public final class RcsContactPresenceTuple implements Parcelable { private static final String LOG_TAG = "RcsContactPresenceTuple"; /** + * The service ID used to indicate that service discovery via presence is available. + * <p> + * See RCC.07 v5.0 specification for more information. + * @hide + */ + public static final String SERVICE_ID_PRESENCE = + "org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcse.dp"; + + /** * The service ID used to indicate that MMTEL service is available. * <p> * See the GSMA RCC.07 specification for more information. @@ -336,6 +345,13 @@ public final class RcsContactPresenceTuple implements Parcelable { public @NonNull @DuplexMode List<String> getUnsupportedDuplexModes() { return Collections.unmodifiableList(mUnsupportedDuplexModeList); } + + @Override + public String toString() { + return "servCaps{" + "a=" + mIsAudioCapable + ", v=" + mIsVideoCapable + + ", supported=" + mSupportedDuplexModeList + ", unsupported=" + + mUnsupportedDuplexModeList + '}'; + } } /** @@ -372,22 +388,6 @@ public final class RcsContactPresenceTuple implements Parcelable { * The optional timestamp indicating the data and time of the status change of this tuple. * Per RFC3863 section 4.1.7, the timestamp is formatted as an IMPP datetime format * string per RFC3339. - * @hide - */ - public @NonNull Builder setTimestamp(@NonNull String timestamp) { - try { - mPresenceTuple.mTimestamp = - DateTimeFormatter.ISO_OFFSET_DATE_TIME.parse(timestamp, Instant::from); - } catch (DateTimeParseException e) { - Log.d(LOG_TAG, "Parse timestamp failed " + e); - } - return this; - } - - /** - * The optional timestamp indicating the data and time of the status change of this tuple. - * Per RFC3863 section 4.1.7, the timestamp is formatted as an IMPP datetime format - * string per RFC3339. */ public @NonNull Builder setTime(@NonNull Instant timestamp) { mPresenceTuple.mTimestamp = timestamp; @@ -517,14 +517,6 @@ public final class RcsContactPresenceTuple implements Parcelable { return mContactUri; } - /** - * @return the timestamp element contained in the tuple if it exists - * @hide - */ - public @Nullable String getTimestamp() { - return (mTimestamp == null) ? null : mTimestamp.toString(); - } - /** @return the timestamp element contained in the tuple if it exists */ public @Nullable Instant getTime() { return mTimestamp; @@ -539,4 +531,36 @@ public final class RcsContactPresenceTuple implements Parcelable { public @Nullable ServiceCapabilities getServiceCapabilities() { return mServiceCapabilities; } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder("{"); + if (Build.IS_ENG) { + builder.append("u="); + builder.append(mContactUri); + } else { + builder.append("u="); + builder.append(mContactUri != null ? "XXX" : "null"); + } + builder.append(", id="); + builder.append(mServiceId); + builder.append(", v="); + builder.append(mServiceVersion); + builder.append(", s="); + builder.append(mStatus); + if (mTimestamp != null) { + builder.append(", timestamp="); + builder.append(mTimestamp); + } + if (mServiceDescription != null) { + builder.append(", servDesc="); + builder.append(mServiceDescription); + } + if (mServiceCapabilities != null) { + builder.append(", servCaps="); + builder.append(mServiceCapabilities); + } + builder.append("}"); + return builder.toString(); + } } diff --git a/telephony/java/android/telephony/ims/RcsContactUceCapability.java b/telephony/java/android/telephony/ims/RcsContactUceCapability.java index b28dc27e06e0..52d0f036788c 100644 --- a/telephony/java/android/telephony/ims/RcsContactUceCapability.java +++ b/telephony/java/android/telephony/ims/RcsContactUceCapability.java @@ -21,6 +21,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.Uri; +import android.os.Build; import android.os.Parcel; import android.os.Parcelable; @@ -345,4 +346,39 @@ public final class RcsContactUceCapability implements Parcelable { public @NonNull Uri getContactUri() { return mContactUri; } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder("RcsContactUceCapability"); + if (mCapabilityMechanism == CAPABILITY_MECHANISM_PRESENCE) { + builder.append("(presence) {"); + } else if (mCapabilityMechanism == CAPABILITY_MECHANISM_OPTIONS) { + builder.append("(options) {"); + } else { + builder.append("(?) {"); + } + if (Build.IS_ENG) { + builder.append("uri="); + builder.append(mContactUri); + } else { + builder.append("uri (isNull)="); + builder.append(mContactUri != null ? "XXX" : "null"); + } + builder.append(", sourceType="); + builder.append(mSourceType); + builder.append(", requestResult="); + builder.append(mRequestResult); + + if (mCapabilityMechanism == CAPABILITY_MECHANISM_PRESENCE) { + builder.append(", presenceTuples={"); + builder.append(mPresenceTuples); + builder.append("}"); + } else if (mCapabilityMechanism == CAPABILITY_MECHANISM_OPTIONS) { + builder.append(", featureTags={"); + builder.append(mFeatureTags); + builder.append("}"); + } + + return builder.toString(); + } } diff --git a/telephony/java/android/telephony/ims/RcsUceAdapter.java b/telephony/java/android/telephony/ims/RcsUceAdapter.java index 815c08d120c2..dd9102699529 100644 --- a/telephony/java/android/telephony/ims/RcsUceAdapter.java +++ b/telephony/java/android/telephony/ims/RcsUceAdapter.java @@ -439,8 +439,7 @@ public class RcsUceAdapter { /** * The pending request has resulted in an error and may need to be retried, depending on the - * error code. The callback {@link #onCapabilitiesReceived(List)} - * for each contacts is required to be called before {@link #onError} is called. + * error code. * @param errorCode The reason for the framework being unable to process the request. * @param retryIntervalMillis The time in milliseconds the requesting application should * wait before retrying, if non-zero. @@ -487,93 +486,6 @@ public class RcsUceAdapter { * becomes inactive. See {@link ImsException#getCode()} for more information on the error codes. * @hide */ - @RequiresPermission(allOf = {Manifest.permission.ACCESS_RCS_USER_CAPABILITY_EXCHANGE, - Manifest.permission.READ_CONTACTS}) - public void requestCapabilities(@NonNull List<Uri> contactNumbers, - @NonNull @CallbackExecutor Executor executor, - @NonNull CapabilitiesCallback c) throws ImsException { - if (c == null) { - throw new IllegalArgumentException("Must include a non-null CapabilitiesCallback."); - } - if (executor == null) { - throw new IllegalArgumentException("Must include a non-null Executor."); - } - if (contactNumbers == null) { - throw new IllegalArgumentException("Must include non-null contact number list."); - } - - IImsRcsController imsRcsController = getIImsRcsController(); - if (imsRcsController == null) { - Log.e(TAG, "requestCapabilities: IImsRcsController is null"); - throw new ImsException("Can not find remote IMS service", - ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); - } - - IRcsUceControllerCallback internalCallback = new IRcsUceControllerCallback.Stub() { - @Override - public void onCapabilitiesReceived(List<RcsContactUceCapability> contactCapabilities) { - final long callingIdentity = Binder.clearCallingIdentity(); - try { - executor.execute(() -> c.onCapabilitiesReceived(contactCapabilities)); - } finally { - restoreCallingIdentity(callingIdentity); - } - } - @Override - public void onComplete() { - final long callingIdentity = Binder.clearCallingIdentity(); - try { - executor.execute(() -> c.onComplete()); - } finally { - restoreCallingIdentity(callingIdentity); - } - } - @Override - public void onError(int errorCode, long retryAfterMilliseconds) { - final long callingIdentity = Binder.clearCallingIdentity(); - try { - executor.execute(() -> c.onError(errorCode, retryAfterMilliseconds)); - } finally { - restoreCallingIdentity(callingIdentity); - } - } - }; - - try { - imsRcsController.requestCapabilities(mSubId, mContext.getOpPackageName(), - mContext.getAttributionTag(), contactNumbers, internalCallback); - } catch (ServiceSpecificException e) { - throw new ImsException(e.toString(), e.errorCode); - } catch (RemoteException e) { - Log.e(TAG, "Error calling IImsRcsController#requestCapabilities", e); - throw new ImsException("Remote IMS Service is not available", - ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); - } - } - - /** - * Request the User Capability Exchange capabilities for one or more contacts. - * <p> - * This will return the cached capabilities of the contact and will not perform a capability - * poll on the network unless there are contacts being queried with stale information. - * <p> - * Be sure to check the availability of this feature using - * {@link ImsRcsManager#isAvailable(int, int)} and ensuring - * {@link RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_OPTIONS_UCE} or - * {@link RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_PRESENCE_UCE} is enabled or else - * this operation will fail with {@link #ERROR_NOT_AVAILABLE} or {@link #ERROR_NOT_ENABLED}. - * - * @param contactNumbers A list of numbers that the capabilities are being requested for. - * @param executor The executor that will be used when the request is completed and the - * {@link CapabilitiesCallback} is called. - * @param c A one-time callback for when the request for capabilities completes or there is an - * error processing the request. - * @throws ImsException if the subscription associated with this instance of - * {@link RcsUceAdapter} is valid, but the ImsService associated with the subscription is not - * available. This can happen if the ImsService has crashed, for example, or if the subscription - * becomes inactive. See {@link ImsException#getCode()} for more information on the error codes. - * @hide - */ @SystemApi @RequiresPermission(allOf = {Manifest.permission.ACCESS_RCS_USER_CAPABILITY_EXCHANGE, Manifest.permission.READ_CONTACTS}) diff --git a/telephony/java/android/telephony/ims/stub/RcsCapabilityExchangeImplBase.java b/telephony/java/android/telephony/ims/stub/RcsCapabilityExchangeImplBase.java index 00c91681d9ea..03e17fbc2c0d 100644 --- a/telephony/java/android/telephony/ims/stub/RcsCapabilityExchangeImplBase.java +++ b/telephony/java/android/telephony/ims/stub/RcsCapabilityExchangeImplBase.java @@ -386,41 +386,6 @@ public class RcsCapabilityExchangeImplBase { * {@link SubscribeResponseCallback#onTerminated(String, long)} must be called for the * framework to finish listening for NOTIFY responses. * - * @param uris A {@link List} of the {@link Uri}s that the framework is requesting the UCE - * capabilities for. - * @param cb The callback of the subscribe request. - * @hide - */ - // executor used is defined in the constructor. - @SuppressLint("ExecutorRegistration") - public void subscribeForCapabilities(@NonNull List<Uri> uris, - @NonNull SubscribeResponseCallback cb) { - // Stub - to be implemented by service - Log.w(LOG_TAG, "subscribeForCapabilities called with no implementation."); - try { - cb.onCommandError(COMMAND_CODE_NOT_SUPPORTED); - } catch (ImsException e) { - // Do not do anything, this is a stub implementation. - } - } - - /** - * The user capabilities of one or multiple contacts have been requested by the framework. - * <p> - * The implementer must follow up this call with an - * {@link SubscribeResponseCallback#onCommandError} call to indicate this operation has failed. - * The response from the network to the SUBSCRIBE request must be sent back to the framework - * using {@link SubscribeResponseCallback#onNetworkResponse(int, String)}. - * As NOTIFY requests come in from the network, the requested contact’s capabilities should be - * sent back to the framework using - * {@link SubscribeResponseCallback#onNotifyCapabilitiesUpdate(List<String>}) and - * {@link SubscribeResponseCallback#onResourceTerminated(List<Pair<Uri, String>>)} - * should be called with the presence information for the contacts specified. - * <p> - * Once the subscription is terminated, - * {@link SubscribeResponseCallback#onTerminated(String, long)} must be called for the - * framework to finish listening for NOTIFY responses. - * * @param uris A {@link Collection} of the {@link Uri}s that the framework is requesting the * UCE capabilities for. * @param cb The callback of the subscribe request. |