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

Commit a7c59ed9 authored by Massimo Carli's avatar Massimo Carli Committed by Android (Google) Code Review
Browse files

Merge "Flag app_compat_async_relayout removal" into main

parents 9a15ab28 7c883bce
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -70,18 +70,6 @@ flag {
  bug: "353697519"
}

flag {
  name: "app_compat_async_relayout"
  namespace: "large_screen_experiences_app_compat"
  description: "Whether we use the SurfaceViewHost overload to apply a change in /n"
               "position and size in a Transaction provided by a callback invoked /n"
               "after the View relayout."
  bug: "322463856"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "app_compat_refactoring"
  namespace: "large_screen_experiences_app_compat"
+2 −10
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import android.view.WindowManager;
import android.view.WindowlessWindowManager;

import com.android.internal.annotations.VisibleForTesting;
import com.android.window.flags.Flags;
import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.common.DisplayLayout;
import com.android.wm.shell.common.SyncTransactionQueue;
@@ -328,16 +327,9 @@ public abstract class CompatUIWindowManagerAbstract extends WindowlessWindowMana
        if (mViewHost == null) {
            return;
        }
        if (Flags.appCompatAsyncRelayout()) {
            mViewHost.relayout(windowLayoutParams, tx -> {
                updateSurfacePosition(tx);
                tx.apply();
            });
        } else {
        mViewHost.relayout(windowLayoutParams);
        updateSurfacePosition();
    }
    }

    @NonNull
    protected TaskInfo getLastTaskInfo() {
+0 −57
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.wm.shell.compatui;
import static android.content.res.Configuration.UI_MODE_NIGHT_YES;

import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.window.flags.Flags.FLAG_APP_COMPAT_ASYNC_RELAYOUT;
import static com.android.window.flags.Flags.FLAG_APP_COMPAT_UI_FRAMEWORK;
import static com.android.wm.shell.compatui.CompatUIStatusManager.COMPAT_UI_EDUCATION_HIDDEN;
import static com.android.wm.shell.compatui.CompatUIStatusManager.COMPAT_UI_EDUCATION_VISIBLE;
@@ -43,7 +42,6 @@ import android.app.ActivityManager;
import android.app.TaskInfo;
import android.graphics.Insets;
import android.graphics.Rect;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.annotations.RequiresFlagsDisabled;
import android.testing.AndroidTestingRunner;
@@ -312,7 +310,6 @@ public class LetterboxEduWindowManagerTest extends ShellTestCase {

    @Test
    @RequiresFlagsDisabled(FLAG_APP_COMPAT_UI_FRAMEWORK)
    @DisableFlags(FLAG_APP_COMPAT_ASYNC_RELAYOUT)
    public void testUpdateCompatInfo_updatesLayoutCorrectly() {
        LetterboxEduWindowManager windowManager = createWindowManager(/* eligible= */ true);

@@ -340,36 +337,6 @@ public class LetterboxEduWindowManagerTest extends ShellTestCase {
        assertNull(windowManager.mLayout);
    }

    @Test
    @RequiresFlagsDisabled(FLAG_APP_COMPAT_UI_FRAMEWORK)
    @EnableFlags(FLAG_APP_COMPAT_ASYNC_RELAYOUT)
    public void testUpdateCompatInfo_updatesLayoutCorrectlyAsync() {
        LetterboxEduWindowManager windowManager = createWindowManager(/* eligible= */ true);

        assertTrue(windowManager.createLayout(/* canShow= */ true));
        LetterboxEduDialogLayout layout = windowManager.mLayout;
        assertNotNull(layout);

        assertTrue(windowManager.updateCompatInfo(
                createTaskInfo(/* eligible= */ true, USER_ID_1, new Rect(50, 25, 150, 75)),
                mTaskListener, /* canShow= */ true));

        verifyLayout(layout, layout.getLayoutParams(), /* expectedWidth= */ 100,
                /* expectedHeight= */ 50, /* expectedExtraTopMargin= */ 0,
                /* expectedExtraBottomMargin= */ 0);
        verify(mViewHost).relayout(mWindowAttrsCaptor.capture(), any());
        assertThat(mWindowAttrsCaptor.getValue()).isEqualTo(layout.getLayoutParams());

        // Window manager should be released (without animation) when eligible becomes false.
        assertFalse(windowManager.updateCompatInfo(createTaskInfo(/* eligible= */ false),
                mTaskListener, /* canShow= */ true));

        verify(windowManager).release();
        verify(mOnDismissCallback, never()).accept(any());
        verify(mAnimationController, never()).startExitAnimation(any(), any());
        assertNull(windowManager.mLayout);
    }

    @Test
    @RequiresFlagsDisabled(FLAG_APP_COMPAT_UI_FRAMEWORK)
    public void testUpdateCompatInfo_notEligibleUntilUpdate_createsLayoutAfterUpdate() {
@@ -401,7 +368,6 @@ public class LetterboxEduWindowManagerTest extends ShellTestCase {

    @Test
    @RequiresFlagsDisabled(FLAG_APP_COMPAT_UI_FRAMEWORK)
    @DisableFlags(FLAG_APP_COMPAT_ASYNC_RELAYOUT)
    public void testUpdateDisplayLayout_updatesLayoutCorrectly() {
        LetterboxEduWindowManager windowManager = createWindowManager(/* eligible= */ true);

@@ -422,29 +388,6 @@ public class LetterboxEduWindowManagerTest extends ShellTestCase {
        assertThat(mWindowAttrsCaptor.getValue()).isEqualTo(layout.getLayoutParams());
    }

    @Test
    @RequiresFlagsDisabled(FLAG_APP_COMPAT_UI_FRAMEWORK)
    @EnableFlags(FLAG_APP_COMPAT_ASYNC_RELAYOUT)
    public void testUpdateDisplayLayout_updatesLayoutCorrectlyAsync() {
        LetterboxEduWindowManager windowManager = createWindowManager(/* eligible= */ true);

        assertTrue(windowManager.createLayout(/* canShow= */ true));
        LetterboxEduDialogLayout layout = windowManager.mLayout;
        assertNotNull(layout);

        int newDisplayCutoutTop = DISPLAY_CUTOUT_TOP + 7;
        int newDisplayCutoutBottom = DISPLAY_CUTOUT_BOTTOM + 9;
        windowManager.updateDisplayLayout(createDisplayLayout(
                Insets.of(DISPLAY_CUTOUT_HORIZONTAL, newDisplayCutoutTop,
                        DISPLAY_CUTOUT_HORIZONTAL, newDisplayCutoutBottom)));

        verifyLayout(layout, layout.getLayoutParams(), /* expectedWidth= */ TASK_WIDTH,
                /* expectedHeight= */ TASK_HEIGHT, /* expectedExtraTopMargin= */
                newDisplayCutoutTop, /* expectedExtraBottomMargin= */ newDisplayCutoutBottom);
        verify(mViewHost).relayout(mWindowAttrsCaptor.capture(), any());
        assertThat(mWindowAttrsCaptor.getValue()).isEqualTo(layout.getLayoutParams());
    }

    @Test
    @RequiresFlagsDisabled(FLAG_APP_COMPAT_UI_FRAMEWORK)
    public void testRelease_animationIsCancelled() {