Loading core/java/android/view/ImeBackAnimationController.java +3 −2 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Insets; import android.util.Log; import android.view.animation.BackGestureInterpolator; import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; import android.window.BackEvent; Loading @@ -44,7 +45,7 @@ public class ImeBackAnimationController implements OnBackAnimationCallback { private static final int POST_COMMIT_DURATION_MS = 200; private static final int POST_COMMIT_CANCEL_DURATION_MS = 50; private static final float PEEK_FRACTION = 0.1f; private static final Interpolator STANDARD_DECELERATE = new PathInterpolator(0f, 0f, 0f, 1f); private static final Interpolator BACK_GESTURE = new BackGestureInterpolator(); private static final Interpolator EMPHASIZED_DECELERATE = new PathInterpolator( 0.05f, 0.7f, 0.1f, 1f); private static final Interpolator STANDARD_ACCELERATE = new PathInterpolator(0.3f, 0f, 1f, 1f); Loading Loading @@ -140,7 +141,7 @@ public class ImeBackAnimationController implements OnBackAnimationCallback { float hiddenY = mWindowInsetsAnimationController.getHiddenStateInsets().bottom; float shownY = mWindowInsetsAnimationController.getShownStateInsets().bottom; float imeHeight = shownY - hiddenY; float interpolatedProgress = STANDARD_DECELERATE.getInterpolation(progress); float interpolatedProgress = BACK_GESTURE.getInterpolation(progress); int newY = (int) (imeHeight - interpolatedProgress * (imeHeight * PEEK_FRACTION)); mWindowInsetsAnimationController.setInsetsAndAlpha(Insets.of(0, 0, 0, newY), 1f, progress); Loading core/java/android/view/animation/BackGestureInterpolator.java 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.view.animation; /** * Decelerating interpolator with a very slight acceleration phase at the beginning. * @hide */ public class BackGestureInterpolator extends PathInterpolator { public BackGestureInterpolator() { super(0.1f, 0.1f, 0f, 1f); } } libs/WindowManager/Shell/src/com/android/wm/shell/animation/Interpolators.java +10 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.wm.shell.animation; import android.graphics.Path; import android.view.animation.BackGestureInterpolator; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import android.view.animation.PathInterpolator; Loading Loading @@ -95,6 +96,15 @@ public class Interpolators { public static final PathInterpolator DIM_INTERPOLATOR = new PathInterpolator(.23f, .87f, .52f, -0.11f); /** * Use this interpolator for animating progress values coming from the back callback to get * the predictive-back-typical decelerate motion. * * This interpolator is similar to {@link Interpolators#STANDARD_DECELERATE} but has a slight * acceleration phase at the start. */ public static final Interpolator BACK_GESTURE = new BackGestureInterpolator(); // Create the default emphasized interpolator private static PathInterpolator createEmphasizedInterpolator() { Path path = new Path(); Loading libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityBackAnimation.kt +1 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ class CrossActivityBackAnimation @Inject constructor( private val enteringStartOffset = context.resources.getDimension(R.dimen.cross_activity_back_entering_start_offset) private val gestureInterpolator = Interpolators.STANDARD_DECELERATE private val gestureInterpolator = Interpolators.BACK_GESTURE private val postCommitInterpolator = Interpolators.FAST_OUT_SLOW_IN private val verticalMoveInterpolator: Interpolator = DecelerateInterpolator() Loading libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossTaskBackAnimation.java +1 −1 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ public class CrossTaskBackAnimation extends ShellBackAnimation { private final PointF mInitialTouchPos = new PointF(); private final Interpolator mPostAnimationInterpolator = Interpolators.EMPHASIZED; private final Interpolator mProgressInterpolator = Interpolators.STANDARD_DECELERATE; private final Interpolator mProgressInterpolator = Interpolators.BACK_GESTURE; private final Interpolator mVerticalMoveInterpolator = new DecelerateInterpolator(); private final Matrix mTransformMatrix = new Matrix(); Loading Loading
core/java/android/view/ImeBackAnimationController.java +3 −2 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Insets; import android.util.Log; import android.view.animation.BackGestureInterpolator; import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; import android.window.BackEvent; Loading @@ -44,7 +45,7 @@ public class ImeBackAnimationController implements OnBackAnimationCallback { private static final int POST_COMMIT_DURATION_MS = 200; private static final int POST_COMMIT_CANCEL_DURATION_MS = 50; private static final float PEEK_FRACTION = 0.1f; private static final Interpolator STANDARD_DECELERATE = new PathInterpolator(0f, 0f, 0f, 1f); private static final Interpolator BACK_GESTURE = new BackGestureInterpolator(); private static final Interpolator EMPHASIZED_DECELERATE = new PathInterpolator( 0.05f, 0.7f, 0.1f, 1f); private static final Interpolator STANDARD_ACCELERATE = new PathInterpolator(0.3f, 0f, 1f, 1f); Loading Loading @@ -140,7 +141,7 @@ public class ImeBackAnimationController implements OnBackAnimationCallback { float hiddenY = mWindowInsetsAnimationController.getHiddenStateInsets().bottom; float shownY = mWindowInsetsAnimationController.getShownStateInsets().bottom; float imeHeight = shownY - hiddenY; float interpolatedProgress = STANDARD_DECELERATE.getInterpolation(progress); float interpolatedProgress = BACK_GESTURE.getInterpolation(progress); int newY = (int) (imeHeight - interpolatedProgress * (imeHeight * PEEK_FRACTION)); mWindowInsetsAnimationController.setInsetsAndAlpha(Insets.of(0, 0, 0, newY), 1f, progress); Loading
core/java/android/view/animation/BackGestureInterpolator.java 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.view.animation; /** * Decelerating interpolator with a very slight acceleration phase at the beginning. * @hide */ public class BackGestureInterpolator extends PathInterpolator { public BackGestureInterpolator() { super(0.1f, 0.1f, 0f, 1f); } }
libs/WindowManager/Shell/src/com/android/wm/shell/animation/Interpolators.java +10 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.wm.shell.animation; import android.graphics.Path; import android.view.animation.BackGestureInterpolator; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import android.view.animation.PathInterpolator; Loading Loading @@ -95,6 +96,15 @@ public class Interpolators { public static final PathInterpolator DIM_INTERPOLATOR = new PathInterpolator(.23f, .87f, .52f, -0.11f); /** * Use this interpolator for animating progress values coming from the back callback to get * the predictive-back-typical decelerate motion. * * This interpolator is similar to {@link Interpolators#STANDARD_DECELERATE} but has a slight * acceleration phase at the start. */ public static final Interpolator BACK_GESTURE = new BackGestureInterpolator(); // Create the default emphasized interpolator private static PathInterpolator createEmphasizedInterpolator() { Path path = new Path(); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityBackAnimation.kt +1 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ class CrossActivityBackAnimation @Inject constructor( private val enteringStartOffset = context.resources.getDimension(R.dimen.cross_activity_back_entering_start_offset) private val gestureInterpolator = Interpolators.STANDARD_DECELERATE private val gestureInterpolator = Interpolators.BACK_GESTURE private val postCommitInterpolator = Interpolators.FAST_OUT_SLOW_IN private val verticalMoveInterpolator: Interpolator = DecelerateInterpolator() Loading
libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossTaskBackAnimation.java +1 −1 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ public class CrossTaskBackAnimation extends ShellBackAnimation { private final PointF mInitialTouchPos = new PointF(); private final Interpolator mPostAnimationInterpolator = Interpolators.EMPHASIZED; private final Interpolator mProgressInterpolator = Interpolators.STANDARD_DECELERATE; private final Interpolator mProgressInterpolator = Interpolators.BACK_GESTURE; private final Interpolator mVerticalMoveInterpolator = new DecelerateInterpolator(); private final Matrix mTransformMatrix = new Matrix(); Loading