Merge changes I7850ea5b,I9759b7dd

* changes:
  Prepare PackageState/PackageUserState for API
  Add runtime unmodifiable check for PackageState