Skip to content
Commit d4c416fd authored by Alex Johnston's avatar Alex Johnston
Browse files

Change the data structure of restrictions in UM

Background
* In an org-owned managed profile device, two admins
  can set user restrictions on a user. The current
  data structure of local user restrictions uses a
  SparseArray<Bundle> where the key is the userId
  and the value is the restriction bundle.
* The existing data structure cannot store both the
  target userId and the originating userId.

Changes
* Introduces RestrictionsSet data structure, which is now
  used as a replacement of SparseArray<Bundle>.
* Updates the data structure of local restrictions to
  SparseArray<RestrictionsSet>. The first key is the
  target userId and the second key is the originating userId.
* targetUserId -> originatingUserId -> restrictionBundle
* Numerous methods in UserManagerService and
  UserRestrictionsUtils had to be changed to support this.

There will be follow up changes to move the logic of
sorting the restrictions into local and global restrictions
to DPMS.

Bug: 149743941
Test: atest com.android.server.pm.UserManagerTest
      atest com.android.server.pm.RestrictionsSetTest
      atest com.android.server.pm.UserRestrictionsUtilsTest
      atest com.android.cts.devicepolicy.UserRestrictionsTest

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