Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2024763 authored by Winson's avatar Winson
Browse files

Disable landscape aspect-scaled behavior for TV.

Bug: 27923205
Change-Id: Ibe45ba62a9de9c03480844235efc97e8b8299e61
parent fef8cfc3
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -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;
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+2 −1
Original line number Diff line number Diff line
@@ -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();