Refactor PermissionsState to be a data class for migration.

PackageManager Settings will now read permission state from
PermissionManager as well, to maintain compatibility for dump and the
package list file. As a result, we no longer need to write back to
this legacy state before dump and writing package list. We still need
to do so before we finish persistence migration though.

The new AppIdPermissionState will be a system API once we finish
migration of BasePermission.

Bug: 158736025
Test: presubmit
Change-Id: I3c7f20cef54084255108a0a889d8a3d7e3ab9d88
11 files changed