Enforce the permission and the owner rights earlier

Move the check to the early section of the method to secure the

Bug: 188219307
Test: atest PackageManagerServiceHibernationTests
Test: atest -p services/core/java/com/android/server/am
Test: atest -p services/core/java/com/android/server/pm
Test: manually using the PoC in the buganizer to ensure the symptom
      no longer exists.
Change-Id: I49c456da65cb2befbf5c435e5febcdd9434be684
2 files changed