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

Commit 19dc5cee authored by Matt Gilbride's avatar Matt Gilbride
Browse files

Setup UprobeStatsService

Service implemented in `packages/modules/UprobeStats`
and launched conditionally based on on a mainline
flag in the same.

Bug: 408041227
Bug: 408253078
Test: TH
Flag: android.security.service_uprobestats

Change-Id: I581390c5e48d498094367f346d96ce1905ac2b7b
parent b22f81b6
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -468,6 +468,10 @@ public final class SystemServer implements Dumpable {
            "com.android.os.profiling.anomaly.AnomalyDetectorService";
    private static final String SIGNAL_COLLECTOR_SERVICE_CLASS =
            "com.android.server.signalcollector";
    private static final String UPROBESTATS_SERVICE_JAR_PATH =
            "/apex/com.android.uprobestats/javalib/service-uprobestats.jar";
    private static final String UPROBESTATS_SERVICE_CLASS =
            "com.android.os.uprobestats.UprobeStatsService";

    private static final String RANGING_APEX_SERVICE_JAR_PATH =
            "/apex/com.android.uwb/javalib/service-ranging.jar";
@@ -2985,6 +2989,23 @@ public final class SystemServer implements Dumpable {
            t.traceEnd();
        }

        // UprobeStats
        if (android.security.Flags.serviceUprobestats()) {
            t.traceBegin("StartUprobeStatsService");
            // The service class is defined in a mainline module, and is not providing any
            // core, user facing functionality. It is only used for collecting telemetry
            // and anti-abuse. Thus, catch any startup exceptions and report them as WTFs.
            try {
                mSystemServiceManager.startServiceFromJar(
                        UPROBESTATS_SERVICE_CLASS, UPROBESTATS_SERVICE_JAR_PATH);
            } catch (Throwable e) {
                reportWtf("StartUprobeStatsService", e);
            }
            t.traceEnd();
        } else if (Build.IS_DEBUGGABLE) {
            Slog.d(TAG, "UprobeStatsService disabled by flag");
        }

        if (safeMode) {
            mActivityManagerService.enterSafeMode();
        }