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

Commit 2e565e6d authored by Shubham Ajmera's avatar Shubham Ajmera
Browse files

Fix: handle null value for packageUsageInfo while deciding unused apps

Bug: 36598475
Test: Verified for AOSP calculator
Change-Id: I86633a729ae34c621f9026fcf0486f2c0a5c7e4c
parent 3698fc8e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -209,10 +209,12 @@ public class PackageManagerServiceUtils {

        // If the app was active in background during the threshold period and was used
        // by other packages.
        // If packageUseInfo is null, it can be said that the package was not used by other
        // packages.
        boolean isActiveInBackgroundAndUsedByOtherPackages = ((currentTimeInMillis
                - latestPackageUseTimeInMillis)
                < thresholdTimeinMillis)
                && packageUseInfo.isUsedByOtherApps();
                && (packageUseInfo != null && packageUseInfo.isUsedByOtherApps());

        return !isActiveInBackgroundAndUsedByOtherPackages;
    }