diff options
Diffstat (limited to 'src/java/com/android/ims/rcs/uce/presence/publish/PublishUtils.java')
-rw-r--r-- | src/java/com/android/ims/rcs/uce/presence/publish/PublishUtils.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/java/com/android/ims/rcs/uce/presence/publish/PublishUtils.java b/src/java/com/android/ims/rcs/uce/presence/publish/PublishUtils.java index 7df6bde5..1a67a40a 100644 --- a/src/java/com/android/ims/rcs/uce/presence/publish/PublishUtils.java +++ b/src/java/com/android/ims/rcs/uce/presence/publish/PublishUtils.java @@ -43,26 +43,34 @@ public class PublishUtils { private static final String SCHEME_TEL = "tel"; private static final String DOMAIN_SEPARATOR = "@"; + /** + * @return the contact URI of this device for either a PRESENCE or OPTIONS capabilities request. + * We will first try to use the IMS service associated URIs from the p-associated-uri header + * in the IMS registration response. If this is not available, we will fall back to using the + * SIM card information to generate the URI. + */ public static Uri getDeviceContactUri(Context context, int subId, DeviceCapabilityInfo deviceCap, boolean isForPresence) { boolean preferTelUri = false; if (isForPresence) { preferTelUri = UceUtils.isTelUriForPidfXmlEnabled(context, subId); } - // Get the uri from the IMS associated URI which is provided by the IMS service. + // Get the uri from the IMS p-associated-uri header which is provided by the IMS service. Uri contactUri = deviceCap.getImsAssociatedUri(preferTelUri); if (contactUri != null) { - Log.d(LOG_TAG, "getDeviceContactUri: ims associated uri"); + Uri convertedUri = preferTelUri ? getConvertedTelUri(context, contactUri) : contactUri; + Log.d(LOG_TAG, "getDeviceContactUri: returning " + + (contactUri.equals(convertedUri) ? "found" : "converted") + + " ims associated uri"); return contactUri; } + // No IMS service provided URIs, so generate the contact uri from ISIM. TelephonyManager telephonyManager = getTelephonyManager(context, subId); if (telephonyManager == null) { Log.w(LOG_TAG, "getDeviceContactUri: TelephonyManager is null"); return null; } - - // Get the contact uri from ISIM. contactUri = getContactUriFromIsim(telephonyManager); if (contactUri != null) { Log.d(LOG_TAG, "getDeviceContactUri: impu"); @@ -152,6 +160,10 @@ public class PublishUtils { } } + /** + * @return a TEL URI version of the contact URI if given a SIP URI. If given a TEL URI, this + * method will return the same value given. + */ private static Uri getConvertedTelUri(Context context, Uri contactUri) { if (contactUri == null) { return null; |