Merge "Fix letterbox for SCREEN_ORIENTATION_BEHIND" into tm-qpr-dev am: d119d25429
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19754855 Change-Id: I486ceb56d05c149f4123acb52c43112beec7ab02 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -7638,6 +7638,31 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
ensureActivityConfiguration(0 /* globalChanges */, false /* preserveWindow */);
|
ensureActivityConfiguration(0 /* globalChanges */, false /* preserveWindow */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the requested {@link Configuration.Orientation} for the current activity.
|
||||||
|
*
|
||||||
|
* <p>When The current orientation is set to {@link SCREEN_ORIENTATION_BEHIND} it returns the
|
||||||
|
* requested orientation for the activity below which is the first activity with an explicit
|
||||||
|
* (different from {@link SCREEN_ORIENTATION_UNSET}) orientation which is not {@link
|
||||||
|
* SCREEN_ORIENTATION_BEHIND}.
|
||||||
|
*/
|
||||||
|
@Configuration.Orientation
|
||||||
|
@Override
|
||||||
|
int getRequestedConfigurationOrientation(boolean forDisplay) {
|
||||||
|
if (mOrientation == SCREEN_ORIENTATION_BEHIND && task != null) {
|
||||||
|
// We use Task here because we want to be consistent with what happens in
|
||||||
|
// multi-window mode where other tasks orientations are ignored.
|
||||||
|
final ActivityRecord belowCandidate = task.getActivity(
|
||||||
|
a -> a.mOrientation != SCREEN_ORIENTATION_UNSET && !a.finishing
|
||||||
|
&& a.mOrientation != ActivityInfo.SCREEN_ORIENTATION_BEHIND, this,
|
||||||
|
false /* includeBoundary */, true /* traverseTopToBottom */);
|
||||||
|
if (belowCandidate != null) {
|
||||||
|
return belowCandidate.getRequestedConfigurationOrientation(forDisplay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.getRequestedConfigurationOrientation(forDisplay);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void onCancelFixedRotationTransform(int originalDisplayRotation) {
|
void onCancelFixedRotationTransform(int originalDisplayRotation) {
|
||||||
if (this != mDisplayContent.getLastOrientationSource()) {
|
if (this != mDisplayContent.getLastOrientationSource()) {
|
||||||
|
|||||||
@@ -2319,6 +2319,22 @@ public class ActivityRecordTests extends WindowTestsBase {
|
|||||||
assertTrue(activity1.getTask().getTaskInfo().launchCookies.contains(launchCookie));
|
assertTrue(activity1.getTask().getTaskInfo().launchCookies.contains(launchCookie));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOrientationForScreenOrientationBehind() {
|
||||||
|
final Task task = createTask(mDisplayContent);
|
||||||
|
// Activity below
|
||||||
|
new ActivityBuilder(mAtm)
|
||||||
|
.setTask(task)
|
||||||
|
.setScreenOrientation(SCREEN_ORIENTATION_PORTRAIT)
|
||||||
|
.build();
|
||||||
|
final ActivityRecord activityTop = new ActivityBuilder(mAtm)
|
||||||
|
.setTask(task)
|
||||||
|
.setScreenOrientation(SCREEN_ORIENTATION_BEHIND)
|
||||||
|
.build();
|
||||||
|
final int topOrientation = activityTop.getRequestedConfigurationOrientation();
|
||||||
|
assertEquals(SCREEN_ORIENTATION_PORTRAIT, topOrientation);
|
||||||
|
}
|
||||||
|
|
||||||
private void verifyProcessInfoUpdate(ActivityRecord activity, State state,
|
private void verifyProcessInfoUpdate(ActivityRecord activity, State state,
|
||||||
boolean shouldUpdate, boolean activityChange) {
|
boolean shouldUpdate, boolean activityChange) {
|
||||||
reset(activity.app);
|
reset(activity.app);
|
||||||
|
|||||||
Reference in New Issue
Block a user