Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 8afd44ae authored by Songchun Fan's avatar Songchun Fan
Browse files

[pm] consolidate clearPackageStateForUser

Mostly a refactoring to consolidate duplicated code.

The old code had duplicated logic for clearing state for a
single user vs for UserHandle.USER_ALL.

In the old code, there are inconsistencies regarding whether certain
states should be cleared based whether DELETE_KEEP_DATA is set. This CL
makes the following changes:

* destroyAppProfilesLIF.
   Old behavior: for single user, it is called regardless of
   DELETE_KEEP_DATA. For ALL_USER, it is called only if DELETE_KEEP_DATA
   is not set.
   New behavior: it is always called regardless of DELETE_KEEP_DATA.

* mDomainVerificationManager.clearPackageForUser.
   Old behavior: for single user, it is called regardless of
   DELETE_KEEP_DATA. For ALL_USER, it is called only if
   DELETE_KEEP_DATA is not set.
   New behavior: it is called only if DELETE_KEEP_DATA is not set.

* clearPackagePreferredActivities and clearKeystoreData. Same as above.

All the states will be preserved if DELETE_KEEP_DATA is set, except for ART profiles.
Delete for a single `--user` will be consistent with delete for all users.

BUG: 314207341
Test: atest CtsPackageManagerTest

Change-Id: Iba3c3b6ba77e85122707683592f18f67054f9f31
parent 6761a39c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment