Merge "Avoid intermediate orientation change" into sc-dev
This commit is contained in:
@@ -2258,7 +2258,6 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
mTmpPrevBounds.set(getBounds());
|
mTmpPrevBounds.set(getBounds());
|
||||||
final boolean wasInMultiWindowMode = inMultiWindowMode();
|
final boolean wasInMultiWindowMode = inMultiWindowMode();
|
||||||
final boolean wasInPictureInPicture = inPinnedWindowingMode();
|
final boolean wasInPictureInPicture = inPinnedWindowingMode();
|
||||||
final int oldOrientation = getOrientation();
|
|
||||||
super.onConfigurationChanged(newParentConfig);
|
super.onConfigurationChanged(newParentConfig);
|
||||||
// Only need to update surface size here since the super method will handle updating
|
// Only need to update surface size here since the super method will handle updating
|
||||||
// surface position.
|
// surface position.
|
||||||
@@ -2301,11 +2300,6 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
mForceNotOrganized = false;
|
mForceNotOrganized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Report orientation change such as changing from freeform to fullscreen.
|
|
||||||
if (oldOrientation != getOrientation()) {
|
|
||||||
onDescendantOrientationChanged(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
saveLaunchingStateIfNeeded();
|
saveLaunchingStateIfNeeded();
|
||||||
final boolean taskOrgChanged = updateTaskOrganizerState(false /* forceUpdate */);
|
final boolean taskOrgChanged = updateTaskOrganizerState(false /* forceUpdate */);
|
||||||
if (taskOrgChanged) {
|
if (taskOrgChanged) {
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ import static org.mockito.ArgumentMatchers.eq;
|
|||||||
import static org.mockito.ArgumentMatchers.same;
|
import static org.mockito.ArgumentMatchers.same;
|
||||||
import static org.mockito.Mockito.clearInvocations;
|
import static org.mockito.Mockito.clearInvocations;
|
||||||
import static org.mockito.Mockito.never;
|
import static org.mockito.Mockito.never;
|
||||||
import static org.mockito.Mockito.reset;
|
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.TaskInfo;
|
import android.app.TaskInfo;
|
||||||
@@ -1323,20 +1322,22 @@ public class TaskTests extends WindowTestsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNotifyOrientationChangeCausedByConfigurationChange() {
|
public void testTaskOrientationOnDisplayWindowingModeChange() {
|
||||||
|
// Skip unnecessary operations to speed up the test.
|
||||||
|
mAtm.deferWindowLayout();
|
||||||
final Task task = getTestTask();
|
final Task task = getTestTask();
|
||||||
final ActivityRecord activity = task.getTopMostActivity();
|
final ActivityRecord activity = task.getTopMostActivity();
|
||||||
final DisplayContent display = task.getDisplayContent();
|
final DisplayContent display = task.getDisplayContent();
|
||||||
display.setWindowingMode(WINDOWING_MODE_FREEFORM);
|
mWm.setWindowingMode(display.mDisplayId, WINDOWING_MODE_FREEFORM);
|
||||||
|
|
||||||
activity.setRequestedOrientation(SCREEN_ORIENTATION_LANDSCAPE);
|
activity.setRequestedOrientation(SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
assertEquals(SCREEN_ORIENTATION_UNSET, task.getOrientation());
|
assertEquals(SCREEN_ORIENTATION_UNSET, task.getOrientation());
|
||||||
verify(display).onDescendantOrientationChanged(same(task));
|
assertEquals(SCREEN_ORIENTATION_UNSPECIFIED, display.getLastOrientation());
|
||||||
reset(display);
|
|
||||||
|
|
||||||
display.setWindowingMode(WINDOWING_MODE_FULLSCREEN);
|
mWm.setWindowingMode(display.mDisplayId, WINDOWING_MODE_FULLSCREEN);
|
||||||
assertEquals(SCREEN_ORIENTATION_LANDSCAPE, task.getOrientation());
|
assertEquals(SCREEN_ORIENTATION_LANDSCAPE, task.getOrientation());
|
||||||
verify(display).onDescendantOrientationChanged(same(task));
|
assertEquals(SCREEN_ORIENTATION_LANDSCAPE, display.getLastOrientation());
|
||||||
|
assertEquals(Configuration.ORIENTATION_LANDSCAPE, display.getConfiguration().orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user