Loading
Reapply "[PM] Check unknown sources user restriction for intent installation"
This reverts commit 29962260bd043c197e411b690e862a318b31bae5. Fix the issues and reland the patch. Bypass the unknown source user restrictions check 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 initiated the installer via the ACTION_INSTALL_PACKAGE or ACTION_VIEW intent, but it has set the EXTRA_NOT_UNKNOWN_SOURCE flag to be true in the intent. Flag: EXEMPT BUGFIX Bug: 438352252 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:81f83fdb0944d0d8a3337d2578d73dd77d60143b Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:6e0b7c02e54a0c8f26ecb2eefd136677df7decfc Merged-In: Ib917acb2c4738f6a4758b8ca149b80943f00acca Change-Id: Ib917acb2c4738f6a4758b8ca149b80943f00acca