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

Commit 3f20161d authored by Olivier Gaillard's avatar Olivier Gaillard
Browse files

Log an event when packages are installed to understand the impact on ANRs.

Bug: 318823843
Change-Id: I700ff65587f14a75e869c8c76a6ae7022f6c3067
parent 03b5547f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -60,8 +60,11 @@ message CriticalEventProto {
    JavaCrash java_crash = 5;
    NativeCrash native_crash = 6;
    SystemServerStarted system_server_started = 7;
    InstallPackages install_packages = 8;
  }

  message InstallPackages {}

  message SystemServerStarted {}

  message Watchdog {
+8 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.server.criticalevents.nano.CriticalEventLogStorageProto;
import com.android.server.criticalevents.nano.CriticalEventProto;
import com.android.server.criticalevents.nano.CriticalEventProto.AppNotResponding;
import com.android.server.criticalevents.nano.CriticalEventProto.HalfWatchdog;
import com.android.server.criticalevents.nano.CriticalEventProto.InstallPackages;
import com.android.server.criticalevents.nano.CriticalEventProto.JavaCrash;
import com.android.server.criticalevents.nano.CriticalEventProto.NativeCrash;
import com.android.server.criticalevents.nano.CriticalEventProto.SystemServerStarted;
@@ -142,6 +143,13 @@ public class CriticalEventLog {
        return System.currentTimeMillis();
    }

    /** Logs when one or more packages are installed. */
    public void logInstallPackagesStarted() {
        CriticalEventProto event = new CriticalEventProto();
        event.setInstallPackages(new InstallPackages());
        log(event);
    }

    /** Logs when system server started. */
    public void logSystemServerStarted() {
        CriticalEventProto event = new CriticalEventProto();
+2 −0
Original line number Diff line number Diff line
@@ -175,6 +175,7 @@ import com.android.server.SystemConfig;
import com.android.server.art.model.ArtFlags;
import com.android.server.art.model.DexoptParams;
import com.android.server.art.model.DexoptResult;
import com.android.server.criticalevents.CriticalEventLog;
import com.android.server.pm.Installer.LegacyDexoptDisabledException;
import com.android.server.pm.dex.ArtManagerService;
import com.android.server.pm.dex.DexManager;
@@ -957,6 +958,7 @@ final class InstallPackageHelper {
        final Set<String> scannedPackages = new ArraySet<>(requests.size());
        final Map<String, Settings.VersionInfo> versionInfos = new ArrayMap<>(requests.size());
        final Map<String, Boolean> createdAppId = new ArrayMap<>(requests.size());
        CriticalEventLog.getInstance().logInstallPackagesStarted();
        boolean success = false;
        try {
            Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "installPackagesLI");