Apply scrim protection to atomic state transition ALLAPPS -> NORMAL

Bug: 209480401

Test: manual, video attached on the bug

TL;DR;; minimized the delta for sc-v2

Change-Id: If8c9281bb4366540b9a4ea10a9b363ce82d78daf
This commit is contained in:
Hyunyoung Song 2022-01-04 21:40:20 -08:00
parent 3f14c80d4c
commit 153cd69d14
2 changed files with 17 additions and 4 deletions

View File

@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides.states;
import static android.view.View.VISIBLE; import static android.view.View.VISIBLE;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.HINT_STATE;
import static com.android.launcher3.LauncherState.HINT_STATE_TWO_BUTTON; import static com.android.launcher3.LauncherState.HINT_STATE_TWO_BUTTON;
import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.NORMAL;
@ -44,6 +45,10 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD;
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD;
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_SCRIM_OPAQUE_THRESHOLD;
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_SCRIM_VISIBLE_THRESHOLD;
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
import android.animation.ValueAnimator; import android.animation.ValueAnimator;
@ -52,6 +57,7 @@ import com.android.launcher3.CellLayout;
import com.android.launcher3.Hotseat; import com.android.launcher3.Hotseat;
import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherState;
import com.android.launcher3.Workspace; import com.android.launcher3.Workspace;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.SysUINavigationMode;
@ -171,6 +177,13 @@ public class QuickstepAtomicAnimationFactory extends
mHintToNormalDuration = (int) va.getDuration(); mHintToNormalDuration = (int) va.getDuration();
} }
config.duration = Math.max(config.duration, mHintToNormalDuration); config.duration = Math.max(config.duration, mHintToNormalDuration);
} else if (fromState == ALL_APPS && toState == NORMAL) {
config.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(DEACCEL,
1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
config.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(DEACCEL,
1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD,
1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD));
} }
} }
} }

View File

@ -52,22 +52,22 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
/** /**
* The progress at which all apps content will be fully visible. * The progress at which all apps content will be fully visible.
*/ */
protected static final float ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD = 0.8f; public static final float ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD = 0.8f;
/** /**
* Minimum clamping progress for fading in all apps content * Minimum clamping progress for fading in all apps content
*/ */
protected static final float ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD = 0.5f; public static final float ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD = 0.5f;
/** /**
* Minimum clamping progress for fading in all apps scrim * Minimum clamping progress for fading in all apps scrim
*/ */
protected static final float ALL_APPS_SCRIM_VISIBLE_THRESHOLD = .1f; public static final float ALL_APPS_SCRIM_VISIBLE_THRESHOLD = .1f;
/** /**
* Maximum clamping progress for opaque all apps scrim * Maximum clamping progress for opaque all apps scrim
*/ */
protected static final float ALL_APPS_SCRIM_OPAQUE_THRESHOLD = .5f; public static final float ALL_APPS_SCRIM_OPAQUE_THRESHOLD = .5f;
private final PortraitOverviewStateTouchHelper mOverviewPortraitStateTouchHelper; private final PortraitOverviewStateTouchHelper mOverviewPortraitStateTouchHelper;