diff options
| author | Shuo Qian <shuoq@google.com> | 2021-10-19 15:59:21 -0700 |
|---|---|---|
| committer | Grace Jia <xiaotonj@google.com> | 2022-03-30 15:35:55 +0000 |
| commit | 0af97c579e52f21703370060fe933094671dcb72 (patch) | |
| tree | c0c8d21fa0aa28ab03968e19338e7ff724b3bed0 /core/java/android | |
| parent | cca1088b9b5be1a20cb80f2456e82442019d08ba (diff) | |
Add fields for PhoneAccountHandle without IccIds in T
Before Android 13, PhoneAccountHandle#getId() returns the ICCID
for Telephony PhoneAccountHandle. Starting from Android 13,
PhoneAccountHandle#getId() returns the on-device Subscription ID
for Telephony PhoneAccountHandle. This need to migrate the
PhoneAccountHandle ID stored in CalllogProvider and ContactsProvider.
Adding these fields to help migrate the ID when it is stored in
the device, and back-up/restored through the cloud.
Bug: 185235527
Test: atest ContactsProvider2Test;
atest CallLogProviderTest
Change-Id: I417f211413cf92a2757899360d6905d0d50064ec
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/provider/CallLog.java | 51 | ||||
| -rw-r--r-- | core/java/android/provider/ContactsContract.java | 14 |
2 files changed, 58 insertions, 7 deletions
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java index 8dca7abaca8e..0e5a65ce71b7 100644 --- a/core/java/android/provider/CallLog.java +++ b/core/java/android/provider/CallLog.java @@ -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. @@ -634,6 +635,15 @@ public class CallLog { } /** + * @param isPhoneAccountMigrationPending whether the phone account migration is pending + */ + public @NonNull AddCallParametersBuilder setIsPhoneAccountMigrationPending( + int isPhoneAccountMigrationPending) { + mIsPhoneAccountMigrationPending = isPhoneAccountMigrationPending; + return this; + } + + /** * Builds the object */ public @NonNull AddCallParams build() { @@ -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; } } @@ -1482,6 +1496,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. * * @param ci the CallerInfo object to get the target contact from. Can be null @@ -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. diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index b9f5144ef49f..3c1b4ba8f8b5 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -4337,6 +4337,20 @@ public final class ContactsContract { 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 * call the contact with. |
