Merge "Add connect time to conference participant."

This commit is contained in:
Youming Ye
2019-02-06 21:55:06 +00:00
committed by Gerrit Code Review
4 changed files with 155 additions and 49 deletions

View File

@@ -772,19 +772,6 @@ public class CallLog {
* @param callBlockReason The reason why the call is blocked.
* @param callScreeningAppName The call screening application name which block the call.
* @param callScreeningComponentName The call screening component name which block the call.
* @param callIdPackageName The package name of the
* {@link android.telecom.CallScreeningService} which provided
* {@link CallIdentification}.
* @param callIdAppName The app name of the {@link android.telecom.CallScreeningService}
* which provided {@link CallIdentification}.
* @param callIdName The caller name provided by the
* {@link android.telecom.CallScreeningService}.
* @param callIdDescription The caller description provided by the
* {@link android.telecom.CallScreeningService}.
* @param callIdDetails The caller details provided by the
* {@link android.telecom.CallScreeningService}.
* @param callIdCallType The caller type provided by the
* {@link android.telecom.CallScreeningService}.
*
* @result The URI of the call log entry belonging to the user that made or received this
* call. This could be of the shadow provider. Do not return it to non-system apps,
@@ -803,37 +790,10 @@ public class CallLog {
number, userToBeInsertedTo, addForAllUsers));
}
final ContentResolver resolver = context.getContentResolver();
int numberPresentation = PRESENTATION_ALLOWED;
TelecomManager tm = null;
try {
tm = TelecomManager.from(context);
} catch (UnsupportedOperationException e) {}
String accountAddress = getLogAccountAddress(context, accountHandle);
String accountAddress = null;
if (tm != null && accountHandle != null) {
PhoneAccount account = tm.getPhoneAccount(accountHandle);
if (account != null) {
Uri address = account.getSubscriptionAddress();
if (address != null) {
accountAddress = address.getSchemeSpecificPart();
}
}
}
// Remap network specified number presentation types
// PhoneConstants.PRESENTATION_xxx to calllog number presentation types
// Calls.PRESENTATION_xxx, in order to insulate the persistent calllog
// from any future radio changes.
// If the number field is empty set the presentation type to Unknown.
if (presentation == PhoneConstants.PRESENTATION_RESTRICTED) {
numberPresentation = PRESENTATION_RESTRICTED;
} else if (presentation == PhoneConstants.PRESENTATION_PAYPHONE) {
numberPresentation = PRESENTATION_PAYPHONE;
} else if (TextUtils.isEmpty(number)
|| presentation == PhoneConstants.PRESENTATION_UNKNOWN) {
numberPresentation = PRESENTATION_UNKNOWN;
}
int numberPresentation = getLogNumberPresentation(number, presentation);
if (numberPresentation != PRESENTATION_ALLOWED) {
number = "";
if (ci != null) {
@@ -1138,8 +1098,7 @@ public class CallLog {
if (TextUtils.isEmpty(countryIso)) {
return;
}
final String normalizedNumber = PhoneNumberUtils.formatNumberToE164(number,
getCurrentCountryIso(context));
final String normalizedNumber = PhoneNumberUtils.formatNumberToE164(number, countryIso);
if (TextUtils.isEmpty(normalizedNumber)) {
return;
}
@@ -1148,6 +1107,54 @@ public class CallLog {
resolver.update(Data.CONTENT_URI, values, Data._ID + "=?", new String[] {dataId});
}
/**
* Remap network specified number presentation types
* PhoneConstants.PRESENTATION_xxx to calllog number presentation types
* Calls.PRESENTATION_xxx, in order to insulate the persistent calllog
* from any future radio changes.
* If the number field is empty set the presentation type to Unknown.
*/
private static int getLogNumberPresentation(String number, int presentation) {
if (presentation == PhoneConstants.PRESENTATION_RESTRICTED) {
return presentation;
}
if (presentation == PhoneConstants.PRESENTATION_PAYPHONE) {
return presentation;
}
if (TextUtils.isEmpty(number)
|| presentation == PhoneConstants.PRESENTATION_UNKNOWN) {
return PRESENTATION_UNKNOWN;
}
return PRESENTATION_ALLOWED;
}
private static String getLogAccountAddress(Context context,
PhoneAccountHandle accountHandle) {
TelecomManager tm = null;
try {
tm = TelecomManager.from(context);
} catch (UnsupportedOperationException e) {
if (VERBOSE_LOG) {
Log.v(LOG_TAG, "No TelecomManager found to get account address.");
}
}
String accountAddress = null;
if (tm != null && accountHandle != null) {
PhoneAccount account = tm.getPhoneAccount(accountHandle);
if (account != null) {
Uri address = account.getSubscriptionAddress();
if (address != null) {
accountAddress = address.getSchemeSpecificPart();
}
}
}
return accountAddress;
}
private static String getCurrentCountryIso(Context context) {
String countryIso = null;
final CountryDetector detector = (CountryDetector) context.getSystemService(