Merge "Don't check height if activity bounds empty" into tm-qpr-dev am: f2d3b4a55f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22162527 Change-Id: I9737517a14ea60446c11b952547bf4b13c9fd428 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -8388,6 +8388,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull Rect getScreenResolvedBounds() {
|
||||||
|
final Configuration resolvedConfig = getResolvedOverrideConfiguration();
|
||||||
|
final Rect resolvedBounds = resolvedConfig.windowConfiguration.getBounds();
|
||||||
|
return mSizeCompatBounds != null ? mSizeCompatBounds : resolvedBounds;
|
||||||
|
}
|
||||||
|
|
||||||
void recomputeConfiguration() {
|
void recomputeConfiguration() {
|
||||||
// We check if the current activity is transparent. In that case we need to
|
// We check if the current activity is transparent. In that case we need to
|
||||||
// recomputeConfiguration of the first opaque activity beneath, to allow a
|
// recomputeConfiguration of the first opaque activity beneath, to allow a
|
||||||
|
|||||||
@@ -977,6 +977,8 @@ final class LetterboxUiController {
|
|||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
private boolean isHorizontalReachabilityEnabled(Configuration parentConfiguration) {
|
private boolean isHorizontalReachabilityEnabled(Configuration parentConfiguration) {
|
||||||
|
// Use screen resolved bounds which uses resolved bounds or size compat bounds
|
||||||
|
// as activity bounds can sometimes be empty
|
||||||
return mLetterboxConfiguration.getIsHorizontalReachabilityEnabled()
|
return mLetterboxConfiguration.getIsHorizontalReachabilityEnabled()
|
||||||
&& parentConfiguration.windowConfiguration.getWindowingMode()
|
&& parentConfiguration.windowConfiguration.getWindowingMode()
|
||||||
== WINDOWING_MODE_FULLSCREEN
|
== WINDOWING_MODE_FULLSCREEN
|
||||||
@@ -984,7 +986,7 @@ final class LetterboxUiController {
|
|||||||
&& mActivityRecord.getOrientationForReachability() == ORIENTATION_PORTRAIT)
|
&& mActivityRecord.getOrientationForReachability() == ORIENTATION_PORTRAIT)
|
||||||
// Check whether the activity fills the parent vertically.
|
// Check whether the activity fills the parent vertically.
|
||||||
&& parentConfiguration.windowConfiguration.getAppBounds().height()
|
&& parentConfiguration.windowConfiguration.getAppBounds().height()
|
||||||
<= mActivityRecord.getBounds().height();
|
<= mActivityRecord.getScreenResolvedBounds().height();
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -1004,6 +1006,8 @@ final class LetterboxUiController {
|
|||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
private boolean isVerticalReachabilityEnabled(Configuration parentConfiguration) {
|
private boolean isVerticalReachabilityEnabled(Configuration parentConfiguration) {
|
||||||
|
// Use screen resolved bounds which uses resolved bounds or size compat bounds
|
||||||
|
// as activity bounds can sometimes be empty
|
||||||
return mLetterboxConfiguration.getIsVerticalReachabilityEnabled()
|
return mLetterboxConfiguration.getIsVerticalReachabilityEnabled()
|
||||||
&& parentConfiguration.windowConfiguration.getWindowingMode()
|
&& parentConfiguration.windowConfiguration.getWindowingMode()
|
||||||
== WINDOWING_MODE_FULLSCREEN
|
== WINDOWING_MODE_FULLSCREEN
|
||||||
@@ -1011,7 +1015,7 @@ final class LetterboxUiController {
|
|||||||
&& mActivityRecord.getOrientationForReachability() == ORIENTATION_LANDSCAPE)
|
&& mActivityRecord.getOrientationForReachability() == ORIENTATION_LANDSCAPE)
|
||||||
// Check whether the activity fills the parent horizontally.
|
// Check whether the activity fills the parent horizontally.
|
||||||
&& parentConfiguration.windowConfiguration.getBounds().width()
|
&& parentConfiguration.windowConfiguration.getBounds().width()
|
||||||
== mActivityRecord.getBounds().width();
|
== mActivityRecord.getScreenResolvedBounds().width();
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|||||||
@@ -3077,11 +3077,43 @@ public class SizeCompatTests extends WindowTestsBase {
|
|||||||
assertTrue(mActivity.inSizeCompatMode());
|
assertTrue(mActivity.inSizeCompatMode());
|
||||||
|
|
||||||
// Vertical reachability is disabled because the app does not match parent width
|
// Vertical reachability is disabled because the app does not match parent width
|
||||||
assertNotEquals(mActivity.getBounds().width(), mActivity.mDisplayContent.getBounds()
|
assertNotEquals(mActivity.getScreenResolvedBounds().width(),
|
||||||
.width());
|
mActivity.mDisplayContent.getBounds().width());
|
||||||
assertFalse(mActivity.mLetterboxUiController.isVerticalReachabilityEnabled());
|
assertFalse(mActivity.mLetterboxUiController.isVerticalReachabilityEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsVerticalReachabilityEnabled_emptyBounds_true() {
|
||||||
|
setUpDisplaySizeWithApp(/* dw */ 1000, /* dh */ 2800);
|
||||||
|
mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
|
||||||
|
mWm.mLetterboxConfiguration.setIsVerticalReachabilityEnabled(true);
|
||||||
|
|
||||||
|
prepareUnresizable(mActivity, SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
|
||||||
|
// Set up activity with empty bounds to mock loading of app
|
||||||
|
mActivity.getWindowConfiguration().setBounds(null);
|
||||||
|
assertEquals(new Rect(0, 0, 0, 0), mActivity.getBounds());
|
||||||
|
|
||||||
|
// Vertical reachability is still enabled as resolved bounds is not empty
|
||||||
|
assertTrue(mActivity.mLetterboxUiController.isVerticalReachabilityEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsHorizontalReachabilityEnabled_emptyBounds_true() {
|
||||||
|
setUpDisplaySizeWithApp(/* dw */ 2800, /* dh */ 1000);
|
||||||
|
mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
|
||||||
|
mWm.mLetterboxConfiguration.setIsHorizontalReachabilityEnabled(true);
|
||||||
|
|
||||||
|
prepareUnresizable(mActivity, SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
|
||||||
|
// Set up activity with empty bounds to mock loading of app
|
||||||
|
mActivity.getWindowConfiguration().setBounds(null);
|
||||||
|
assertEquals(new Rect(0, 0, 0, 0), mActivity.getBounds());
|
||||||
|
|
||||||
|
// Horizontal reachability is still enabled as resolved bounds is not empty
|
||||||
|
assertTrue(mActivity.mLetterboxUiController.isHorizontalReachabilityEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsHorizontalReachabilityEnabled_doesNotMatchParentHeight_false() {
|
public void testIsHorizontalReachabilityEnabled_doesNotMatchParentHeight_false() {
|
||||||
setUpDisplaySizeWithApp(2800, 1000);
|
setUpDisplaySizeWithApp(2800, 1000);
|
||||||
@@ -3098,8 +3130,8 @@ public class SizeCompatTests extends WindowTestsBase {
|
|||||||
assertTrue(mActivity.inSizeCompatMode());
|
assertTrue(mActivity.inSizeCompatMode());
|
||||||
|
|
||||||
// Horizontal reachability is disabled because the app does not match parent height
|
// Horizontal reachability is disabled because the app does not match parent height
|
||||||
assertNotEquals(mActivity.getBounds().height(), mActivity.mDisplayContent.getBounds()
|
assertNotEquals(mActivity.getScreenResolvedBounds().height(),
|
||||||
.height());
|
mActivity.mDisplayContent.getBounds().height());
|
||||||
assertFalse(mActivity.mLetterboxUiController.isHorizontalReachabilityEnabled());
|
assertFalse(mActivity.mLetterboxUiController.isHorizontalReachabilityEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3119,8 +3151,8 @@ public class SizeCompatTests extends WindowTestsBase {
|
|||||||
assertTrue(mActivity.inSizeCompatMode());
|
assertTrue(mActivity.inSizeCompatMode());
|
||||||
|
|
||||||
// Horizontal reachability is enabled because the app matches parent height
|
// Horizontal reachability is enabled because the app matches parent height
|
||||||
assertEquals(mActivity.getBounds().height(), mActivity.mDisplayContent.getBounds()
|
assertEquals(mActivity.getScreenResolvedBounds().height(),
|
||||||
.height());
|
mActivity.mDisplayContent.getBounds().height());
|
||||||
assertTrue(mActivity.mLetterboxUiController.isHorizontalReachabilityEnabled());
|
assertTrue(mActivity.mLetterboxUiController.isHorizontalReachabilityEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3140,7 +3172,8 @@ public class SizeCompatTests extends WindowTestsBase {
|
|||||||
assertTrue(mActivity.inSizeCompatMode());
|
assertTrue(mActivity.inSizeCompatMode());
|
||||||
|
|
||||||
// Vertical reachability is enabled because the app matches parent width
|
// Vertical reachability is enabled because the app matches parent width
|
||||||
assertEquals(mActivity.getBounds().width(), mActivity.mDisplayContent.getBounds().width());
|
assertEquals(mActivity.getScreenResolvedBounds().width(),
|
||||||
|
mActivity.mDisplayContent.getBounds().width());
|
||||||
assertTrue(mActivity.mLetterboxUiController.isVerticalReachabilityEnabled());
|
assertTrue(mActivity.mLetterboxUiController.isVerticalReachabilityEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user