summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2022-04-28 07:30:17 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-04-28 07:30:17 +0000
commiteae14ca2674d029b40fc397a6f7a9fe454c7dee5 (patch)
treee79475c0964ac089d49167e628817449117baae8
parent150cf0e72a856bbc5daf8c7be2ab8b6a249af0fb (diff)
parenta930e1ee540696e65fb73ab06e2708bdb88f930e (diff)
Merge "Do not affect WindowContainer#getOrientation by animation" into tm-dev
-rw-r--r--services/core/java/com/android/server/wm/ActivityRecord.java15
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java4
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java13
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java4
4 files changed, 18 insertions, 18 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index b6a1784839de..b2f9b52cad8d 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -661,10 +661,19 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
/**
* The activity is opaque and fills the entire space of this task.
- * @see WindowContainer#fillsParent()
+ * @see #occludesParent()
*/
private boolean mOccludesParent;
+ /**
+ * Unlike {@link #mOccludesParent} which can be changed at runtime. This is a static attribute
+ * from the style of activity. Because we don't want {@link WindowContainer#getOrientation()}
+ * to be affected by the temporal state of {@link ActivityClientController#convertToTranslucent}
+ * when running ANIM_SCENE_TRANSITION.
+ * @see WindowContainer#fillsParent()
+ */
+ private final boolean mFillsParent;
+
// The input dispatching timeout for this application token in milliseconds.
long mInputDispatchingTimeoutMillis = DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
@@ -1956,8 +1965,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// This style is propagated to the main window attributes with
// FLAG_SHOW_WALLPAPER from PhoneWindow#generateLayout.
|| ent.array.getBoolean(R.styleable.Window_windowShowWallpaper, false);
+ mFillsParent = mOccludesParent;
noDisplay = ent.array.getBoolean(R.styleable.Window_windowNoDisplay, false);
} else {
+ mFillsParent = mOccludesParent = true;
noDisplay = false;
}
@@ -2852,7 +2863,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
@Override
boolean fillsParent() {
- return occludesParent(true /* includingFinishing */);
+ return mFillsParent;
}
/** Returns true if this activity is not finishing, is opaque and fills the entire space of
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
index d65e27d0f642..18b7a00cb43b 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
@@ -757,6 +757,8 @@ public class ActivityRecordTests extends WindowTestsBase {
final ActivityRecord activity = createActivityWithTask();
ActivityRecord topActivity = new ActivityBuilder(mAtm).setTask(activity.getTask()).build();
topActivity.setOccludesParent(false);
+ // The requested occluding state doesn't affect whether it fills parent.
+ assertTrue(topActivity.fillsParent());
activity.setState(STOPPED, "Testing");
activity.setVisibility(true);
activity.makeActiveIfNeeded(null /* activeActivity */);
@@ -1218,7 +1220,7 @@ public class ActivityRecordTests extends WindowTestsBase {
task.setPausingActivity(currentTop);
currentTop.finishing = true;
currentTop.setState(PAUSED, "test");
- currentTop.completeFinishing("completePauseLocked");
+ currentTop.completeFinishing(false /* updateVisibility */, "completePause");
// Current top becomes stopping because it is visible and the next is invisible.
assertEquals(STOPPING, currentTop.getState());
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java
index 33b70249dabe..67f02c7fab55 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java
@@ -46,7 +46,6 @@ import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.clearInvocations;
-import static org.mockito.Mockito.doCallRealMethod;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
@@ -89,14 +88,6 @@ public class AppTransitionControllerTest extends WindowTestsBase {
mAppTransitionController = new AppTransitionController(mWm, mDisplayContent);
}
- @Override
- ActivityRecord createActivityRecord(DisplayContent dc, int windowingMode, int activityType) {
- final ActivityRecord r = super.createActivityRecord(dc, windowingMode, activityType);
- // Ensure that ActivityRecord#setOccludesParent takes effect.
- doCallRealMethod().when(r).fillsParent();
- return r;
- }
-
@Test
public void testSkipOccludedActivityCloseTransition() {
final ActivityRecord behind = createActivityRecord(mDisplayContent,
@@ -135,7 +126,7 @@ public class AppTransitionControllerTest extends WindowTestsBase {
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
final ActivityRecord translucentOpening = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
- translucentOpening.setOccludesParent(false);
+ doReturn(false).when(translucentOpening).fillsParent();
translucentOpening.setVisible(false);
mDisplayContent.prepareAppTransition(TRANSIT_OPEN);
mDisplayContent.mOpeningApps.add(behind);
@@ -153,7 +144,7 @@ public class AppTransitionControllerTest extends WindowTestsBase {
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
final ActivityRecord translucentClosing = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
- translucentClosing.setOccludesParent(false);
+ doReturn(false).when(translucentClosing).fillsParent();
mDisplayContent.prepareAppTransition(TRANSIT_CLOSE);
mDisplayContent.mClosingApps.add(translucentClosing);
assertEquals(WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE,
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
index c672b9173570..7507df6eba74 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
@@ -1156,10 +1156,6 @@ class WindowTestsBase extends SystemServiceTestsBase {
spyOn(activity);
if (mTask != null) {
- // fullscreen value is normally read from resources in ctor, so for testing we need
- // to set it somewhere else since we can't mock resources.
- doReturn(true).when(activity).occludesParent();
- doReturn(true).when(activity).fillsParent();
mTask.addChild(activity);
if (mOnTop) {
// Move the task to front after activity is added.