Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8170d76 authored by Wenhao Wang's avatar Wenhao Wang
Browse files

[BIC] Filter out REQUEST_INSTALL_PACKAGES perm

The installations via REQUEST_INSTALL_PACKAGES need users' approval by default.
So we don't count them as background ones.

Bug: 283130197
Test: BackgroundInstallControlServiceTest
Change-Id: Iacab4de788e53d6fb7ddaa1a3f51eb7b83c06742
parent f91a331f
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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);