Read newImplicit perms before modifying perm state

For shared uids the original and new state are the same object. Hence we
loose knowledge of the old state when we modify it. Hence check if the
perm is new & implicit before modifying the state.

Bug: 129796592
Fixes: 130707789
Test: atest CtsPermissionTestCases:android.permission.cts.SplitPermissionTest
      (added new test case for shared uids)
Change-Id: I647bb28e667c3b8a93e11bd1771ad472c1a132c1
2 files changed