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

Commit b84cb9e9 authored by Jeff Hao's avatar Jeff Hao
Browse files

Shorten first boot time by filtering dexopted apps by LRU.

No longer dexopt all system apps and boot listener user apps.

Bug: 23628238
Bug: https://code.google.com/p/android/issues/detail?id=186589

Change-Id: Ib4f960686afcfda13838f7783c2d3ccf8e26db72
parent a884d81e
Loading
Loading
Loading
Loading
+0 −35
Original line number Original line Diff line number Diff line
@@ -4628,41 +4628,6 @@ public class PackageManagerService extends IPackageManager.Stub {
                    it.remove();
                    it.remove();
                }
                }
            }
            }
            // Give priority to system apps.
            for (Iterator<PackageParser.Package> it = pkgs.iterator(); it.hasNext();) {
                PackageParser.Package pkg = it.next();
                if (isSystemApp(pkg) && !pkg.isUpdatedSystemApp()) {
                    if (DEBUG_DEXOPT) {
                        Log.i(TAG, "Adding system app " + sortedPkgs.size() + ": " + pkg.packageName);
                    }
                    sortedPkgs.add(pkg);
                    it.remove();
                }
            }
            // Give priority to updated system apps.
            for (Iterator<PackageParser.Package> it = pkgs.iterator(); it.hasNext();) {
                PackageParser.Package pkg = it.next();
                if (pkg.isUpdatedSystemApp()) {
                    if (DEBUG_DEXOPT) {
                        Log.i(TAG, "Adding updated system app " + sortedPkgs.size() + ": " + pkg.packageName);
                    }
                    sortedPkgs.add(pkg);
                    it.remove();
                }
            }
            // Give priority to apps that listen for boot complete.
            intent = new Intent(Intent.ACTION_BOOT_COMPLETED);
            pkgNames = getPackageNamesForIntent(intent);
            for (Iterator<PackageParser.Package> it = pkgs.iterator(); it.hasNext();) {
                PackageParser.Package pkg = it.next();
                if (pkgNames.contains(pkg.packageName)) {
                    if (DEBUG_DEXOPT) {
                        Log.i(TAG, "Adding boot app " + sortedPkgs.size() + ": " + pkg.packageName);
                    }
                    sortedPkgs.add(pkg);
                    it.remove();
                }
            }
            // Filter out packages that aren't recently used.
            // Filter out packages that aren't recently used.
            filterRecentlyUsedApps(pkgs);
            filterRecentlyUsedApps(pkgs);
            // Add all remaining apps.
            // Add all remaining apps.