Store all permissions per-user.

By putting install permissions into all users when reading the old
USER_ALL state, and writing them back as how we have been writing
per-user permissions.

We are allowing roles to control signature permissions, however roles
are per-user while previously only one install permission state is
stored for all users, so we should make all permissions stored
per-user.

This change keeps reusing the old persistence mechanism, and the
alternative would be creating a new persistence inside
PermissionManagerService. However, since permission isn't getting
modularized in S, that would mean yet another form of persistence we
need to migrate from and another system API to support it, so I don't
think it's a good trade-off. Meanwhile, even if we manage to create
such a new persistence for per-user permission state, we are still
stuck with the legacy persistence for permission definitions inside
package (writeLegacyPermissionsTEMP) and thus still won't be in a
totally clean state. And to migrate that as well, we need yet another
storage class, system API and future migration path, without much
benefits from doing it besides legacy code looking better, so I
believe this change is the better approach to address our problem.

Once we modularized permission, we will be able to get rid of the
writeLegacyPermissionStateTEMP() methods.

Since we are no longer writing install permissions with package, we no
longer need to write permission state back to PackageSetting before
Settings.writeLPr().

The dumpsys output is maintained to be the same as before, where the
install permissions section will print the install permission state for
user 0.

Bug: 158736025
Test: presubmit
Change-Id: I8ebfb9acd354ad906490f3bb2fb9c962bc1c16eb
6 files changed