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

Commit fc36cc0a authored by Charles Chen's avatar Charles Chen Committed by Android (Google) Code Review
Browse files

Merge "Remove flag track_system_ui_context_before_wms" into main

parents f24b2e90 cd5ab8a2
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -3466,13 +3466,8 @@ class ContextImpl extends Context {

        // Step 2. Create a SystemUiContext to wrap the ContextImpl, which enables to listen to
        // its config updates.
        final Context systemUiContext;
        if (com.android.window.flags.Flags.trackSystemUiContextBeforeWms()) {
            systemUiContext = new SystemUiContext(context);
        final SystemUiContext systemUiContext = new SystemUiContext(context);
        context.setOuterContext(systemUiContext);
        } else {
            systemUiContext = context;
        }
        token.attachContext(systemUiContext);

        // Step 3. Associate the SystemUiContext with the display specified with ID.
+0 −6
Original line number Diff line number Diff line
@@ -23,8 +23,6 @@ import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.Configuration;

import com.android.window.flags.Flags;

/**
 * System Context to be used for UI. This Context has resources that can be themed.
 *
@@ -39,10 +37,6 @@ public class SystemUiContext extends ContextWrapper implements ConfigurationDisp

    public SystemUiContext(Context base) {
        super(base);
        if (!Flags.trackSystemUiContextBeforeWms()) {
            throw new UnsupportedOperationException("SystemUiContext can only be used after"
                    + " flag is enabled.");
        }
    }

    @Override
+1 −4
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.view.WindowManagerGlobal;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.window.flags.Flags;

/**
 * Singleton controller to manage the attached {@link WindowTokenClient}s, and to dispatch
@@ -141,9 +140,7 @@ public class WindowTokenClientController {
            // is initialized later, the SystemUiContext will start reporting from
            // DisplayContent#registerSystemUiContext, and WindowTokenClientController can report
            // the Configuration to the correct client.
            if (Flags.trackSystemUiContextBeforeWms()) {
            recordWindowContextToken(client);
            }
            return false;
        }
        final WindowContextInfo info;
+0 −11
Original line number Diff line number Diff line
@@ -96,17 +96,6 @@ flag {
    bug: "356277166"
}

flag {
    namespace: "windowing_sdk"
    name: "track_system_ui_context_before_wms"
    description: "Keep track of SystemUiContext before WMS is initialized"
    bug: "384428048"
    is_fixed_read_only: true
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    namespace: "car_framework"
    name: "safe_region_letterboxing"
+3 −29
Original line number Diff line number Diff line
@@ -43,11 +43,8 @@ import android.graphics.PixelFormat;
import android.hardware.display.DisplayManager;
import android.hardware.display.VirtualDisplay;
import android.media.ImageReader;
import android.os.Looper;
import android.os.UserHandle;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.DisabledOnRavenwood;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.annotations.Presubmit;
import android.platform.test.flag.junit.SetFlagsRule;
import android.platform.test.ravenwood.RavenwoodRule;
@@ -61,7 +58,6 @@ import androidx.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;

import com.android.internal.util.GcUtils;
import com.android.window.flags.Flags;

import org.junit.Rule;
import org.junit.Test;
@@ -305,29 +301,7 @@ public class ContextTest {

    @Test
    @DisabledOnRavenwood(blockedBy = Context.class)
    @DisableFlags(Flags.FLAG_TRACK_SYSTEM_UI_CONTEXT_BEFORE_WMS)
    public void testSysUiContextRegisterComponentCallbacks_disableFlag() {
        Looper.prepare();

        // Use createSystemActivityThreadForTesting to initialize
        // systemUiContext#getApplicationContext.
        final Context systemUiContext = ActivityThread.createSystemActivityThreadForTesting()
                .getSystemUiContext();
        final TestComponentCallbacks2 callbacks = new TestComponentCallbacks2();
        systemUiContext.registerComponentCallbacks(callbacks);

        final WindowTokenClient windowTokenClient =
                (WindowTokenClient) systemUiContext.getWindowContextToken();
        windowTokenClient.onConfigurationChanged(Configuration.EMPTY, DEFAULT_DISPLAY);

        assertWithMessage("ComponentCallbacks should delegate to the app Context "
                + "if the flag is disabled.").that(callbacks.mConfiguration).isNull();
    }

    @Test
    @DisabledOnRavenwood(blockedBy = Context.class)
    @EnableFlags(Flags.FLAG_TRACK_SYSTEM_UI_CONTEXT_BEFORE_WMS)
    public void testSysUiContextRegisterComponentCallbacks_enableFlag() {
    public void testSysUiContextRegisterComponentCallbacks() {
        final Context systemUiContext = ActivityThread.currentActivityThread()
                .createSystemUiContextForTesting(DEFAULT_DISPLAY);
        final TestComponentCallbacks2 callbacks = new TestComponentCallbacks2();
@@ -339,8 +313,8 @@ public class ContextTest {
                (WindowTokenClient) systemUiContext.getWindowContextToken();
        windowTokenClient.onConfigurationChanged(config, DEFAULT_DISPLAY);

        assertWithMessage("ComponentCallbacks should delegate to SystemUiContext "
                + "if the flag is enabled.").that(callbacks.mConfiguration).isEqualTo(config);
        assertWithMessage("ComponentCallbacks should delegate to SystemUiContext.")
                .that(callbacks.mConfiguration).isEqualTo(config);
    }

    @Test
Loading