[PM] Check unknown sources for intent installation

Bypass the unknown source check for the device policy and the AppOps
permission when either of the following two conditions is met:

1. An installer with the INSTALL_PACKAGES permission initiated the
   installation via the PackageInstaller APIs and not via an
   ACTION_VIEW or ACTION_INSTALL_PACKAGE intent.
2. An installer is a privileged app and it has set the
   EXTRA_NOT_UNKNOWN_SOURCE flag to be true in the intent.

Flag: EXEMPT BUGFIX
Bug: 461467954
Test: atest CtsDevicePolicyManagerTestCases:MixedProfileOwnerTest#testPackageInstallUserRestrictions
Test: atest CtsDevicePolicyManagerTestCases:MixedManagedProfileOwnerTest#testPackageInstallUserRestrictions
Test: atest CtsPackageInstallTestCases:IntentTest
Test: atest CtsPackageInstallSessionTestCases:SessionTest
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:3a8cafbc916bb16f08093cd138a4f3d4dc71b5a0
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:9aec06e22b59a74f7bc90d285eee3a52963c6a91
Merged-In: I66e863cf06566ddc08ad78a61dd82a548cde5e4c
Change-Id: I66e863cf06566ddc08ad78a61dd82a548cde5e4c
2 files changed