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

Commit cd13f869 authored by Yisroel Forta's avatar Yisroel Forta
Browse files

Start Profiling service

Test: service successfully starts, module initialized
Bug: 293957254
Change-Id: Ib12c44203667662ab073f4c054d5a671f9f69903
parent 5a859c7d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ import android.os.Parcel;
import android.os.ParcelFileDescriptor;
import android.os.PersistableBundle;
import android.os.Process;
import android.os.ProfilingFrameworkInitializer;
import android.os.ProfilingServiceManager;
import android.os.RemoteCallback;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -8548,6 +8550,9 @@ public final class ActivityThread extends ClientTransactionHandler
        NfcFrameworkInitializer.setNfcServiceManager(new NfcServiceManager());
        DeviceConfigInitializer.setDeviceConfigServiceManager(new DeviceConfigServiceManager());
        SeFrameworkInitializer.setSeServiceManager(new SeServiceManager());
        if (android.server.Flags.telemetryApisService()) {
            ProfilingFrameworkInitializer.setProfilingServiceManager(new ProfilingServiceManager());
        }
    }

    private void purgePendingResources() {
+4 −0
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ import android.os.IncidentManager;
import android.os.PerformanceHintManager;
import android.os.PermissionEnforcer;
import android.os.PowerManager;
import android.os.ProfilingFrameworkInitializer;
import android.os.RecoverySystem;
import android.os.SecurityStateManager;
import android.os.ServiceManager;
@@ -1662,6 +1663,9 @@ public final class SystemServiceRegistry {
            if (android.permission.flags.Flags.enhancedConfirmationModeApisEnabled()) {
                EnhancedConfirmationFrameworkInitializer.registerServiceWrappers();
            }
            if (android.server.Flags.telemetryApisService()) {
                ProfilingFrameworkInitializer.registerServiceWrappers();
            }
        } finally {
            // If any of the above code throws, we're in a pretty bad shape and the process
            // will likely crash, but we'll reset it just in case there's an exception handler...
+13 −1
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import android.content.pm.PackageManagerInternal;
import android.content.res.Configuration;
import android.content.res.Resources.Theme;
import android.credentials.CredentialManager;
import android.credentials.flags.Flags;
import android.database.sqlite.SQLiteCompatibilityWalFlags;
import android.database.sqlite.SQLiteGlobal;
import android.graphics.GraphicsStatsService;
@@ -464,6 +463,11 @@ public final class SystemServer implements Dumpable {
    private static final String DEVICE_LOCK_APEX_PATH =
            "/apex/com.android.devicelock/javalib/service-devicelock.jar";

    private static final String PROFILING_SERVICE_LIFECYCLE_CLASS =
            "android.os.profiling.ProfilingService$Lifecycle";
    private static final String PROFILING_SERVICE_JAR_PATH =
            "/apex/com.android.profiling/javalib/service-profiling.jar";

    private static final String TETHERING_CONNECTOR_CLASS = "android.net.ITetheringConnector";

    private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
@@ -2774,6 +2778,14 @@ public final class SystemServer implements Dumpable {
        mSystemServiceManager.startService(ON_DEVICE_PERSONALIZATION_SYSTEM_SERVICE_CLASS);
        t.traceEnd();

        // Profiling
        if (android.server.Flags.telemetryApisService()) {
            t.traceBegin("StartProfilingCompanion");
            mSystemServiceManager.startServiceFromJar(PROFILING_SERVICE_LIFECYCLE_CLASS,
                    PROFILING_SERVICE_JAR_PATH);
            t.traceEnd();
        }

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