Merge "Add fields for PhoneAccountHandle without IccIds in T" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-04-08 01:38:07 +00:00
committed by Android (Google) Code Review
2 changed files with 58 additions and 7 deletions

View File

@@ -425,6 +425,7 @@ public class CallLog {
private double mLatitude = Double.NaN;
private double mLongitude = Double.NaN;
private Uri mPictureUri;
private int mIsPhoneAccountMigrationPending;
/**
* @param callerInfo the CallerInfo object to get the target contact from.
@@ -633,6 +634,15 @@ public class CallLog {
return this;
}
/**
* @param isPhoneAccountMigrationPending whether the phone account migration is pending
*/
public @NonNull AddCallParametersBuilder setIsPhoneAccountMigrationPending(
int isPhoneAccountMigrationPending) {
mIsPhoneAccountMigrationPending = isPhoneAccountMigrationPending;
return this;
}
/**
* Builds the object
*/
@@ -641,7 +651,8 @@ public class CallLog {
mPresentation, mCallType, mFeatures, mAccountHandle, mStart, mDuration,
mDataUsage, mAddForAllUsers, mUserToBeInsertedTo, mIsRead, mCallBlockReason,
mCallScreeningAppName, mCallScreeningComponentName, mMissedReason,
mPriority, mSubject, mLatitude, mLongitude, mPictureUri);
mPriority, mSubject, mLatitude, mLongitude, mPictureUri,
mIsPhoneAccountMigrationPending);
}
}
@@ -668,6 +679,7 @@ public class CallLog {
private double mLatitude = Double.NaN;
private double mLongitude = Double.NaN;
private Uri mPictureUri;
private int mIsPhoneAccountMigrationPending;
private AddCallParams(CallerInfo callerInfo, String number, String postDialDigits,
String viaNumber, int presentation, int callType, int features,
@@ -676,7 +688,8 @@ public class CallLog {
int callBlockReason,
CharSequence callScreeningAppName, String callScreeningComponentName,
long missedReason,
int priority, String subject, double latitude, double longitude, Uri pictureUri) {
int priority, String subject, double latitude, double longitude, Uri pictureUri,
int isPhoneAccountMigrationPending) {
mCallerInfo = callerInfo;
mNumber = number;
mPostDialDigits = postDialDigits;
@@ -700,6 +713,7 @@ public class CallLog {
mLatitude = latitude;
mLongitude = longitude;
mPictureUri = pictureUri;
mIsPhoneAccountMigrationPending = isPhoneAccountMigrationPending;
}
}
@@ -1481,6 +1495,21 @@ public class CallLog {
*/
public static final String LOCATION = "location";
/**
* A reference to indicate whether phone account migration process is pending.
*
* Before Android 13, {@link PhoneAccountHandle#getId()} returns the ICCID for Telephony
* PhoneAccountHandle. Starting from Android 13, {@link PhoneAccountHandle#getId()} returns
* the Subscription ID for Telephony PhoneAccountHandle. A phone account migration process
* is to ensure this PhoneAccountHandle migration process cross the Android versions in
* the CallLog database.
*
* <p>Type: INTEGER</p>
* @hide
*/
public static final String IS_PHONE_ACCOUNT_MIGRATION_PENDING =
"is_call_log_phone_account_migration_pending";
/**
* Adds a call to the call log.
*
@@ -1498,6 +1527,7 @@ public class CallLog {
* @param duration call duration in seconds
* @param dataUsage data usage for the call in bytes, null if data usage was not tracked for
* the call.
* @param isPhoneAccountMigrationPending whether the PhoneAccountHandle ID need to migrate
* @result The URI of the call log entry belonging to the user that made or received this
* call.
* {@hide}
@@ -1505,13 +1535,14 @@ public class CallLog {
public static Uri addCall(CallerInfo ci, Context context, String number,
int presentation, int callType, int features,
PhoneAccountHandle accountHandle,
long start, int duration, Long dataUsage, long missedReason) {
long start, int duration, Long dataUsage, long missedReason,
int isPhoneAccountMigrationPending) {
return addCall(ci, context, number, "" /* postDialDigits */, "" /* viaNumber */,
presentation, callType, features, accountHandle, start, duration,
dataUsage, false /* addForAllUsers */, null /* userToBeInsertedTo */,
false /* isRead */, Calls.BLOCK_REASON_NOT_BLOCKED /* callBlockReason */,
null /* callScreeningAppName */, null /* callScreeningComponentName */,
missedReason);
missedReason, isPhoneAccountMigrationPending);
}
@@ -1539,6 +1570,7 @@ public class CallLog {
* @param userToBeInsertedTo {@link UserHandle} of user that the call is going to be
* inserted to. null if it is inserted to the current user. The
* value is ignored if @{link addForAllUsers} is true.
* @param isPhoneAccountMigrationPending whether the PhoneAccountHandle ID need to migrate
* @result The URI of the call log entry belonging to the user that made or received this
* call.
* {@hide}
@@ -1547,12 +1579,13 @@ public class CallLog {
String postDialDigits, String viaNumber, int presentation, int callType,
int features, PhoneAccountHandle accountHandle, long start, int duration,
Long dataUsage, boolean addForAllUsers, UserHandle userToBeInsertedTo,
long missedReason) {
long missedReason, int isPhoneAccountMigrationPending) {
return addCall(ci, context, number, postDialDigits, viaNumber, presentation, callType,
features, accountHandle, start, duration, dataUsage, addForAllUsers,
userToBeInsertedTo, false /* isRead */ , Calls.BLOCK_REASON_NOT_BLOCKED
/* callBlockReason */, null /* callScreeningAppName */,
null /* callScreeningComponentName */, missedReason);
null /* callScreeningComponentName */, missedReason,
isPhoneAccountMigrationPending);
}
@@ -1588,6 +1621,7 @@ public class CallLog {
* @param callScreeningAppName The call screening application name which block the call.
* @param callScreeningComponentName The call screening component name which block the call.
* @param missedReason The encoded missed information of the call.
* @param isPhoneAccountMigrationPending whether the PhoneAccountHandle ID need to migrate
*
* @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,
@@ -1600,7 +1634,8 @@ public class CallLog {
int features, PhoneAccountHandle accountHandle, long start, int duration,
Long dataUsage, boolean addForAllUsers, UserHandle userToBeInsertedTo,
boolean isRead, int callBlockReason, CharSequence callScreeningAppName,
String callScreeningComponentName, long missedReason) {
String callScreeningComponentName, long missedReason,
int isPhoneAccountMigrationPending) {
AddCallParams.AddCallParametersBuilder builder =
new AddCallParams.AddCallParametersBuilder();
builder.setCallerInfo(ci);
@@ -1621,6 +1656,7 @@ public class CallLog {
builder.setCallScreeningAppName(callScreeningAppName);
builder.setCallScreeningComponentName(callScreeningComponentName);
builder.setMissedReason(missedReason);
builder.setIsPhoneAccountMigrationPending(isPhoneAccountMigrationPending);
return addCall(context, builder.build());
}
@@ -1692,6 +1728,7 @@ public class CallLog {
if (params.mPictureUri != null) {
values.put(COMPOSER_PHOTO_URI, params.mPictureUri.toString());
}
values.put(IS_PHONE_ACCOUNT_MIGRATION_PENDING, params.mIsPhoneAccountMigrationPending);
if ((params.mCallerInfo != null) && (params.mCallerInfo.getContactId() > 0)) {
// Update usage information for the number associated with the contact ID.

View File

@@ -4336,6 +4336,20 @@ public final class ContactsContract {
@Deprecated
public static final int CARRIER_PRESENCE_VT_CAPABLE = 0x01;
/**
* A reference to indicate whether phone account migration process is pending.
*
* Before Android 13, {@link PhoneAccountHandle#getId()} returns the ICCID for Telephony
* PhoneAccountHandle. Starting from Android 13, {@link PhoneAccountHandle#getId()} returns
* the Subscription ID for Telephony PhoneAccountHandle. A phone account migration process
* is to ensure this PhoneAccountHandle migration process cross the Android versions in
* the ContactsContract database.
*
* <p>Type: INTEGER</p>
* @hide
*/
String IS_PHONE_ACCOUNT_MIGRATION_PENDING = "is_preferred_phone_account_migration_pending";
/**
* The flattened {@link android.content.ComponentName} of a {@link
* android.telecom.PhoneAccountHandle} that is the preferred {@code PhoneAccountHandle} to