Merge "Separate fillsParent from deciding orientation" into tm-dev am: c416376c38

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18671708

Change-Id: Ia3d9243d1befbab2ebe4111fb2fde14ff2227b87
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Riddle Hsu
2022-06-02 14:10:38 +00:00
committed by Automerger Merge Worker
4 changed files with 20 additions and 12 deletions

View File

@@ -670,9 +670,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
* from the style of activity. Because we don't want {@link WindowContainer#getOrientation()} * from the style of activity. Because we don't want {@link WindowContainer#getOrientation()}
* to be affected by the temporal state of {@link ActivityClientController#convertToTranslucent} * to be affected by the temporal state of {@link ActivityClientController#convertToTranslucent}
* when running ANIM_SCENE_TRANSITION. * when running ANIM_SCENE_TRANSITION.
* @see WindowContainer#fillsParent() * @see WindowContainer#providesOrientation()
*/ */
private final boolean mFillsParent; private final boolean mStyleFillsParent;
// The input dispatching timeout for this application token in milliseconds. // The input dispatching timeout for this application token in milliseconds.
long mInputDispatchingTimeoutMillis = DEFAULT_DISPATCHING_TIMEOUT_MILLIS; long mInputDispatchingTimeoutMillis = DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
@@ -1971,10 +1971,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// This style is propagated to the main window attributes with // This style is propagated to the main window attributes with
// FLAG_SHOW_WALLPAPER from PhoneWindow#generateLayout. // FLAG_SHOW_WALLPAPER from PhoneWindow#generateLayout.
|| ent.array.getBoolean(R.styleable.Window_windowShowWallpaper, false); || ent.array.getBoolean(R.styleable.Window_windowShowWallpaper, false);
mFillsParent = mOccludesParent; mStyleFillsParent = mOccludesParent;
noDisplay = ent.array.getBoolean(R.styleable.Window_windowNoDisplay, false); noDisplay = ent.array.getBoolean(R.styleable.Window_windowNoDisplay, false);
} else { } else {
mFillsParent = mOccludesParent = true; mStyleFillsParent = mOccludesParent = true;
noDisplay = false; noDisplay = false;
} }
@@ -2879,9 +2879,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
return (TaskDisplayArea) super.getDisplayArea(); return (TaskDisplayArea) super.getDisplayArea();
} }
@Override
boolean providesOrientation() {
return mStyleFillsParent;
}
@Override @Override
boolean fillsParent() { boolean fillsParent() {
return mFillsParent; return occludesParent(true /* includingFinishing */);
} }
/** Returns true if this activity is not finishing, is opaque and fills the entire space of /** Returns true if this activity is not finishing, is opaque and fills the entire space of

View File

@@ -172,7 +172,7 @@ class PinnedTaskController {
*/ */
void deferOrientationChangeForEnteringPipFromFullScreenIfNeeded() { void deferOrientationChangeForEnteringPipFromFullScreenIfNeeded() {
final ActivityRecord topFullscreen = mDisplayContent.getActivity( final ActivityRecord topFullscreen = mDisplayContent.getActivity(
a -> a.fillsParent() && !a.getTask().inMultiWindowMode()); a -> a.providesOrientation() && !a.getTask().inMultiWindowMode());
if (topFullscreen == null || topFullscreen.hasFixedRotationTransform()) { if (topFullscreen == null || topFullscreen.hasFixedRotationTransform()) {
return; return;
} }

View File

@@ -1495,8 +1495,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
*/ */
int getOrientation(int candidate) { int getOrientation(int candidate) {
mLastOrientationSource = null; mLastOrientationSource = null;
if (!fillsParent()) { if (!providesOrientation()) {
// Ignore containers that don't completely fill their parents.
return SCREEN_ORIENTATION_UNSET; return SCREEN_ORIENTATION_UNSET;
} }
@@ -1530,8 +1529,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
continue; continue;
} }
if (wc.fillsParent() || orientation != SCREEN_ORIENTATION_UNSPECIFIED) { if (wc.providesOrientation() || orientation != SCREEN_ORIENTATION_UNSPECIFIED) {
// Use the orientation if the container fills its parent or requested an explicit // Use the orientation if the container can provide or requested an explicit
// orientation that isn't SCREEN_ORIENTATION_UNSPECIFIED. // orientation that isn't SCREEN_ORIENTATION_UNSPECIFIED.
ProtoLog.v(WM_DEBUG_ORIENTATION, "%s is requesting orientation %d (%s)", ProtoLog.v(WM_DEBUG_ORIENTATION, "%s is requesting orientation %d (%s)",
wc.toString(), orientation, wc.toString(), orientation,
@@ -1560,6 +1559,10 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
return source; return source;
} }
boolean providesOrientation() {
return fillsParent();
}
/** /**
* Returns true if this container is opaque and fills all the space made available by its parent * Returns true if this container is opaque and fills all the space made available by its parent
* container. * container.

View File

@@ -756,8 +756,8 @@ public class ActivityRecordTests extends WindowTestsBase {
final ActivityRecord activity = createActivityWithTask(); final ActivityRecord activity = createActivityWithTask();
ActivityRecord topActivity = new ActivityBuilder(mAtm).setTask(activity.getTask()).build(); ActivityRecord topActivity = new ActivityBuilder(mAtm).setTask(activity.getTask()).build();
topActivity.setOccludesParent(false); topActivity.setOccludesParent(false);
// The requested occluding state doesn't affect whether it fills parent. // The requested occluding state doesn't affect whether it can decide orientation.
assertTrue(topActivity.fillsParent()); assertTrue(topActivity.providesOrientation());
activity.setState(STOPPED, "Testing"); activity.setState(STOPPED, "Testing");
activity.setVisibility(true); activity.setVisibility(true);
activity.makeActiveIfNeeded(null /* activeActivity */); activity.makeActiveIfNeeded(null /* activeActivity */);