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

Commit 124090d5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add metrics for waiting dexopt" into main

parents 7e982833 e41913e5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1067,6 +1067,9 @@ final class InstallPackageHelper {
    void doPostDexopt(List<ReconciledPackage> reconciledPackages,
            List<InstallRequest> requests, Map<String, Boolean> createdAppId,
            MoveInfo moveInfo, long acquireTime) {
        for (InstallRequest request : requests) {
            request.onWaitDexoptFinished();
        }
        boolean success = false;
        try {
            if (commitInstallPackages(reconciledPackages)) {
@@ -1218,6 +1221,7 @@ final class InstallPackageHelper {
            CompletableFuture<Void> future =
                    DexOptHelper.performDexoptIfNeededAsync(request, mDexManager);
            completableFutures.add(future);
            request.onWaitDexoptStarted();
        }

        if (!completableFutures.isEmpty()) {
+12 −0
Original line number Diff line number Diff line
@@ -1028,6 +1028,18 @@ final class InstallRequest {
        }
    }

    public void onWaitDexoptStarted() {
        if (mPackageMetrics != null) {
            mPackageMetrics.onStepStarted(PackageMetrics.STEP_WAIT_DEXOPT);
        }
    }

    public void onWaitDexoptFinished() {
        if (mPackageMetrics != null) {
            mPackageMetrics.onStepFinished(PackageMetrics.STEP_WAIT_DEXOPT);
        }
    }

    public void onDexoptFinished(DexoptResult dexoptResult) {
        // Only report external profile warnings when installing from adb. The goal is to warn app
        // developers if they have provided bad external profiles, so it's not beneficial to report
+3 −1
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ final class PackageMetrics {
    public static final int STEP_DEXOPT = 5;
    public static final int STEP_FREEZE_INSTALL = 6;
    public static final int STEP_RESTORE = 7;
    public static final int STEP_WAIT_DEXOPT = 8;

    @IntDef(prefix = {"STEP_"}, value = {
            STEP_PREPARE,
@@ -81,7 +82,8 @@ final class PackageMetrics {
            STEP_COMMIT,
            STEP_DEXOPT,
            STEP_FREEZE_INSTALL,
            STEP_RESTORE
            STEP_RESTORE,
            STEP_WAIT_DEXOPT
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface StepInt {