Merge "Apply rotation animation when canceling fixed rotation" into sc-dev
This commit is contained in:
@@ -6619,9 +6619,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void onCancelFixedRotationTransform(int originalDisplayRotation) {
|
void onCancelFixedRotationTransform(int originalDisplayRotation) {
|
||||||
if (this != mDisplayContent.getLastOrientationSource()
|
if (this != mDisplayContent.getLastOrientationSource()) {
|
||||||
|| getRequestedConfigurationOrientation() != ORIENTATION_UNDEFINED) {
|
// This activity doesn't affect display rotation.
|
||||||
// Only need to handle the activity that should be rotated with display.
|
return;
|
||||||
|
}
|
||||||
|
final int requestedOrientation = getRequestedConfigurationOrientation();
|
||||||
|
if (requestedOrientation != ORIENTATION_UNDEFINED
|
||||||
|
&& requestedOrientation != mDisplayContent.getConfiguration().orientation) {
|
||||||
|
// Only need to handle the activity that can be rotated with display or the activity
|
||||||
|
// has requested the same orientation.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1723,6 +1723,15 @@ public class ActivityRecordTests extends WindowTestsBase {
|
|||||||
|
|
||||||
assertFalse(display.hasTopFixedRotationLaunchingApp());
|
assertFalse(display.hasTopFixedRotationLaunchingApp());
|
||||||
assertFalse(activity.hasFixedRotationTransform());
|
assertFalse(activity.hasFixedRotationTransform());
|
||||||
|
|
||||||
|
// Simulate that the activity requests the same orientation as display.
|
||||||
|
activity.setOrientation(display.getConfiguration().orientation);
|
||||||
|
// Skip the real freezing.
|
||||||
|
activity.mVisibleRequested = false;
|
||||||
|
clearInvocations(activity);
|
||||||
|
activity.onCancelFixedRotationTransform(originalRotation);
|
||||||
|
// The implementation of cancellation must be executed.
|
||||||
|
verify(activity).startFreezingScreen(originalRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user