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

Commit e5be43c1 authored by Andreas Gampe's avatar Andreas Gampe Committed by android-build-merger
Browse files

Merge "OtaDexOptService: Log post-reboot moves" am: ac293515 am: 4e04b588 am: 5e818201

am: c3118992

Change-Id: I62728490a76253ec90584750ccf4dcea85ca6a11
parents ce7cfd1e c3118992
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -95,9 +95,6 @@ public class OtaDexoptService extends IOtaDexopt.Stub {
    public OtaDexoptService(Context context, PackageManagerService packageManagerService) {
        this.mContext = context;
        this.mPackageManagerService = packageManagerService;

        // Now it's time to check whether we need to move any A/B artifacts.
        moveAbArtifacts(packageManagerService.mInstaller);
    }

    public static OtaDexoptService main(Context context,
@@ -105,6 +102,9 @@ public class OtaDexoptService extends IOtaDexopt.Stub {
        OtaDexoptService ota = new OtaDexoptService(context, packageManagerService);
        ServiceManager.addService("otadexopt", ota);

        // Now it's time to check whether we need to move any A/B artifacts.
        ota.moveAbArtifacts(packageManagerService.mInstaller);

        return ota;
    }

@@ -323,8 +323,15 @@ public class OtaDexoptService extends IOtaDexopt.Stub {
            throw new IllegalStateException("Should not be ota-dexopting when trying to move.");
        }

        if (!mPackageManagerService.isUpgrade()) {
            Slog.d(TAG, "No upgrade, skipping A/B artifacts check.");
            return;
        }

        // Look into all packages.
        Collection<PackageParser.Package> pkgs = mPackageManagerService.getPackages();
        int packagePaths = 0;
        int pathsSuccessful = 0;
        for (PackageParser.Package pkg : pkgs) {
            if (pkg == null) {
                continue;
@@ -355,13 +362,16 @@ public class OtaDexoptService extends IOtaDexopt.Stub {

                    // TODO: Check first whether there is an artifact, to save the roundtrip time.

                    packagePaths++;
                    try {
                        installer.moveAb(path, dexCodeInstructionSet, oatDir);
                        pathsSuccessful++;
                    } catch (InstallerException e) {
                    }
                }
            }
        }
        Slog.i(TAG, "Moved " + pathsSuccessful + "/" + packagePaths);
    }

    /**