Disable landscape aspect-scaled behavior for TV.

Bug: 27923205
Change-Id: Ibe45ba62a9de9c03480844235efc97e8b8299e61
This commit is contained in:
Winson
2016-04-05 17:32:30 -07:00
parent fef8cfc3f0
commit b20247636b
3 changed files with 16 additions and 9 deletions

View File

@@ -881,7 +881,7 @@ public class AppTransition implements Dump {
* when a thumbnail is specified with the pending animation override.
*/
Animation createThumbnailAspectScaleAnimationLocked(Rect appRect, @Nullable Rect contentInsets,
Bitmap thumbnailHeader, final int taskId, int orientation) {
Bitmap thumbnailHeader, final int taskId, int uiMode, int orientation) {
Animation a;
final int thumbWidthI = thumbnailHeader.getWidth();
final float thumbWidth = thumbWidthI > 0 ? thumbWidthI : 1;
@@ -896,7 +896,7 @@ public class AppTransition implements Dump {
final float toY;
final float pivotX;
final float pivotY;
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
if (isTvUiMode(uiMode) || orientation == Configuration.ORIENTATION_PORTRAIT) {
fromX = mTmpRect.left;
fromY = mTmpRect.top;
@@ -1028,7 +1028,7 @@ public class AppTransition implements Dump {
* activity that is leaving, and the activity that is entering.
*/
Animation createAspectScaledThumbnailEnterExitAnimationLocked(int thumbTransitState,
int orientation, int transit, Rect containingFrame, Rect contentInsets,
int uiMode, int orientation, int transit, Rect containingFrame, Rect contentInsets,
@Nullable Rect surfaceInsets, boolean freeform, int taskId) {
Animation a;
final int appWidth = containingFrame.width();
@@ -1067,8 +1067,7 @@ public class AppTransition implements Dump {
mTmpFromClipRect.inset(contentInsets);
mNextAppTransitionInsets.set(contentInsets);
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
// We scale the width and clip to the top/left square
if (isTvUiMode(uiMode) || orientation == Configuration.ORIENTATION_PORTRAIT) {
// We scale the width and clip to the top/left square
float scale = thumbWidth /
(appWidth - contentInsets.left - contentInsets.right);
@@ -1401,7 +1400,7 @@ public class AppTransition implements Dump {
* to the recents thumbnail and hence need to account for the surface being
* bigger.
*/
Animation loadAnimation(WindowManager.LayoutParams lp, int transit, boolean enter,
Animation loadAnimation(WindowManager.LayoutParams lp, int transit, boolean enter, int uiMode,
int orientation, Rect frame, Rect displayFrame, Rect insets,
@Nullable Rect surfaceInsets, boolean isVoiceInteraction, boolean freeform,
int taskId) {
@@ -1481,7 +1480,7 @@ public class AppTransition implements Dump {
mNextAppTransitionScaleUp =
(mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP);
a = createAspectScaledThumbnailEnterExitAnimationLocked(
getThumbnailTransitionState(enter), orientation, transit, frame,
getThumbnailTransitionState(enter), uiMode, orientation, transit, frame,
insets, surfaceInsets, freeform, taskId);
if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) {
String animName = mNextAppTransitionScaleUp ?
@@ -1922,4 +1921,11 @@ public class AppTransition implements Dump {
}
return prepared;
}
/**
* @return whether the specified {@param uiMode} is the TV mode.
*/
private boolean isTvUiMode(int uiMode) {
return (uiMode & Configuration.UI_MODE_TYPE_TELEVISION) > 0;
}
}

View File

@@ -3058,7 +3058,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_APP_TRANSITIONS) Slog.d(TAG_WM, "Loading animation for app transition."
+ " transit=" + AppTransition.appTransitionToString(transit) + " enter=" + enter
+ " frame=" + frame + " insets=" + insets + " surfaceInsets=" + surfaceInsets);
Animation a = mAppTransition.loadAnimation(lp, transit, enter,
Animation a = mAppTransition.loadAnimation(lp, transit, enter, mCurConfiguration.uiMode,
mCurConfiguration.orientation, frame, displayFrame, insets, surfaceInsets,
isVoiceInteraction, freeform, atoken.mTask.mTaskId);
if (a != null) {

View File

@@ -1582,7 +1582,8 @@ class WindowSurfacePlacer {
// synchronize its thumbnail surface with the surface for the
// open/close animation (only on the way down)
anim = mService.mAppTransition.createThumbnailAspectScaleAnimationLocked(appRect,
insets, thumbnailHeader, taskId, mService.mCurConfiguration.orientation);
insets, thumbnailHeader, taskId, mService.mCurConfiguration.uiMode,
mService.mCurConfiguration.orientation);
openingAppAnimator.thumbnailForceAboveLayer = Math.max(openingLayer, closingLayer);
openingAppAnimator.deferThumbnailDestruction =
!mService.mAppTransition.isNextThumbnailTransitionScaleUp();