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

Commit 727986a5 authored by Candice Lo's avatar Candice Lo Committed by Android (Google) Code Review
Browse files

Merge "Update window context to use the application theme for the default theme" into main

parents 8f746af2 0d6b4692
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -104,6 +104,10 @@ public class WindowContext extends ContextWrapper implements WindowProvider,
                    Flags.FLAG_REPARENT_TO_DEFAULT_WITH_DISPLAY_REMOVAL + " is not enabled");
        }
        Reference.reachabilityFence(this);
        if (android.view.accessibility.Flags.forceInvertColor()) {
            // Use the theme of the application as the default theme for this window context.
            base.setTheme(getApplicationInfo().theme);
        }
    }

    /**
+10 −0
Original line number Diff line number Diff line
@@ -208,6 +208,16 @@ public class WindowContextTest {
        });
    }

    @EnableFlags(android.view.accessibility.Flags.FLAG_FORCE_INVERT_COLOR)
    @Test
    public void testCreateWindowContext_applicationTheme() {
        final WindowContext windowContext = createWindowContext();

        final int applicationTheme = mInstrumentation.getTargetContext().getApplicationInfo().theme;
        assertThat(windowContext.getThemeResId()).isEqualTo(applicationTheme);
    }


    /**
     * Verifies the behavior when window context attaches an {@link Activity} by override
     * {@link WindowManager.LayoutParams#token}.