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

Commit cbc2c7db authored by Winson Chung's avatar Winson Chung
Browse files

Ensure wm components are only initialized for main sysui process

Bug: 171802402
Test: Take screenshot and ensure it doesn't reinitialize
Change-Id: I1362d07c0eab57f2125ba6140ec1c03970b39030
parent 0197100d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui;

import android.app.ActivityThread;
import android.content.Context;
import android.content.res.AssetManager;
import android.content.res.Resources;
@@ -85,8 +86,10 @@ public class SystemUIFactory {
    @VisibleForTesting
    public void init(Context context, boolean fromTest)
            throws ExecutionException, InterruptedException {
        // Only initialize components for the main system ui process running as the primary user
        final boolean initializeComponents = !fromTest
                && android.os.Process.myUserHandle().isSystem();
                && android.os.Process.myUserHandle().isSystem()
                && ActivityThread.currentProcessName().equals(ActivityThread.currentPackageName());
        mRootComponent = buildGlobalRootComponent(context);
        // Stand up WMComponent
        mWMComponent = mRootComponent.getWMComponentBuilder().build();