Merge "[BIC] Filter out REQUEST_INSTALL_PACKAGES perm" into udc-dev

This commit is contained in:
Wenhao Wang
2023-05-19 05:18:17 +00:00
committed by Android (Google) Code Review

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);