2021-11-08 00:48:53 -08:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2021 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 com.android.launcher3.taskbar;
|
|
|
|
|
|
2023-04-26 15:12:30 +00:00
|
|
|
import static com.android.app.animation.Interpolators.EMPHASIZED;
|
2023-03-17 14:46:29 +01:00
|
|
|
import static com.android.launcher3.taskbar.TaskbarKeyguardController.MASK_ANY_SYSUI_LOCKED;
|
2021-11-08 00:48:53 -08:00
|
|
|
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP;
|
|
|
|
|
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASHED_LAUNCHER_STATE;
|
|
|
|
|
import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_HOME;
|
2023-03-02 15:39:33 +01:00
|
|
|
import static com.android.launcher3.util.FlagDebugUtils.appendFlag;
|
|
|
|
|
import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange;
|
2023-03-28 16:08:57 +02:00
|
|
|
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_AWAKE;
|
2023-03-31 13:13:59 +02:00
|
|
|
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DREAMING;
|
|
|
|
|
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_WAKEFULNESS_MASK;
|
|
|
|
|
import static com.android.systemui.shared.system.QuickStepContract.WAKEFULNESS_AWAKE;
|
2021-11-08 00:48:53 -08:00
|
|
|
|
|
|
|
|
import android.animation.Animator;
|
|
|
|
|
import android.animation.AnimatorListenerAdapter;
|
|
|
|
|
import android.animation.AnimatorSet;
|
|
|
|
|
import android.animation.ObjectAnimator;
|
2023-03-31 13:13:59 +02:00
|
|
|
import android.os.SystemClock;
|
2022-06-09 15:09:26 +01:00
|
|
|
import android.util.Log;
|
2021-11-08 00:48:53 -08:00
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
2022-03-28 23:58:36 -07:00
|
|
|
import androidx.annotation.Nullable;
|
2021-11-08 00:48:53 -08:00
|
|
|
|
2022-01-12 14:33:43 -08:00
|
|
|
import com.android.launcher3.AbstractFloatingView;
|
2022-08-05 17:29:22 +01:00
|
|
|
import com.android.launcher3.DeviceProfile;
|
2021-11-08 00:48:53 -08:00
|
|
|
import com.android.launcher3.LauncherState;
|
2022-06-09 15:09:26 +01:00
|
|
|
import com.android.launcher3.QuickstepTransitionManager;
|
2022-04-06 17:29:09 +00:00
|
|
|
import com.android.launcher3.Utilities;
|
2022-12-08 13:00:21 -08:00
|
|
|
import com.android.launcher3.anim.AnimatedFloat;
|
2022-06-23 11:25:10 -07:00
|
|
|
import com.android.launcher3.anim.AnimatorListeners;
|
2021-11-08 00:48:53 -08:00
|
|
|
import com.android.launcher3.statemanager.StateManager;
|
2022-08-18 09:51:07 -07:00
|
|
|
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
2022-10-26 10:29:46 -07:00
|
|
|
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
|
2021-11-08 00:48:53 -08:00
|
|
|
import com.android.quickstep.RecentsAnimationCallbacks;
|
|
|
|
|
import com.android.quickstep.RecentsAnimationController;
|
|
|
|
|
import com.android.quickstep.views.RecentsView;
|
2022-04-06 17:29:09 +00:00
|
|
|
import com.android.systemui.animation.ViewRootSync;
|
2021-11-08 00:48:53 -08:00
|
|
|
import com.android.systemui.shared.recents.model.ThumbnailData;
|
|
|
|
|
|
2022-03-07 12:49:56 -08:00
|
|
|
import java.io.PrintWriter;
|
2021-11-08 00:48:53 -08:00
|
|
|
import java.util.HashMap;
|
2022-03-07 12:49:56 -08:00
|
|
|
import java.util.StringJoiner;
|
2021-11-08 00:48:53 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Track LauncherState, RecentsAnimation, resumed state for task bar in one place here and animate
|
|
|
|
|
* the task bar accordingly.
|
|
|
|
|
*/
|
2023-03-02 15:39:33 +01:00
|
|
|
public class TaskbarLauncherStateController {
|
2021-11-08 00:48:53 -08:00
|
|
|
|
2022-06-09 15:09:26 +01:00
|
|
|
private static final String TAG = TaskbarLauncherStateController.class.getSimpleName();
|
|
|
|
|
private static final boolean DEBUG = false;
|
|
|
|
|
|
2023-03-02 15:39:33 +01:00
|
|
|
/** Launcher activity is resumed and focused. */
|
2021-11-08 00:48:53 -08:00
|
|
|
public static final int FLAG_RESUMED = 1 << 0;
|
|
|
|
|
|
2023-03-02 15:39:33 +01:00
|
|
|
/**
|
|
|
|
|
* A external transition / animation is running that will result in FLAG_RESUMED being set.
|
|
|
|
|
**/
|
|
|
|
|
public static final int FLAG_TRANSITION_TO_RESUMED = 1 << 1;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set while the launcher state machine is performing a state transition, see {@link
|
|
|
|
|
* StateManager.StateListener}.
|
|
|
|
|
*/
|
|
|
|
|
public static final int FLAG_LAUNCHER_IN_STATE_TRANSITION = 1 << 2;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the screen is currently on, or is transitioning to be on.
|
|
|
|
|
*
|
|
|
|
|
* This is cleared as soon as the screen begins to transition off.
|
|
|
|
|
*/
|
2023-03-28 16:08:57 +02:00
|
|
|
private static final int FLAG_AWAKE = 1 << 3;
|
2023-03-02 15:39:33 +01:00
|
|
|
|
|
|
|
|
/**
|
2023-03-28 16:08:57 +02:00
|
|
|
* Captures whether the launcher was active at the time the FLAG_AWAKE was cleared.
|
|
|
|
|
* Always cleared when FLAG_AWAKE is set.
|
2023-03-02 15:39:33 +01:00
|
|
|
* <p>
|
2023-03-28 16:08:57 +02:00
|
|
|
* FLAG_RESUMED will be cleared when the device is asleep, since all apps get paused at this
|
|
|
|
|
* point. Thus, this flag indicates whether the launcher will be shown when the device wakes up
|
2023-03-02 15:39:33 +01:00
|
|
|
* again.
|
|
|
|
|
*/
|
2023-03-28 16:08:57 +02:00
|
|
|
private static final int FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE = 1 << 4;
|
2023-03-02 15:39:33 +01:00
|
|
|
|
2023-03-31 13:13:59 +02:00
|
|
|
/**
|
|
|
|
|
* Whether the device is currently locked.
|
|
|
|
|
* <ul>
|
|
|
|
|
* <li>While locked, the taskbar is always stashed.<li/>
|
|
|
|
|
* <li>Navbar animations on FLAG_DEVICE_LOCKED transitions will get special treatment.</li>
|
|
|
|
|
* </ul>
|
|
|
|
|
*/
|
2023-03-17 14:46:29 +01:00
|
|
|
private static final int FLAG_DEVICE_LOCKED = 1 << 5;
|
|
|
|
|
|
2023-03-31 13:13:59 +02:00
|
|
|
/**
|
|
|
|
|
* Whether the complete taskbar is completely hidden (neither visible stashed or unstashed).
|
|
|
|
|
* This is tracked to allow a nice transition of the taskbar before SysUI forces it away by
|
|
|
|
|
* hiding the inset.
|
|
|
|
|
*
|
|
|
|
|
* This flag is predominanlty set while FLAG_DEVICE_LOCKED is set, thus the taskbar's invisible
|
|
|
|
|
* resting state while hidden is stashed.
|
|
|
|
|
*/
|
|
|
|
|
private static final int FLAG_TASKBAR_HIDDEN = 1 << 6;
|
|
|
|
|
|
2023-03-02 15:39:33 +01:00
|
|
|
private static final int FLAGS_LAUNCHER_ACTIVE = FLAG_RESUMED | FLAG_TRANSITION_TO_RESUMED;
|
2021-12-02 12:26:34 -08:00
|
|
|
/** Equivalent to an int with all 1s for binary operation purposes */
|
|
|
|
|
private static final int FLAGS_ALL = ~0;
|
|
|
|
|
|
2023-03-17 08:06:52 -07:00
|
|
|
private static final float TASKBAR_BG_ALPHA_LAUNCHER_NOT_ALIGNED_DELAY_MULT = 0.33f;
|
|
|
|
|
private static final float TASKBAR_BG_ALPHA_NOT_LAUNCHER_NOT_ALIGNED_DELAY_MULT = 0.33f;
|
|
|
|
|
private static final float TASKBAR_BG_ALPHA_LAUNCHER_IS_ALIGNED_DURATION_MULT = 0.25f;
|
|
|
|
|
|
2023-03-31 13:13:59 +02:00
|
|
|
/**
|
|
|
|
|
* Delay for the taskbar fade-in.
|
|
|
|
|
*
|
|
|
|
|
* Helps to avoid visual noise when unlocking successfully via SFPS, and the device transitions
|
|
|
|
|
* to launcher directly. The delay avoids the navbar to become briefly visible. The duration
|
|
|
|
|
* is the same as in SysUI, see http://shortn/_uNSbDoRUSr.
|
|
|
|
|
*/
|
|
|
|
|
private static final long TASKBAR_SHOW_DELAY_MS = 250;
|
|
|
|
|
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
private final AnimatedFloat mIconAlignment =
|
|
|
|
|
new AnimatedFloat(this::onIconAlignmentRatioChanged);
|
2021-11-08 00:48:53 -08:00
|
|
|
|
|
|
|
|
private TaskbarControllers mControllers;
|
|
|
|
|
private AnimatedFloat mTaskbarBackgroundAlpha;
|
2023-03-31 13:13:59 +02:00
|
|
|
private AnimatedFloat mTaskbarAlpha;
|
2022-10-31 18:17:03 +00:00
|
|
|
private AnimatedFloat mTaskbarCornerRoundness;
|
2022-09-13 14:40:48 -07:00
|
|
|
private MultiProperty mIconAlphaForHome;
|
2022-08-18 09:51:07 -07:00
|
|
|
private QuickstepLauncher mLauncher;
|
2021-11-08 00:48:53 -08:00
|
|
|
|
2021-12-02 12:26:34 -08:00
|
|
|
private Integer mPrevState;
|
2021-11-08 00:48:53 -08:00
|
|
|
private int mState;
|
2021-11-24 15:43:52 -08:00
|
|
|
private LauncherState mLauncherState = LauncherState.NORMAL;
|
2021-11-08 00:48:53 -08:00
|
|
|
|
2023-03-31 13:13:59 +02:00
|
|
|
// Time when FLAG_TASKBAR_HIDDEN was last cleared, SystemClock.elapsedRealtime (milliseconds).
|
|
|
|
|
private long mLastUnlockTimeMs = 0;
|
|
|
|
|
|
2022-03-28 23:58:36 -07:00
|
|
|
private @Nullable TaskBarRecentsAnimationListener mTaskBarRecentsAnimationListener;
|
|
|
|
|
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
private boolean mIsAnimatingToLauncher;
|
2021-11-08 00:48:53 -08:00
|
|
|
|
2021-12-12 11:16:29 +08:00
|
|
|
private boolean mShouldDelayLauncherStateAnim;
|
|
|
|
|
|
2022-04-06 17:29:09 +00:00
|
|
|
// We skip any view synchronizations during init/destroy.
|
|
|
|
|
private boolean mCanSyncViews;
|
|
|
|
|
|
2023-03-16 17:26:14 -07:00
|
|
|
private boolean mIsQsbInline;
|
|
|
|
|
|
2022-08-05 17:29:22 +01:00
|
|
|
private final DeviceProfile.OnDeviceProfileChangeListener mOnDeviceProfileChangeListener =
|
2023-03-16 17:26:14 -07:00
|
|
|
new DeviceProfile.OnDeviceProfileChangeListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onDeviceProfileChanged(DeviceProfile dp) {
|
|
|
|
|
if (mIsQsbInline && !dp.isQsbInline) {
|
|
|
|
|
// We only modify QSB alpha if isQsbInline = true. If we switch to a DP
|
|
|
|
|
// where isQsbInline = false, then we need to reset the alpha.
|
|
|
|
|
mLauncher.getHotseat().setQsbAlpha(1f);
|
|
|
|
|
}
|
|
|
|
|
mIsQsbInline = dp.isQsbInline;
|
|
|
|
|
TaskbarLauncherStateController.this.updateIconAlphaForHome(
|
|
|
|
|
mIconAlphaForHome.getValue());
|
|
|
|
|
}
|
|
|
|
|
};
|
2022-08-05 17:29:22 +01:00
|
|
|
|
2021-11-08 00:48:53 -08:00
|
|
|
private final StateManager.StateListener<LauncherState> mStateListener =
|
|
|
|
|
new StateManager.StateListener<LauncherState>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onStateTransitionStart(LauncherState toState) {
|
2021-11-24 15:43:52 -08:00
|
|
|
if (toState != mLauncherState) {
|
2023-03-02 15:39:33 +01:00
|
|
|
// Treat FLAG_LAUNCHER_IN_STATE_TRANSITION as a changed flag even if a
|
|
|
|
|
// previous state transition was already running, so we update the new
|
|
|
|
|
// target.
|
|
|
|
|
mPrevState &= ~FLAG_LAUNCHER_IN_STATE_TRANSITION;
|
2021-11-24 15:43:52 -08:00
|
|
|
mLauncherState = toState;
|
|
|
|
|
}
|
2023-03-02 15:39:33 +01:00
|
|
|
updateStateForFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION, true);
|
2021-12-12 11:16:29 +08:00
|
|
|
if (!mShouldDelayLauncherStateAnim) {
|
2022-06-09 15:09:26 +01:00
|
|
|
if (toState == LauncherState.NORMAL) {
|
|
|
|
|
applyState(QuickstepTransitionManager.TASKBAR_TO_HOME_DURATION);
|
|
|
|
|
} else {
|
|
|
|
|
applyState();
|
|
|
|
|
}
|
2021-12-12 11:16:29 +08:00
|
|
|
}
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onStateTransitionComplete(LauncherState finalState) {
|
2021-11-24 15:43:52 -08:00
|
|
|
mLauncherState = finalState;
|
2023-03-02 15:39:33 +01:00
|
|
|
updateStateForFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION, false);
|
2021-11-08 00:48:53 -08:00
|
|
|
applyState();
|
2022-10-30 16:50:32 -07:00
|
|
|
boolean disallowLongClick = finalState == LauncherState.OVERVIEW_SPLIT_SELECT;
|
2023-02-06 18:02:50 -08:00
|
|
|
com.android.launcher3.taskbar.Utilities.setOverviewDragState(
|
2023-02-18 06:34:08 +00:00
|
|
|
mControllers, finalState.disallowTaskbarGlobalDrag(),
|
|
|
|
|
disallowLongClick, finalState.allowTaskbarInitialSplitSelection());
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-13 13:21:06 +02:00
|
|
|
/** Initializes the controller instance, and applies the initial state immediately. */
|
|
|
|
|
public void init(TaskbarControllers controllers, QuickstepLauncher launcher,
|
|
|
|
|
int sysuiStateFlags) {
|
2022-04-06 17:29:09 +00:00
|
|
|
mCanSyncViews = false;
|
|
|
|
|
|
2021-11-08 00:48:53 -08:00
|
|
|
mControllers = controllers;
|
|
|
|
|
mLauncher = launcher;
|
|
|
|
|
|
2023-03-16 17:26:14 -07:00
|
|
|
mIsQsbInline = mLauncher.getDeviceProfile().isQsbInline;
|
|
|
|
|
|
2021-11-08 00:48:53 -08:00
|
|
|
mTaskbarBackgroundAlpha = mControllers.taskbarDragLayerController
|
|
|
|
|
.getTaskbarBackgroundAlpha();
|
2023-03-31 13:13:59 +02:00
|
|
|
mTaskbarAlpha = mControllers.taskbarDragLayerController.getTaskbarAlpha();
|
2022-10-31 18:17:03 +00:00
|
|
|
mTaskbarCornerRoundness = mControllers.getTaskbarCornerRoundness();
|
2022-09-13 14:40:48 -07:00
|
|
|
mIconAlphaForHome = mControllers.taskbarViewController
|
|
|
|
|
.getTaskbarIconAlpha().get(ALPHA_INDEX_HOME);
|
2021-11-08 00:48:53 -08:00
|
|
|
|
2023-02-14 21:02:25 -08:00
|
|
|
resetIconAlignment();
|
2021-11-08 00:48:53 -08:00
|
|
|
|
|
|
|
|
mLauncher.getStateManager().addStateListener(mStateListener);
|
2021-12-14 19:08:55 +00:00
|
|
|
mLauncherState = launcher.getStateManager().getState();
|
2023-04-13 13:21:06 +02:00
|
|
|
updateStateForSysuiFlags(sysuiStateFlags, /*applyState*/ false);
|
|
|
|
|
|
2021-12-14 19:08:55 +00:00
|
|
|
applyState(0);
|
2022-04-06 17:29:09 +00:00
|
|
|
|
|
|
|
|
mCanSyncViews = true;
|
2022-08-05 17:29:22 +01:00
|
|
|
mLauncher.addOnDeviceProfileChangeListener(mOnDeviceProfileChangeListener);
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onDestroy() {
|
2022-04-06 17:29:09 +00:00
|
|
|
mCanSyncViews = false;
|
|
|
|
|
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
mIconAlignment.finishAnimation();
|
2021-11-08 00:48:53 -08:00
|
|
|
|
2023-01-30 19:29:45 +00:00
|
|
|
Log.d("b/260135164", "onDestroy - updateIconAlphaForHome(1)");
|
2021-11-08 00:48:53 -08:00
|
|
|
mLauncher.getHotseat().setIconsAlpha(1f);
|
|
|
|
|
mLauncher.getStateManager().removeStateListener(mStateListener);
|
2022-04-06 17:29:09 +00:00
|
|
|
|
|
|
|
|
mCanSyncViews = true;
|
2022-08-05 17:29:22 +01:00
|
|
|
mLauncher.removeOnDeviceProfileChangeListener(mOnDeviceProfileChangeListener);
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 15:39:33 +01:00
|
|
|
/**
|
|
|
|
|
* Creates a transition animation to the launcher activity.
|
|
|
|
|
*
|
|
|
|
|
* Warning: the resulting animation must be played, since this method has side effects on this
|
|
|
|
|
* controller's state.
|
|
|
|
|
*/
|
2021-11-08 00:48:53 -08:00
|
|
|
public Animator createAnimToLauncher(@NonNull LauncherState toState,
|
|
|
|
|
@NonNull RecentsAnimationCallbacks callbacks, long duration) {
|
|
|
|
|
// If going to overview, stash the task bar
|
|
|
|
|
// If going home, align the icons to hotseat
|
|
|
|
|
AnimatorSet animatorSet = new AnimatorSet();
|
|
|
|
|
|
2021-12-01 15:55:04 -08:00
|
|
|
// Update stashed flags first to ensure goingToUnstashedLauncherState() returns correctly.
|
2021-11-08 00:48:53 -08:00
|
|
|
TaskbarStashController stashController = mControllers.taskbarStashController;
|
|
|
|
|
stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE,
|
2021-11-24 15:43:52 -08:00
|
|
|
toState.isTaskbarStashed(mLauncher));
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
if (DEBUG) {
|
|
|
|
|
Log.d(TAG, "createAnimToLauncher - FLAG_IN_APP: " + false);
|
|
|
|
|
}
|
2021-11-08 00:48:53 -08:00
|
|
|
stashController.updateStateForFlag(FLAG_IN_APP, false);
|
|
|
|
|
|
2023-03-02 15:39:33 +01:00
|
|
|
updateStateForFlag(FLAG_TRANSITION_TO_RESUMED, true);
|
2023-01-12 16:09:24 -08:00
|
|
|
animatorSet.play(stashController.createApplyStateAnimator(duration));
|
2021-11-08 00:48:53 -08:00
|
|
|
animatorSet.play(applyState(duration, false));
|
|
|
|
|
|
2022-09-27 18:49:33 +00:00
|
|
|
if (mTaskBarRecentsAnimationListener != null) {
|
|
|
|
|
mTaskBarRecentsAnimationListener.endGestureStateOverride(
|
|
|
|
|
!mLauncher.isInState(LauncherState.OVERVIEW));
|
|
|
|
|
}
|
2022-03-28 23:58:36 -07:00
|
|
|
mTaskBarRecentsAnimationListener = new TaskBarRecentsAnimationListener(callbacks);
|
|
|
|
|
callbacks.addListener(mTaskBarRecentsAnimationListener);
|
2022-06-13 12:09:35 -07:00
|
|
|
((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchListener(() ->
|
|
|
|
|
mTaskBarRecentsAnimationListener.endGestureStateOverride(true));
|
2021-11-08 00:48:53 -08:00
|
|
|
return animatorSet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isAnimatingToLauncher() {
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
return mIsAnimatingToLauncher;
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|
|
|
|
|
|
2021-12-12 11:16:29 +08:00
|
|
|
public void setShouldDelayLauncherStateAnim(boolean shouldDelayLauncherStateAnim) {
|
|
|
|
|
if (!shouldDelayLauncherStateAnim && mShouldDelayLauncherStateAnim) {
|
|
|
|
|
// Animate the animation we have delayed immediately. This is usually triggered when
|
|
|
|
|
// the user has released their finger.
|
|
|
|
|
applyState();
|
|
|
|
|
}
|
|
|
|
|
mShouldDelayLauncherStateAnim = shouldDelayLauncherStateAnim;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-17 14:46:29 +01:00
|
|
|
/** SysUI flags updated, see QuickStepContract.SYSUI_STATE_* values. */
|
2023-04-13 13:21:06 +02:00
|
|
|
public void updateStateForSysuiFlags(int systemUiStateFlags) {
|
|
|
|
|
updateStateForSysuiFlags(systemUiStateFlags, /* applyState */ true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateStateForSysuiFlags(int systemUiStateFlags, boolean applyState) {
|
2023-03-28 16:08:57 +02:00
|
|
|
final boolean prevIsAwake = hasAnyFlag(FLAG_AWAKE);
|
|
|
|
|
final boolean currIsAwake = hasAnyFlag(systemUiStateFlags, SYSUI_STATE_AWAKE);
|
2023-03-02 15:39:33 +01:00
|
|
|
|
2023-03-28 16:08:57 +02:00
|
|
|
updateStateForFlag(FLAG_AWAKE, currIsAwake);
|
|
|
|
|
if (prevIsAwake != currIsAwake) {
|
2023-03-17 14:46:29 +01:00
|
|
|
// The screen is switching between on/off. When turning off, capture whether the
|
|
|
|
|
// launcher is active and memoize this state.
|
2023-03-28 16:08:57 +02:00
|
|
|
updateStateForFlag(FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE,
|
|
|
|
|
prevIsAwake && hasAnyFlag(FLAGS_LAUNCHER_ACTIVE));
|
2023-03-17 14:46:29 +01:00
|
|
|
}
|
2023-03-02 15:39:33 +01:00
|
|
|
|
2023-03-17 14:46:29 +01:00
|
|
|
boolean isDeviceLocked = hasAnyFlag(systemUiStateFlags, MASK_ANY_SYSUI_LOCKED);
|
|
|
|
|
updateStateForFlag(FLAG_DEVICE_LOCKED, isDeviceLocked);
|
|
|
|
|
|
2023-03-31 13:13:59 +02:00
|
|
|
// Taskbar is hidden whenever the device is dreaming. The dreaming state includes the
|
|
|
|
|
// interactive dreams, AoD, screen off. Since the SYSUI_STATE_DEVICE_DREAMING only kicks in
|
|
|
|
|
// when the device is asleep, the second condition extends ensures that the transition from
|
|
|
|
|
// and to the WAKEFULNESS_ASLEEP state also hide the taskbar, and improves the taskbar
|
|
|
|
|
// hide/reveal animation timings.
|
|
|
|
|
boolean isTaskbarHidden = hasAnyFlag(systemUiStateFlags, SYSUI_STATE_DEVICE_DREAMING)
|
|
|
|
|
|| (systemUiStateFlags & SYSUI_STATE_WAKEFULNESS_MASK) != WAKEFULNESS_AWAKE;
|
|
|
|
|
updateStateForFlag(FLAG_TASKBAR_HIDDEN, isTaskbarHidden);
|
|
|
|
|
|
2023-04-13 13:21:06 +02:00
|
|
|
if (applyState) {
|
2023-03-02 15:39:33 +01:00
|
|
|
applyState();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-08 00:48:53 -08:00
|
|
|
/**
|
|
|
|
|
* Updates the proper flag to change the state of the task bar.
|
|
|
|
|
*
|
|
|
|
|
* Note that this only updates the flag. {@link #applyState()} needs to be called separately.
|
|
|
|
|
*
|
2023-03-02 15:39:33 +01:00
|
|
|
* @param flag The flag to update.
|
2021-11-08 00:48:53 -08:00
|
|
|
* @param enabled Whether to enable the flag
|
|
|
|
|
*/
|
|
|
|
|
public void updateStateForFlag(int flag, boolean enabled) {
|
|
|
|
|
if (enabled) {
|
|
|
|
|
mState |= flag;
|
|
|
|
|
} else {
|
|
|
|
|
mState &= ~flag;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean hasAnyFlag(int flagMask) {
|
|
|
|
|
return hasAnyFlag(mState, flagMask);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean hasAnyFlag(int flags, int flagMask) {
|
|
|
|
|
return (flags & flagMask) != 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void applyState() {
|
2023-02-14 21:02:25 -08:00
|
|
|
applyState(mControllers.taskbarStashController.getStashDuration());
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void applyState(long duration) {
|
|
|
|
|
applyState(duration, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Animator applyState(long duration, boolean start) {
|
2023-02-03 00:32:28 +00:00
|
|
|
if (mControllers.taskbarActivityContext.isDestroyed()) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2021-11-08 00:48:53 -08:00
|
|
|
Animator animator = null;
|
2021-12-02 12:26:34 -08:00
|
|
|
if (mPrevState == null || mPrevState != mState) {
|
|
|
|
|
// If this is our initial state, treat all flags as changed.
|
|
|
|
|
int changedFlags = mPrevState == null ? FLAGS_ALL : mPrevState ^ mState;
|
2023-03-02 15:39:33 +01:00
|
|
|
|
|
|
|
|
if (DEBUG) {
|
|
|
|
|
String stateString;
|
|
|
|
|
if (mPrevState == null) {
|
|
|
|
|
stateString = getStateString(mState) + "(initial update)";
|
|
|
|
|
} else {
|
|
|
|
|
stateString = formatFlagChange(mState, mPrevState,
|
|
|
|
|
TaskbarLauncherStateController::getStateString);
|
|
|
|
|
}
|
|
|
|
|
Log.d(TAG, "applyState: " + stateString
|
|
|
|
|
+ ", duration: " + duration
|
|
|
|
|
+ ", start: " + start);
|
|
|
|
|
}
|
2021-11-08 00:48:53 -08:00
|
|
|
mPrevState = mState;
|
2021-11-24 15:43:52 -08:00
|
|
|
animator = onStateChangeApplied(changedFlags, duration, start);
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|
|
|
|
|
return animator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Animator onStateChangeApplied(int changedFlags, long duration, boolean start) {
|
2023-03-02 15:39:33 +01:00
|
|
|
final boolean isInLauncher = isInLauncher();
|
2023-03-17 08:06:52 -07:00
|
|
|
final boolean isIconAlignedWithHotseat = isIconAlignedWithHotseat();
|
|
|
|
|
final float toAlignment = isIconAlignedWithHotseat ? 1 : 0;
|
2023-01-16 18:20:27 +00:00
|
|
|
boolean handleOpenFloatingViews = false;
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
if (DEBUG) {
|
2023-03-02 15:39:33 +01:00
|
|
|
Log.d(TAG, "onStateChangeApplied - isInLauncher: " + isInLauncher
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
+ ", mLauncherState: " + mLauncherState
|
|
|
|
|
+ ", toAlignment: " + toAlignment);
|
|
|
|
|
}
|
2021-11-08 00:48:53 -08:00
|
|
|
AnimatorSet animatorSet = new AnimatorSet();
|
|
|
|
|
|
2023-03-02 15:39:33 +01:00
|
|
|
if (hasAnyFlag(changedFlags, FLAG_LAUNCHER_IN_STATE_TRANSITION)) {
|
|
|
|
|
boolean launcherTransitionCompleted = !hasAnyFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION);
|
|
|
|
|
playStateTransitionAnim(animatorSet, duration, launcherTransitionCompleted);
|
2021-11-08 00:48:53 -08:00
|
|
|
|
2023-03-02 15:39:33 +01:00
|
|
|
if (launcherTransitionCompleted
|
|
|
|
|
&& mLauncherState == LauncherState.QUICK_SWITCH_FROM_HOME) {
|
Update taskbar resume alignment anim if launcher state changes in the middle
One way to reproduce this issue is to run `adb shell input keyevent KEYCODE_HOME`, which happens to pause and immediately resume launcher. For example, let's say we run this while in All Apps. Because the isResumed=true comes before the state transition to Normal, we behave as if we are still going to All Apps, specifically goingToUnstashedState = false (since we stash in All Apps). To fix this, we now listen to state changes while the resume alignment animation is playing, and update it if necessary.
Also did the same correction for the gesture alignment animation, though I don't have a specific repo for that.
Finally, because there are now more triggers for alignment animations to play, we add a check to only play them if it's not animating to the same value it's already animating towards. One notable experience this improves is swiping down from All Apps to home; if you do it quick enough, the state animation ends before the taskbar unstash animation, and thus the unstash animation would cancel and start again with the full duration, making it look laggy/disjointed (this behavior existed before this change as well).
Test: TaplTestsQuickstep
Test: Go to All Apps, run `adb shell input keyevent KEYCODE_HOME`, open an app and ensure taskbar icons are visible
Test: Quick switch from home when taskbar is present in apps, but instead go to overview; ensure no jump when taskbar stashes
Test: Swipe down quickly from All Apps, ensure taskbar unstashing doesn't slow down when reaching the end of the state transition
Fixes: 214562370
Change-Id: Ie0c6140e14186e41c7e4748dc745f87349b084fe
2022-01-19 00:10:45 +00:00
|
|
|
// We're about to be paused, set immediately to ensure seamless handoff.
|
|
|
|
|
updateStateForFlag(FLAG_RESUMED, false);
|
|
|
|
|
applyState(0 /* duration */);
|
|
|
|
|
}
|
2023-01-16 18:20:27 +00:00
|
|
|
if (mLauncherState == LauncherState.NORMAL) {
|
|
|
|
|
// We're changing state to home, should close open popups e.g. Taskbar AllApps
|
|
|
|
|
handleOpenFloatingViews = true;
|
|
|
|
|
}
|
Update taskbar resume alignment anim if launcher state changes in the middle
One way to reproduce this issue is to run `adb shell input keyevent KEYCODE_HOME`, which happens to pause and immediately resume launcher. For example, let's say we run this while in All Apps. Because the isResumed=true comes before the state transition to Normal, we behave as if we are still going to All Apps, specifically goingToUnstashedState = false (since we stash in All Apps). To fix this, we now listen to state changes while the resume alignment animation is playing, and update it if necessary.
Also did the same correction for the gesture alignment animation, though I don't have a specific repo for that.
Finally, because there are now more triggers for alignment animations to play, we add a check to only play them if it's not animating to the same value it's already animating towards. One notable experience this improves is swiping down from All Apps to home; if you do it quick enough, the state animation ends before the taskbar unstash animation, and thus the unstash animation would cancel and start again with the full duration, making it look laggy/disjointed (this behavior existed before this change as well).
Test: TaplTestsQuickstep
Test: Go to All Apps, run `adb shell input keyevent KEYCODE_HOME`, open an app and ensure taskbar icons are visible
Test: Quick switch from home when taskbar is present in apps, but instead go to overview; ensure no jump when taskbar stashes
Test: Swipe down quickly from All Apps, ensure taskbar unstashing doesn't slow down when reaching the end of the state transition
Fixes: 214562370
Change-Id: Ie0c6140e14186e41c7e4748dc745f87349b084fe
2022-01-19 00:10:45 +00:00
|
|
|
}
|
|
|
|
|
|
2023-04-13 13:21:06 +02:00
|
|
|
if (hasAnyFlag(changedFlags, FLAGS_LAUNCHER_ACTIVE)) {
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
animatorSet.addListener(new AnimatorListenerAdapter() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationStart(Animator animation) {
|
2023-03-02 15:39:33 +01:00
|
|
|
mIsAnimatingToLauncher = isInLauncher;
|
Update taskbar resume alignment anim if launcher state changes in the middle
One way to reproduce this issue is to run `adb shell input keyevent KEYCODE_HOME`, which happens to pause and immediately resume launcher. For example, let's say we run this while in All Apps. Because the isResumed=true comes before the state transition to Normal, we behave as if we are still going to All Apps, specifically goingToUnstashedState = false (since we stash in All Apps). To fix this, we now listen to state changes while the resume alignment animation is playing, and update it if necessary.
Also did the same correction for the gesture alignment animation, though I don't have a specific repo for that.
Finally, because there are now more triggers for alignment animations to play, we add a check to only play them if it's not animating to the same value it's already animating towards. One notable experience this improves is swiping down from All Apps to home; if you do it quick enough, the state animation ends before the taskbar unstash animation, and thus the unstash animation would cancel and start again with the full duration, making it look laggy/disjointed (this behavior existed before this change as well).
Test: TaplTestsQuickstep
Test: Go to All Apps, run `adb shell input keyevent KEYCODE_HOME`, open an app and ensure taskbar icons are visible
Test: Quick switch from home when taskbar is present in apps, but instead go to overview; ensure no jump when taskbar stashes
Test: Swipe down quickly from All Apps, ensure taskbar unstashing doesn't slow down when reaching the end of the state transition
Fixes: 214562370
Change-Id: Ie0c6140e14186e41c7e4748dc745f87349b084fe
2022-01-19 00:10:45 +00:00
|
|
|
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
TaskbarStashController stashController =
|
|
|
|
|
mControllers.taskbarStashController;
|
|
|
|
|
if (DEBUG) {
|
2023-03-02 15:39:33 +01:00
|
|
|
Log.d(TAG, "onAnimationStart - FLAG_IN_APP: " + !isInLauncher);
|
Update taskbar resume alignment anim if launcher state changes in the middle
One way to reproduce this issue is to run `adb shell input keyevent KEYCODE_HOME`, which happens to pause and immediately resume launcher. For example, let's say we run this while in All Apps. Because the isResumed=true comes before the state transition to Normal, we behave as if we are still going to All Apps, specifically goingToUnstashedState = false (since we stash in All Apps). To fix this, we now listen to state changes while the resume alignment animation is playing, and update it if necessary.
Also did the same correction for the gesture alignment animation, though I don't have a specific repo for that.
Finally, because there are now more triggers for alignment animations to play, we add a check to only play them if it's not animating to the same value it's already animating towards. One notable experience this improves is swiping down from All Apps to home; if you do it quick enough, the state animation ends before the taskbar unstash animation, and thus the unstash animation would cancel and start again with the full duration, making it look laggy/disjointed (this behavior existed before this change as well).
Test: TaplTestsQuickstep
Test: Go to All Apps, run `adb shell input keyevent KEYCODE_HOME`, open an app and ensure taskbar icons are visible
Test: Quick switch from home when taskbar is present in apps, but instead go to overview; ensure no jump when taskbar stashes
Test: Swipe down quickly from All Apps, ensure taskbar unstashing doesn't slow down when reaching the end of the state transition
Fixes: 214562370
Change-Id: Ie0c6140e14186e41c7e4748dc745f87349b084fe
2022-01-19 00:10:45 +00:00
|
|
|
}
|
2023-03-02 15:39:33 +01:00
|
|
|
stashController.updateStateForFlag(FLAG_IN_APP, !isInLauncher);
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
stashController.applyState(duration);
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|
2023-03-02 15:39:33 +01:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
|
mIsAnimatingToLauncher = false;
|
|
|
|
|
}
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
});
|
2021-11-08 00:48:53 -08:00
|
|
|
|
2023-01-16 18:20:27 +00:00
|
|
|
// Handle closing open popups when going home/overview
|
|
|
|
|
handleOpenFloatingViews = true;
|
|
|
|
|
}
|
2023-03-02 15:39:33 +01:00
|
|
|
|
|
|
|
|
if (handleOpenFloatingViews && isInLauncher) {
|
2023-01-16 18:20:27 +00:00
|
|
|
AbstractFloatingView.closeAllOpenViews(mControllers.taskbarActivityContext);
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
}
|
|
|
|
|
|
2023-03-31 13:13:59 +02:00
|
|
|
if (hasAnyFlag(changedFlags, FLAG_TASKBAR_HIDDEN) && !hasAnyFlag(FLAG_TASKBAR_HIDDEN)) {
|
|
|
|
|
// Take note of the current time, as the taskbar is made visible again.
|
|
|
|
|
mLastUnlockTimeMs = SystemClock.elapsedRealtime();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boolean isHidden = hasAnyFlag(FLAG_TASKBAR_HIDDEN);
|
|
|
|
|
float taskbarAlpha = isHidden ? 0 : 1;
|
|
|
|
|
if (mTaskbarAlpha.isAnimating() || mTaskbarAlpha.value != taskbarAlpha) {
|
|
|
|
|
Animator taskbarVisibility = mTaskbarAlpha.animateToValue(taskbarAlpha);
|
|
|
|
|
|
|
|
|
|
taskbarVisibility.setDuration(duration);
|
|
|
|
|
if (isHidden) {
|
|
|
|
|
// Stash the transient taskbar once the taskbar is not visible. This reduces
|
|
|
|
|
// visual noise when unlocking the device afterwards.
|
|
|
|
|
animatorSet.addListener(new AnimatorListenerAdapter() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
|
TaskbarStashController stashController =
|
|
|
|
|
mControllers.taskbarStashController;
|
|
|
|
|
stashController.updateAndAnimateTransientTaskbar(
|
|
|
|
|
/* stash */ true, /* duration */ 0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// delay the fade in animation a bit to reduce visual noise when waking up a device
|
|
|
|
|
// with a fingerprint reader. This should only be done when the device was woken
|
|
|
|
|
// up via fingerprint reader, however since this information is currently not
|
|
|
|
|
// available, opting to always delay the fade-in a bit.
|
|
|
|
|
long durationSinceLastUnlockMs = SystemClock.elapsedRealtime() - mLastUnlockTimeMs;
|
|
|
|
|
taskbarVisibility.setStartDelay(
|
|
|
|
|
Math.max(0, TASKBAR_SHOW_DELAY_MS - durationSinceLastUnlockMs));
|
|
|
|
|
}
|
|
|
|
|
animatorSet.play(taskbarVisibility);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-02 15:39:33 +01:00
|
|
|
float backgroundAlpha = isInLauncher && isTaskbarAlignedWithHotseat() ? 0 : 1;
|
|
|
|
|
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
// Don't animate if background has reached desired value.
|
|
|
|
|
if (mTaskbarBackgroundAlpha.isAnimating()
|
|
|
|
|
|| mTaskbarBackgroundAlpha.value != backgroundAlpha) {
|
|
|
|
|
mTaskbarBackgroundAlpha.cancelAnimation();
|
|
|
|
|
if (DEBUG) {
|
|
|
|
|
Log.d(TAG, "onStateChangeApplied - taskbarBackgroundAlpha - "
|
|
|
|
|
+ mTaskbarBackgroundAlpha.value
|
|
|
|
|
+ " -> " + backgroundAlpha + ": " + duration);
|
|
|
|
|
}
|
2023-02-14 21:02:25 -08:00
|
|
|
|
2023-03-02 15:39:33 +01:00
|
|
|
boolean isInLauncherIconNotAligned = isInLauncher && !isIconAlignedWithHotseat;
|
|
|
|
|
boolean notInLauncherIconNotAligned = !isInLauncher && !isIconAlignedWithHotseat;
|
|
|
|
|
boolean isInLauncherIconIsAligned = isInLauncher && isIconAlignedWithHotseat;
|
2023-03-17 08:06:52 -07:00
|
|
|
|
|
|
|
|
float startDelay = 0;
|
|
|
|
|
// We want to delay the background from fading in so that the icons have time to move
|
|
|
|
|
// into the bounds of the background before it appears.
|
2023-03-02 15:39:33 +01:00
|
|
|
if (isInLauncherIconNotAligned) {
|
2023-03-17 08:06:52 -07:00
|
|
|
startDelay = duration * TASKBAR_BG_ALPHA_LAUNCHER_NOT_ALIGNED_DELAY_MULT;
|
2023-03-02 15:39:33 +01:00
|
|
|
} else if (notInLauncherIconNotAligned) {
|
2023-03-17 08:06:52 -07:00
|
|
|
startDelay = duration * TASKBAR_BG_ALPHA_NOT_LAUNCHER_NOT_ALIGNED_DELAY_MULT;
|
|
|
|
|
}
|
|
|
|
|
float newDuration = duration - startDelay;
|
2023-03-02 15:39:33 +01:00
|
|
|
if (isInLauncherIconIsAligned) {
|
2023-03-17 08:06:52 -07:00
|
|
|
// Make the background fade out faster so that it is gone by the time the
|
|
|
|
|
// icons move outside of the bounds of the background.
|
|
|
|
|
newDuration = duration * TASKBAR_BG_ALPHA_LAUNCHER_IS_ALIGNED_DURATION_MULT;
|
|
|
|
|
}
|
2023-02-14 21:02:25 -08:00
|
|
|
Animator taskbarBackgroundAlpha = mTaskbarBackgroundAlpha
|
|
|
|
|
.animateToValue(backgroundAlpha)
|
2023-03-17 08:06:52 -07:00
|
|
|
.setDuration((long) newDuration);
|
|
|
|
|
taskbarBackgroundAlpha.setStartDelay((long) startDelay);
|
2023-02-14 21:02:25 -08:00
|
|
|
animatorSet.play(taskbarBackgroundAlpha);
|
2021-12-02 12:26:34 -08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 15:39:33 +01:00
|
|
|
float cornerRoundness = isInLauncher ? 0 : 1;
|
|
|
|
|
|
2022-10-31 18:17:03 +00:00
|
|
|
// Don't animate if corner roundness has reached desired value.
|
|
|
|
|
if (mTaskbarCornerRoundness.isAnimating()
|
|
|
|
|
|| mTaskbarCornerRoundness.value != cornerRoundness) {
|
|
|
|
|
mTaskbarCornerRoundness.cancelAnimation();
|
|
|
|
|
if (DEBUG) {
|
|
|
|
|
Log.d(TAG, "onStateChangeApplied - taskbarCornerRoundness - "
|
|
|
|
|
+ mTaskbarCornerRoundness.value
|
|
|
|
|
+ " -> " + cornerRoundness + ": " + duration);
|
|
|
|
|
}
|
|
|
|
|
animatorSet.play(mTaskbarCornerRoundness.animateToValue(cornerRoundness));
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-22 14:26:25 +01:00
|
|
|
// Keep isUnlockTransition in sync with its counterpart in
|
|
|
|
|
// TaskbarStashController#createAnimToIsStashed.
|
|
|
|
|
boolean isUnlockTransition =
|
|
|
|
|
hasAnyFlag(changedFlags, FLAG_DEVICE_LOCKED) && !hasAnyFlag(FLAG_DEVICE_LOCKED);
|
|
|
|
|
if (isUnlockTransition) {
|
|
|
|
|
// When transitioning to unlocked, ensure the hotseat is fully visible from the
|
|
|
|
|
// beginning. The hotseat itself is animated by LauncherUnlockAnimationController.
|
2023-03-17 14:46:29 +01:00
|
|
|
mIconAlignment.cancelAnimation();
|
|
|
|
|
// updateValue ensures onIconAlignmentRatioChanged will be called if there is an actual
|
|
|
|
|
// change in value
|
|
|
|
|
mIconAlignment.updateValue(toAlignment);
|
|
|
|
|
} else if (mIconAlignment.isAnimatingToValue(toAlignment)
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
|| mIconAlignment.isSettledOnValue(toAlignment)) {
|
|
|
|
|
// Already at desired value, but make sure we run the callback at the end.
|
|
|
|
|
animatorSet.addListener(AnimatorListeners.forEndCallback(
|
|
|
|
|
this::onIconAlignmentRatioChanged));
|
|
|
|
|
} else {
|
|
|
|
|
mIconAlignment.cancelAnimation();
|
|
|
|
|
ObjectAnimator iconAlignAnim = mIconAlignment
|
|
|
|
|
.animateToValue(toAlignment)
|
|
|
|
|
.setDuration(duration);
|
|
|
|
|
if (DEBUG) {
|
|
|
|
|
Log.d(TAG, "onStateChangeApplied - iconAlignment - "
|
|
|
|
|
+ mIconAlignment.value
|
|
|
|
|
+ " -> " + toAlignment + ": " + duration);
|
|
|
|
|
}
|
|
|
|
|
animatorSet.play(iconAlignAnim);
|
|
|
|
|
}
|
2022-10-31 18:17:03 +00:00
|
|
|
|
2022-06-09 15:09:26 +01:00
|
|
|
animatorSet.setInterpolator(EMPHASIZED);
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
|
2021-11-08 00:48:53 -08:00
|
|
|
if (start) {
|
|
|
|
|
animatorSet.start();
|
|
|
|
|
}
|
|
|
|
|
return animatorSet;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-02 15:39:33 +01:00
|
|
|
/**
|
|
|
|
|
* Whether the taskbar is aligned with the hotseat in the current/target launcher state.
|
|
|
|
|
*
|
|
|
|
|
* This refers to the intended state - a transition to this state might be in progress.
|
|
|
|
|
*/
|
|
|
|
|
public boolean isTaskbarAlignedWithHotseat() {
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
return mLauncherState.isTaskbarAlignedWithHotseat(mLauncher);
|
2021-12-01 15:55:04 -08:00
|
|
|
}
|
|
|
|
|
|
2022-10-26 10:29:46 -07:00
|
|
|
/**
|
|
|
|
|
* Returns if icons should be aligned to hotseat in the current transition
|
|
|
|
|
*/
|
|
|
|
|
public boolean isIconAlignedWithHotseat() {
|
|
|
|
|
if (isInLauncher()) {
|
|
|
|
|
boolean isInStashedState = mLauncherState.isTaskbarStashed(mLauncher);
|
|
|
|
|
boolean willStashVisually = isInStashedState
|
|
|
|
|
&& mControllers.taskbarStashController.supportsVisualStashing();
|
|
|
|
|
boolean isTaskbarAlignedWithHotseat =
|
|
|
|
|
mLauncherState.isTaskbarAlignedWithHotseat(mLauncher);
|
|
|
|
|
return isTaskbarAlignedWithHotseat && !willStashVisually;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-08 15:43:29 +00:00
|
|
|
/**
|
|
|
|
|
* Returns if the current Launcher state has hotseat on top of other elemnets.
|
|
|
|
|
*/
|
|
|
|
|
public boolean isInHotseatOnTopStates() {
|
|
|
|
|
return mLauncherState != LauncherState.ALL_APPS;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-04 01:42:26 +00:00
|
|
|
boolean isInOverview() {
|
|
|
|
|
return mLauncherState == LauncherState.OVERVIEW;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-24 15:43:52 -08:00
|
|
|
private void playStateTransitionAnim(AnimatorSet animatorSet, long duration,
|
|
|
|
|
boolean committed) {
|
|
|
|
|
boolean isInStashedState = mLauncherState.isTaskbarStashed(mLauncher);
|
2022-06-23 11:25:10 -07:00
|
|
|
TaskbarStashController stashController = mControllers.taskbarStashController;
|
|
|
|
|
stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, isInStashedState);
|
2023-01-12 16:09:24 -08:00
|
|
|
Animator stashAnimator = stashController.createApplyStateAnimator(duration);
|
2021-11-08 00:48:53 -08:00
|
|
|
if (stashAnimator != null) {
|
|
|
|
|
stashAnimator.addListener(new AnimatorListenerAdapter() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
2021-11-24 15:43:52 -08:00
|
|
|
if (isInStashedState && committed) {
|
2021-11-08 00:48:53 -08:00
|
|
|
// Reset hotseat alpha to default
|
2023-01-30 19:29:45 +00:00
|
|
|
Log.d("b/260135164",
|
|
|
|
|
"playStateTransitionAnim#onAnimationEnd - setIconsAlpha(1)");
|
2021-11-08 00:48:53 -08:00
|
|
|
mLauncher.getHotseat().setIconsAlpha(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationStart(Animator animation) {
|
2021-12-02 12:26:34 -08:00
|
|
|
if (mLauncher.getHotseat().getIconsAlpha() > 0) {
|
2022-09-13 14:40:48 -07:00
|
|
|
updateIconAlphaForHome(mLauncher.getHotseat().getIconsAlpha());
|
2021-12-02 12:26:34 -08:00
|
|
|
}
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
animatorSet.play(stashAnimator);
|
|
|
|
|
}
|
2023-02-25 00:10:45 +00:00
|
|
|
|
2023-03-22 11:13:08 -07:00
|
|
|
// Translate back to 0 at a shorter or same duration as the icon alignment animation.
|
|
|
|
|
// This ensures there is no jump after switching to hotseat, e.g. when swiping up from
|
|
|
|
|
// overview to home. When not in app, we do duration / 2 just to make it feel snappier.
|
|
|
|
|
long resetDuration = mControllers.taskbarStashController.isInApp()
|
|
|
|
|
? duration
|
|
|
|
|
: duration / 2;
|
2023-04-12 13:28:36 -07:00
|
|
|
if (!mControllers.taskbarTranslationController.willAnimateToZeroBefore(resetDuration)
|
2023-04-12 13:24:04 -07:00
|
|
|
&& (isAnimatingToLauncher() || mLauncherState == LauncherState.NORMAL)) {
|
2023-02-25 00:10:45 +00:00
|
|
|
animatorSet.play(mControllers.taskbarTranslationController
|
2023-03-22 11:13:08 -07:00
|
|
|
.createAnimToResetTranslation(resetDuration));
|
2023-02-25 00:10:45 +00:00
|
|
|
}
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 15:39:33 +01:00
|
|
|
/** Whether the launcher is considered active. */
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
private boolean isInLauncher() {
|
2023-03-28 16:08:57 +02:00
|
|
|
if (hasAnyFlag(FLAG_AWAKE)) {
|
2023-03-02 15:39:33 +01:00
|
|
|
return hasAnyFlag(FLAGS_LAUNCHER_ACTIVE);
|
|
|
|
|
} else {
|
2023-03-28 16:08:57 +02:00
|
|
|
return hasAnyFlag(FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE);
|
2023-03-02 15:39:33 +01:00
|
|
|
}
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|
|
|
|
|
|
2023-02-14 21:02:25 -08:00
|
|
|
/**
|
|
|
|
|
* Resets and updates the icon alignment.
|
|
|
|
|
*/
|
|
|
|
|
protected void resetIconAlignment() {
|
|
|
|
|
mIconAlignment.finishAnimation();
|
|
|
|
|
onIconAlignmentRatioChanged();
|
|
|
|
|
}
|
|
|
|
|
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
private void onIconAlignmentRatioChanged() {
|
2022-04-06 17:29:09 +00:00
|
|
|
float currentValue = mIconAlphaForHome.getValue();
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
boolean taskbarWillBeVisible = mIconAlignment.value < 1;
|
2022-04-06 17:29:09 +00:00
|
|
|
boolean firstFrameVisChanged = (taskbarWillBeVisible && Float.compare(currentValue, 1) != 0)
|
|
|
|
|
|| (!taskbarWillBeVisible && Float.compare(currentValue, 0) != 0);
|
|
|
|
|
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
mControllers.taskbarViewController.setLauncherIconAlignment(
|
2022-10-26 10:29:46 -07:00
|
|
|
mIconAlignment.value, mLauncher.getDeviceProfile());
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
mControllers.navbarButtonsViewController.updateTaskbarAlignment(mIconAlignment.value);
|
|
|
|
|
// Switch taskbar and hotseat in last frame
|
2022-09-13 14:40:48 -07:00
|
|
|
updateIconAlphaForHome(taskbarWillBeVisible ? 1 : 0);
|
2022-05-20 13:32:10 +01:00
|
|
|
|
2022-04-06 17:29:09 +00:00
|
|
|
// Sync the first frame where we swap taskbar and hotseat.
|
2023-03-02 19:45:23 +00:00
|
|
|
if (firstFrameVisChanged && mCanSyncViews && !Utilities.isRunningInTestHarness()) {
|
2022-04-06 17:29:09 +00:00
|
|
|
ViewRootSync.synchronizeNextDraw(mLauncher.getHotseat(),
|
|
|
|
|
mControllers.taskbarActivityContext.getDragLayer(),
|
2023-03-02 15:39:33 +01:00
|
|
|
() -> {
|
|
|
|
|
});
|
2022-04-06 17:29:09 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-13 14:40:48 -07:00
|
|
|
private void updateIconAlphaForHome(float alpha) {
|
2023-02-16 18:56:13 +00:00
|
|
|
if (mControllers.taskbarActivityContext.isDestroyed()) {
|
|
|
|
|
Log.e("b/260135164", "updateIconAlphaForHome is called after Taskbar is destroyed",
|
|
|
|
|
new Exception());
|
2023-02-28 12:46:50 +00:00
|
|
|
return;
|
2023-02-16 18:56:13 +00:00
|
|
|
}
|
2022-09-13 14:40:48 -07:00
|
|
|
mIconAlphaForHome.setValue(alpha);
|
2022-11-08 15:43:29 +00:00
|
|
|
boolean hotseatVisible = alpha == 0
|
|
|
|
|
|| (!mControllers.uiController.isHotseatIconOnTopWhenAligned()
|
|
|
|
|
&& mIconAlignment.value > 0);
|
2022-09-13 14:40:48 -07:00
|
|
|
/*
|
|
|
|
|
* Hide Launcher Hotseat icons when Taskbar icons have opacity. Both icon sets
|
|
|
|
|
* should not be visible at the same time.
|
|
|
|
|
*/
|
2023-01-30 19:29:45 +00:00
|
|
|
Log.d("b/260135164",
|
|
|
|
|
"updateIconAlphaForHome - setIconsAlpha(" + (hotseatVisible ? 1 : 0)
|
|
|
|
|
+ "), isTaskbarPresent: " + mLauncher.getDeviceProfile().isTaskbarPresent);
|
2022-11-08 15:43:29 +00:00
|
|
|
mLauncher.getHotseat().setIconsAlpha(hotseatVisible ? 1 : 0);
|
2023-03-16 17:26:14 -07:00
|
|
|
if (mIsQsbInline) {
|
|
|
|
|
mLauncher.getHotseat().setQsbAlpha(hotseatVisible ? 1 : 0);
|
|
|
|
|
}
|
2022-09-13 14:40:48 -07:00
|
|
|
}
|
|
|
|
|
|
2021-11-08 00:48:53 -08:00
|
|
|
private final class TaskBarRecentsAnimationListener implements
|
|
|
|
|
RecentsAnimationCallbacks.RecentsAnimationListener {
|
|
|
|
|
private final RecentsAnimationCallbacks mCallbacks;
|
|
|
|
|
|
|
|
|
|
TaskBarRecentsAnimationListener(RecentsAnimationCallbacks callbacks) {
|
|
|
|
|
mCallbacks = callbacks;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onRecentsAnimationCanceled(HashMap<Integer, ThumbnailData> thumbnailDatas) {
|
2022-04-07 11:40:36 -07:00
|
|
|
boolean isInOverview = mLauncher.isInState(LauncherState.OVERVIEW);
|
|
|
|
|
endGestureStateOverride(!isInOverview);
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onRecentsAnimationFinished(RecentsAnimationController controller) {
|
|
|
|
|
endGestureStateOverride(!controller.getFinishTargetIsLauncher());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void endGestureStateOverride(boolean finishedToApp) {
|
|
|
|
|
mCallbacks.removeListener(this);
|
2022-03-28 23:58:36 -07:00
|
|
|
mTaskBarRecentsAnimationListener = null;
|
2022-06-13 12:09:35 -07:00
|
|
|
((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchListener(null);
|
2021-12-01 15:08:23 -08:00
|
|
|
|
|
|
|
|
// Update the resumed state immediately to ensure a seamless handoff
|
|
|
|
|
boolean launcherResumed = !finishedToApp;
|
2023-03-02 15:39:33 +01:00
|
|
|
updateStateForFlag(FLAG_TRANSITION_TO_RESUMED, false);
|
2021-12-01 15:08:23 -08:00
|
|
|
updateStateForFlag(FLAG_RESUMED, launcherResumed);
|
2021-11-08 00:48:53 -08:00
|
|
|
applyState();
|
2021-12-01 15:08:23 -08:00
|
|
|
|
2021-11-08 00:48:53 -08:00
|
|
|
TaskbarStashController controller = mControllers.taskbarStashController;
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
if (DEBUG) {
|
|
|
|
|
Log.d(TAG, "endGestureStateOverride - FLAG_IN_APP: " + finishedToApp);
|
|
|
|
|
}
|
2021-11-08 00:48:53 -08:00
|
|
|
controller.updateStateForFlag(FLAG_IN_APP, finishedToApp);
|
|
|
|
|
controller.applyState();
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-07 12:49:56 -08:00
|
|
|
|
|
|
|
|
private static String getStateString(int flags) {
|
2023-03-02 15:39:33 +01:00
|
|
|
StringJoiner result = new StringJoiner("|");
|
|
|
|
|
appendFlag(result, flags, FLAG_RESUMED, "resumed");
|
|
|
|
|
appendFlag(result, flags, FLAG_TRANSITION_TO_RESUMED, "transition_to_resumed");
|
|
|
|
|
appendFlag(result, flags, FLAG_LAUNCHER_IN_STATE_TRANSITION,
|
|
|
|
|
"launcher_in_state_transition");
|
2023-03-28 16:08:57 +02:00
|
|
|
appendFlag(result, flags, FLAG_AWAKE, "awake");
|
|
|
|
|
appendFlag(result, flags, FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE,
|
|
|
|
|
"was_active_while_awake");
|
2023-03-17 14:46:29 +01:00
|
|
|
appendFlag(result, flags, FLAG_DEVICE_LOCKED, "device_locked");
|
2023-03-02 15:39:33 +01:00
|
|
|
return result.toString();
|
2022-03-07 12:49:56 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void dumpLogs(String prefix, PrintWriter pw) {
|
|
|
|
|
pw.println(prefix + "TaskbarLauncherStateController:");
|
|
|
|
|
pw.println(String.format(
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
"%s\tmIconAlignment=%.2f",
|
2022-03-07 12:49:56 -08:00
|
|
|
prefix,
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
mIconAlignment.value));
|
2022-03-07 12:49:56 -08:00
|
|
|
pw.println(String.format(
|
|
|
|
|
"%s\tmTaskbarBackgroundAlpha=%.2f", prefix, mTaskbarBackgroundAlpha.value));
|
|
|
|
|
pw.println(String.format(
|
|
|
|
|
"%s\tmIconAlphaForHome=%.2f", prefix, mIconAlphaForHome.getValue()));
|
|
|
|
|
pw.println(String.format("%s\tmPrevState=%s", prefix, getStateString(mPrevState)));
|
|
|
|
|
pw.println(String.format("%s\tmState=%s", prefix, getStateString(mState)));
|
|
|
|
|
pw.println(String.format("%s\tmLauncherState=%s", prefix, mLauncherState));
|
|
|
|
|
pw.println(String.format(
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
"%s\tmIsAnimatingToLauncher=%b",
|
2022-03-07 12:49:56 -08:00
|
|
|
prefix,
|
Refactor TaskbarLauncherStateController to use a single AnimatedFLoat
- Use a single iconAlignment animation
- Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING
- iconAlignment is now centralized in onStateChangeApplied with single source of truth
Bug: 245320601
Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App
Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there
Test: App->Overview->Select->Home->App
Test: QuickSwitch -> App
Test: Repeat above with taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c
2022-09-30 18:14:33 +01:00
|
|
|
mIsAnimatingToLauncher));
|
2022-03-07 12:49:56 -08:00
|
|
|
pw.println(String.format(
|
|
|
|
|
"%s\tmShouldDelayLauncherStateAnim=%b", prefix, mShouldDelayLauncherStateAnim));
|
|
|
|
|
}
|
2021-11-08 00:48:53 -08:00
|
|
|
}
|