PhoneAccountHandle without IccId 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.
When the database is created and upgraded, the device finds the
mapping between Sub IDs and IccID by looking at the subscription DB in
Telephony and migrate. Set pending status if migration is not available
yet.
The two databases will listen to broadcast
"ACTION_PHONE_ACCOUNT_REGISTERED" to identify a new sim event and
performing migration for pending status if possible. This need to
be registered as a runtime register instead of a manifest broadcast
to avoid process started when unnecessary.
In multi-user cases, database for each user would be different. A
database for each user need to migrate the database when the database
is created or initialized. The way to check if the database need to
pending is using a sharedPreference.
The historical design is based on a logic that the framework unhides
the restored PhoneAccountHandle in call log when the PhoneAccountHandle
is registered by Telecom. The best time to do the migration based on
the sim event is after PhoneAccountHandle is registered by Telecom
and before Calllog provider unhides it.
Bug: 185235527
Test: atest CallLogMigrationTest;
atest ContactsProvider2Test;
atest ContactsDatabaseMigrationTest;
atest CallLogProviderTest;
atest ContactsDatabaseHelperUpgradeTest
Change-Id: I9397ad03094da80c4d6c522e1e09a844edfc4231
16 files changed