Cancel unfold animation when rotation changes

In DeviceFoldStateProvider.kt, FOLD_UPDATE_FINISH_HALF_OPEN is emitted if the rotation changes while the animation is in progress.

 This targets the case when the device goes to tabletop mode during the transition.

+ Using RotationChangeProvider to fix problems when the new orientation change was received in a background thread unexpectedly. This fixes: (1) wrong launcher icons movement after the rotation, and (2) wrong dark overlay scrim after rotation.

+ Minor formattig fixes by ktfmt

Bug: 241743859
Test: DeviceFoldStateProviderTest && NaturalRotationUnfoldProgressProviderTest && manual stress testing
Change-Id: Iee234e4b832cad8298b69356fce7c14d75e89ccc
This commit is contained in:
Nicolo' Mazzucato
2022-10-12 13:40:39 +00:00
parent 0fa114ecc0
commit 74c3a0024b
7 changed files with 62 additions and 19 deletions

View File

@@ -15,13 +15,13 @@
*/
package com.android.launcher3.taskbar;
import android.view.IWindowManager;
import android.view.View;
import android.view.WindowManager;
import com.android.quickstep.util.LauncherViewsMoveFromCenterTranslationApplier;
import com.android.systemui.shared.animation.UnfoldMoveFromCenterAnimator;
import com.android.systemui.unfold.UnfoldTransitionProgressProvider.TransitionProgressListener;
import com.android.systemui.unfold.updates.RotationChangeProvider;
import com.android.systemui.unfold.util.NaturalRotationUnfoldProgressProvider;
import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider;
@@ -41,16 +41,20 @@ public class TaskbarUnfoldAnimationController implements
public TaskbarUnfoldAnimationController(BaseTaskbarContext context,
ScopedUnfoldTransitionProgressProvider source,
WindowManager windowManager, IWindowManager iWindowManager) {
WindowManager windowManager,
RotationChangeProvider rotationChangeProvider) {
mScopedUnfoldTransitionProgressProvider = source;
mNaturalUnfoldTransitionProgressProvider =
new NaturalRotationUnfoldProgressProvider(context, iWindowManager, source);
new NaturalRotationUnfoldProgressProvider(context,
rotationChangeProvider,
source);
mMoveFromCenterAnimator = new UnfoldMoveFromCenterAnimator(windowManager,
new LauncherViewsMoveFromCenterTranslationApplier());
}
/**
* Initializes the controller
*
* @param taskbarControllers references to all other taskbar controllers
*/
public void init(TaskbarControllers taskbarControllers) {