Merge "Notify client to clear intermediate rotated adjustments" into sc-dev
This commit is contained in:
@@ -1572,12 +1572,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
}
|
}
|
||||||
final int rotation = rotationForActivityInDifferentOrientation(r);
|
final int rotation = rotationForActivityInDifferentOrientation(r);
|
||||||
if (rotation == ROTATION_UNDEFINED) {
|
if (rotation == ROTATION_UNDEFINED) {
|
||||||
// The display rotation won't be changed by current top activity. If there was fixed
|
// The display rotation won't be changed by current top activity. The client side
|
||||||
// rotation activity, its rotated state should be cleared to cancel the adjustments.
|
// adjustments of previous rotated activity should be cleared earlier. Otherwise if
|
||||||
if (hasTopFixedRotationLaunchingApp()
|
// the current top is in the same process, it may get the rotated state. The transform
|
||||||
// Avoid breaking recents animation.
|
// will be cleared later with transition callback to ensure smooth animation.
|
||||||
&& !mFixedRotationLaunchingApp.getTask().isAnimatingByRecents()) {
|
if (hasTopFixedRotationLaunchingApp()) {
|
||||||
clearFixedRotationLaunchingApp();
|
mFixedRotationLaunchingApp.notifyFixedRotationTransform(false /* enabled */);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ class WindowToken extends WindowContainer<WindowState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Notifies application side to enable or disable the rotation adjustment of display info. */
|
/** Notifies application side to enable or disable the rotation adjustment of display info. */
|
||||||
private void notifyFixedRotationTransform(boolean enabled) {
|
void notifyFixedRotationTransform(boolean enabled) {
|
||||||
FixedRotationAdjustments adjustments = null;
|
FixedRotationAdjustments adjustments = null;
|
||||||
// A token may contain windows of the same processes or different processes. The list is
|
// A token may contain windows of the same processes or different processes. The list is
|
||||||
// used to avoid sending the same adjustments to a process multiple times.
|
// used to avoid sending the same adjustments to a process multiple times.
|
||||||
|
|||||||
@@ -1489,7 +1489,7 @@ public class DisplayContentTests extends WindowTestsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClearIntermediateFixedRotation() throws RemoteException {
|
public void testClearIntermediateFixedRotationAdjustments() throws RemoteException {
|
||||||
final ActivityRecord activity = new ActivityBuilder(mAtm).setCreateTask(true).build();
|
final ActivityRecord activity = new ActivityBuilder(mAtm).setCreateTask(true).build();
|
||||||
mDisplayContent.setFixedRotationLaunchingApp(activity,
|
mDisplayContent.setFixedRotationLaunchingApp(activity,
|
||||||
(mDisplayContent.getRotation() + 1) % 4);
|
(mDisplayContent.getRotation() + 1) % 4);
|
||||||
@@ -1508,7 +1508,8 @@ public class DisplayContentTests extends WindowTestsBase {
|
|||||||
ArgumentCaptor.forClass(FixedRotationAdjustmentsItem.class);
|
ArgumentCaptor.forClass(FixedRotationAdjustmentsItem.class);
|
||||||
verify(mAtm.getLifecycleManager(), atLeastOnce()).scheduleTransaction(
|
verify(mAtm.getLifecycleManager(), atLeastOnce()).scheduleTransaction(
|
||||||
eq(activity.app.getThread()), adjustmentsCaptor.capture());
|
eq(activity.app.getThread()), adjustmentsCaptor.capture());
|
||||||
assertFalse(activity.hasFixedRotationTransform());
|
// The transformation is kept for animation in real case.
|
||||||
|
assertTrue(activity.hasFixedRotationTransform());
|
||||||
final FixedRotationAdjustmentsItem clearAdjustments = FixedRotationAdjustmentsItem.obtain(
|
final FixedRotationAdjustmentsItem clearAdjustments = FixedRotationAdjustmentsItem.obtain(
|
||||||
activity.token, null /* fixedRotationAdjustments */);
|
activity.token, null /* fixedRotationAdjustments */);
|
||||||
// The captor may match other items. The first one must be the item to clear adjustments.
|
// The captor may match other items. The first one must be the item to clear adjustments.
|
||||||
|
|||||||
Reference in New Issue
Block a user