Don't let top activity to influence the orientation

An activity shouldn't influence the orientation of the device
just because it is currently on top, since it may be in the process
of being removed or covered by something else.

Bug: 76011287
Test: ActivityManagerAppConfigurationTests
Test: AppWindowTokenTests
Change-Id: Ie0660f9c935ab95100c107fa1331ef1c10898626
This commit is contained in:
Andrii Kulian
2018-05-23 17:01:37 -07:00
parent 478923bded
commit 0918d3674f
2 changed files with 1 additions and 6 deletions

View File

@@ -1297,7 +1297,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
// going to the bottom. Allowing closing {@link AppWindowToken} to participate can lead to
// an Activity in another task being started in the wrong orientation during the transition.
if (!(sendingToBottom || mService.mClosingApps.contains(this))
&& (isVisible() || mService.mOpeningApps.contains(this) || isOnTop())) {
&& (isVisible() || mService.mOpeningApps.contains(this))) {
return mOrientation;
}

View File

@@ -202,11 +202,6 @@ public class AppWindowTokenTests extends WindowTestsBase {
assertEquals(SCREEN_ORIENTATION_UNSET, mToken.getOrientation());
// Can specify orientation if the current orientation candidate is orientation behind.
assertEquals(SCREEN_ORIENTATION_LANDSCAPE, mToken.getOrientation(SCREEN_ORIENTATION_BEHIND));
mToken.sendingToBottom = false;
mToken.setIsOnTop(true);
// Allow for mToken to provide orientation hidden if on top and not being sent to bottom.
assertEquals(SCREEN_ORIENTATION_LANDSCAPE, mToken.getOrientation());
}
@Test