Merge "[BIC] Filter out REQUEST_INSTALL_PACKAGES perm" into udc-dev am: 62fef3500a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23303159

Change-Id: I4129e1865feb01a7cd16251a7e8cb880037dfc64
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Wenhao Wang
2023-05-19 05:27:25 +00:00
committed by Automerger Merge Worker

View File

@@ -231,6 +231,14 @@ public class BackgroundInstallControlService extends SystemService {
return;
}
// the installers without INSTALL_PACKAGES perm can't perform
// the installation in background. So we can just filter out them.
if (mPermissionManager.checkPermission(installerPackageName,
android.Manifest.permission.INSTALL_PACKAGES,
userId) != PackageManager.PERMISSION_GRANTED) {
return;
}
// convert up-time to current time.
final long installTimestamp = System.currentTimeMillis()
- (SystemClock.uptimeMillis() - appInfo.createTimestamp);