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

Commit e41913e5 authored by TYM Tsai's avatar TYM Tsai
Browse files

Add metrics for waiting dexopt

Bug: 388159696
FLAG: EXEMPT add metrics
Test: run statsd_testdrive and check output: install_steps: 8
Change-Id: If5ec8af18317a2691041709d99a64bfe41d5460e
parent 82468707
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 {