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

Commit d7c61d3f authored by wilsonshih's avatar wilsonshih
Browse files

Add a test to verify that the ShowWhenLocked state is removed...

...from the splash screen window if the app's main window does not
request ShowWhenLocked.

Flag: EXEMPT bugfix
Bug: 383131643
Test: atest ActivityRecordTests#testAdjustStartingWindowFlag
Change-Id: Ib0d8de4ba04d914c349e3cf165df922b97013aa4
parent 79071c28
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -2853,6 +2853,27 @@ public class ActivityRecordTests extends WindowTestsBase {
        assertNoStartingWindow(activity);
    }

    @Test
    public void testAdjustStartingWindowFlagAffectKeyguardFlag() {
        registerTestStartingWindowOrganizer();
        final ActivityRecord activity = new ActivityBuilder(mAtm).setCreateTask(true).build();
        activity.addStartingWindow(mPackageName, android.R.style.Theme, null, true, true, false,
                true, false, false, false);
        waitUntilHandlersIdle();
        assertHasStartingWindow(activity);
        activity.mStartingWindow.mAttrs.flags |= FLAG_SHOW_WHEN_LOCKED;
        assertTrue(activity.containsShowWhenLockedWindow());

        final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(
                TYPE_BASE_APPLICATION);
        attrs.setTitle("AppWindow");
        final WindowState win = createWindowState(attrs, activity);
        win.mAttrs.flags &= ~FLAG_SHOW_WHEN_LOCKED;
        // Simulate WindowManagerService.relayoutWindow
        win.adjustStartingWindowFlags();
        assertFalse(activity.containsShowWhenLockedWindow());
    }

    @Test
    public void testPostCleanupStartingWindow() {
        registerTestStartingWindowOrganizer();