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

Commit bfcda39c authored by Peter Visontay's avatar Peter Visontay
Browse files

Fixed NPE in ActivityManager's launch count service.

Bug: 3497127
Change-Id: I38661fb0654e807f05cc57e43cff912de8d39096
parent 0528bc77
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1253,8 +1253,13 @@ public class ActivityManager {
                return new HashMap<String, Integer>();
            }

            PkgUsageStats[] allPkgUsageStats = usageStatsService.getAllPkgUsageStats();
            if (allPkgUsageStats == null) {
                return new HashMap<String, Integer>();
            }

            Map<String, Integer> launchCounts = new HashMap<String, Integer>();
            for (PkgUsageStats pkgUsageStats : usageStatsService.getAllPkgUsageStats()) {
            for (PkgUsageStats pkgUsageStats : allPkgUsageStats) {
                launchCounts.put(pkgUsageStats.packageName, pkgUsageStats.launchCount);
            }