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

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

Merge "RegisterWithPerfetto only from SystemUI main process" into main

parents c6dd4f0c 4a0a8322
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Process;
@@ -81,7 +80,9 @@ public class SystemUIApplication extends Application implements

    public SystemUIApplication() {
        super();
        if (!isSubprocess()) {
            Trace.registerWithPerfetto();
        }
        Log.v(TAG, "SystemUIApplication constructed.");
        // SysUI may be building without protolog preprocessing in some cases
        ProtoLog.REQUIRE_PROTOLOGTOOL = false;
@@ -182,9 +183,7 @@ public class SystemUIApplication extends Application implements
        } else {
            // We don't need to startServices for sub-process that is doing some tasks.
            // (screenshots, sweetsweetdesserts or tuner ..)
            String processName = ActivityThread.currentProcessName();
            ApplicationInfo info = getApplicationInfo();
            if (processName != null && processName.startsWith(info.processName + ":")) {
            if (isSubprocess()) {
                return;
            }
            // For a secondary user, boot-completed will never be called because it has already
@@ -195,6 +194,12 @@ public class SystemUIApplication extends Application implements
        }
    }

    /** Returns whether this is a subprocess (e.g. com.android.systemui:screenshot) */
    private boolean isSubprocess() {
        String processName = ActivityThread.currentProcessName();
        return processName != null && processName.contains(":");
    }

    /**
     * Makes sure that all the CoreStartables are running. If they are already running, this is a
     * no-op. This is needed to conditionally start all the services, as we only need to have it in