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

Commit 2457f5b9 authored by Noah Zimmt's avatar Noah Zimmt
Browse files

Remove extra settings write on package replace

During a package replace for non-system packages, commitPackagesLocked
runs executeDeletePackagesLIF, followed by updateSettingsLI. Both methods
call Settings#writeLPr internally, causing the entire packages.xml file
to be re-generated twice in a row.

Removing the extra call typically saves 40-50ms on my mostly-empty Pixel 3
with a 1 MB /data/system/packages.xml. I assume the savings scale up with
slower hardware & more apps installed.

Bug: 138450974
Test: Manually verified packages.xml is identical after install
as compared to an unchanged build.
Change-Id: Ibeeec9e5ff1ca60c2368f4faab2f1d3ab3d3497e
parent 44a27da9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -16860,8 +16860,9 @@ public class PackageManagerService extends IPackageManager.Stub
                    }
                } else {
                    try {
                        // Settings will be written during the call to updateSettingsLI().
                        executeDeletePackageLIF(reconciledPkg.deletePackageAction, packageName,
                                true, request.mAllUsers, true, pkg);
                                true, request.mAllUsers, false, pkg);
                    } catch (SystemDeleteException e) {
                        if (Build.IS_ENG) {
                            throw new RuntimeException("Unexpected failure", e);