2020-12-22 12:40:09 -06: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;
|
|
|
|
|
|
2022-09-09 23:23:35 +00:00
|
|
|
import static android.view.InsetsState.ITYPE_EXTRA_NAVIGATION_BAR;
|
|
|
|
|
|
2022-11-14 12:28:20 -08:00
|
|
|
import static com.android.launcher3.QuickstepTransitionManager.TRANSIENT_TASKBAR_TRANSITION_DURATION;
|
2022-12-21 03:23:32 +00:00
|
|
|
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_EDU_TOOLTIP;
|
|
|
|
|
import static com.android.launcher3.taskbar.TaskbarEduTooltipControllerKt.TOOLTIP_STEP_FEATURES;
|
2021-11-08 00:48:53 -08:00
|
|
|
import static com.android.launcher3.taskbar.TaskbarLauncherStateController.FLAG_RESUMED;
|
2022-08-29 21:35:56 +00:00
|
|
|
import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS;
|
2021-05-25 14:35:01 -07:00
|
|
|
|
2020-12-23 16:12:18 -06:00
|
|
|
import android.animation.Animator;
|
2022-05-11 10:27:30 -07:00
|
|
|
import android.animation.AnimatorSet;
|
2021-10-05 01:11:08 +02:00
|
|
|
import android.os.RemoteException;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
import android.view.TaskTransitionSpec;
|
2023-01-24 15:05:08 -08:00
|
|
|
import android.view.View;
|
2021-10-05 01:11:08 +02:00
|
|
|
import android.view.WindowManagerGlobal;
|
2020-12-22 12:40:09 -06:00
|
|
|
|
2021-05-25 14:35:01 -07:00
|
|
|
import androidx.annotation.NonNull;
|
2022-05-11 10:27:30 -07:00
|
|
|
import androidx.annotation.Nullable;
|
2020-12-23 16:12:18 -06:00
|
|
|
|
2021-07-22 14:28:04 -10:00
|
|
|
import com.android.launcher3.DeviceProfile;
|
2020-12-23 16:12:18 -06:00
|
|
|
import com.android.launcher3.LauncherState;
|
2021-03-07 15:09:11 -08:00
|
|
|
import com.android.launcher3.QuickstepTransitionManager;
|
2021-10-05 01:11:08 +02:00
|
|
|
import com.android.launcher3.R;
|
2021-09-07 12:48:43 -07:00
|
|
|
import com.android.launcher3.Utilities;
|
2022-12-08 13:00:21 -08:00
|
|
|
import com.android.launcher3.anim.AnimatedFloat;
|
2021-08-30 14:15:56 -07:00
|
|
|
import com.android.launcher3.logging.InstanceId;
|
|
|
|
|
import com.android.launcher3.logging.InstanceIdSequence;
|
2022-01-24 22:54:21 -05:00
|
|
|
import com.android.launcher3.model.data.ItemInfo;
|
2022-08-18 09:51:07 -07:00
|
|
|
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
2022-10-20 13:15:19 -07:00
|
|
|
import com.android.launcher3.util.DisplayController;
|
2023-01-12 16:02:12 -08:00
|
|
|
import com.android.launcher3.util.MultiPropertyFactory;
|
2021-08-04 13:56:43 -10:00
|
|
|
import com.android.launcher3.util.OnboardingPrefs;
|
2021-06-15 14:49:28 -07:00
|
|
|
import com.android.quickstep.RecentsAnimationCallbacks;
|
2023-01-24 15:05:08 -08:00
|
|
|
import com.android.quickstep.util.GroupTask;
|
2022-11-02 22:24:33 -07:00
|
|
|
import com.android.quickstep.views.RecentsView;
|
2021-05-25 14:35:01 -07:00
|
|
|
|
2022-03-07 12:49:56 -08:00
|
|
|
import java.io.PrintWriter;
|
2021-10-05 01:11:08 +02:00
|
|
|
import java.util.Set;
|
2021-08-24 10:56:31 -07:00
|
|
|
|
2020-12-22 12:40:09 -06:00
|
|
|
/**
|
2021-05-20 20:18:47 +00:00
|
|
|
* A data source which integrates with a Launcher instance
|
2020-12-22 12:40:09 -06:00
|
|
|
*/
|
2021-05-20 20:18:47 +00:00
|
|
|
public class LauncherTaskbarUIController extends TaskbarUIController {
|
2021-04-16 12:50:22 -07:00
|
|
|
|
2021-10-05 01:11:08 +02:00
|
|
|
private static final String TAG = "TaskbarUIController";
|
|
|
|
|
|
2022-03-24 14:47:32 -07:00
|
|
|
public static final int MINUS_ONE_PAGE_PROGRESS_INDEX = 0;
|
|
|
|
|
public static final int ALL_APPS_PAGE_PROGRESS_INDEX = 1;
|
|
|
|
|
public static final int WIDGETS_PAGE_PROGRESS_INDEX = 2;
|
|
|
|
|
public static final int SYSUI_SURFACE_PROGRESS_INDEX = 3;
|
|
|
|
|
|
2023-01-12 16:02:12 -08:00
|
|
|
private static final int DISPLAY_PROGRESS_COUNT = 4;
|
|
|
|
|
|
|
|
|
|
private final AnimatedFloat mTaskbarInAppDisplayProgress = new AnimatedFloat();
|
|
|
|
|
private final MultiPropertyFactory<AnimatedFloat> mTaskbarInAppDisplayProgressMultiProp =
|
|
|
|
|
new MultiPropertyFactory<>(mTaskbarInAppDisplayProgress,
|
|
|
|
|
AnimatedFloat.VALUE, DISPLAY_PROGRESS_COUNT, Float::max);
|
2022-03-24 14:47:32 -07:00
|
|
|
|
2022-08-18 09:51:07 -07:00
|
|
|
private final QuickstepLauncher mLauncher;
|
2020-12-22 12:40:09 -06:00
|
|
|
|
2021-07-22 14:28:04 -10:00
|
|
|
private final DeviceProfile.OnDeviceProfileChangeListener mOnDeviceProfileChangeListener =
|
2022-03-07 12:49:56 -08:00
|
|
|
dp -> {
|
|
|
|
|
onStashedInAppChanged(dp);
|
|
|
|
|
if (mControllers != null && mControllers.taskbarViewController != null) {
|
|
|
|
|
mControllers.taskbarViewController.onRotationChanged(dp);
|
|
|
|
|
}
|
|
|
|
|
};
|
2021-07-22 14:28:04 -10:00
|
|
|
|
2021-06-01 16:54:07 -07:00
|
|
|
// Initialized in init.
|
2021-06-04 15:35:46 -07:00
|
|
|
private TaskbarKeyguardController mKeyguardController;
|
2021-11-08 00:48:53 -08:00
|
|
|
private final TaskbarLauncherStateController
|
|
|
|
|
mTaskbarLauncherStateController = new TaskbarLauncherStateController();
|
2021-09-30 10:14:34 -07:00
|
|
|
|
2022-08-18 09:51:07 -07:00
|
|
|
public LauncherTaskbarUIController(QuickstepLauncher launcher) {
|
2020-12-22 12:40:09 -06:00
|
|
|
mLauncher = launcher;
|
2021-05-20 20:18:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2021-06-08 20:03:43 -07:00
|
|
|
protected void init(TaskbarControllers taskbarControllers) {
|
Stash taskbar when IME is present, including during gestures
- SysUI removes SYSUI_STATE_IME_SHOWING when starting a gesture from an app, but because unstashing has implications on the gesture transition (e.g. clips the bottom of the app), we defer handling the ime hiding until the gesture settles. Repurposed the flow that swaps the taskbar background during the gesture to support this case as well.
- Delay the unstash when IME is closing, to align with the end of the IME exit transition
- Remove TaskbarViewController.ALPHA_INDEX_IME now that we stash when IME is opening, since stashing already hides the taskbar icons
- Also support passing a starting progress to the stashed handle reveal animation, to allow it to be reversed when cancelled. For example, when returning to an app that has IME showing, we first start unstashing because we're in an app, but then we get the signal that IME is attached so we stash again almost immediately (within a frame or two).
Test: In both 3 button and fully gestural, open a keyboard in an app, ensure taskbar gets out of the way and then reappears at the end when the keyboard is dismissed
Bug: 202511986
Change-Id: I93c298a98ba369ea6310466ff3f802231c582687
2021-11-16 17:38:36 -08:00
|
|
|
super.init(taskbarControllers);
|
2021-06-01 16:54:07 -07:00
|
|
|
|
2021-11-08 00:48:53 -08:00
|
|
|
mTaskbarLauncherStateController.init(mControllers, mLauncher);
|
2021-06-01 16:54:07 -07:00
|
|
|
|
2021-05-20 20:18:47 +00:00
|
|
|
mLauncher.setTaskbarUIController(this);
|
2021-06-04 15:35:46 -07:00
|
|
|
mKeyguardController = taskbarControllers.taskbarKeyguardController;
|
2021-06-17 15:18:15 -07:00
|
|
|
|
2021-09-28 15:09:25 -07:00
|
|
|
onLauncherResumedOrPaused(mLauncher.hasBeenResumed(), true /* fromInit */);
|
2021-07-22 14:28:04 -10:00
|
|
|
|
|
|
|
|
onStashedInAppChanged(mLauncher.getDeviceProfile());
|
|
|
|
|
mLauncher.addOnDeviceProfileChangeListener(mOnDeviceProfileChangeListener);
|
2022-03-07 12:49:56 -08:00
|
|
|
}
|
|
|
|
|
|
2021-05-20 20:18:47 +00:00
|
|
|
@Override
|
|
|
|
|
protected void onDestroy() {
|
2021-11-30 14:37:36 -08:00
|
|
|
super.onDestroy();
|
2021-06-18 12:41:22 -07:00
|
|
|
onLauncherResumedOrPaused(false);
|
2021-11-08 00:48:53 -08:00
|
|
|
mTaskbarLauncherStateController.onDestroy();
|
2021-06-17 15:18:15 -07:00
|
|
|
|
2021-05-20 20:18:47 +00:00
|
|
|
mLauncher.setTaskbarUIController(null);
|
2022-03-07 12:49:56 -08:00
|
|
|
mLauncher.removeOnDeviceProfileChangeListener(mOnDeviceProfileChangeListener);
|
2021-10-05 01:11:08 +02:00
|
|
|
updateTaskTransitionSpec(true);
|
2021-05-20 20:18:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean isTaskbarTouchable() {
|
Taskbar in overview
- Behind ENABLE_TASKBAR_IN_OVERVIEW which is disabled by defualt
- Make taskbar unstashed in overview with background visible
- Ensure taskbar is touchable in overview
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 ENABLE_TASKBAR_IN_OVERVIEW x taskbarStashed on/off
Test: Repeat above with gesture and 3-button
Change-Id: Ib25d68f68e89564851b226536e456d0b2f6306f8
2022-09-30 18:15:56 +01:00
|
|
|
return !(mTaskbarLauncherStateController.isAnimatingToLauncher()
|
|
|
|
|
&& mTaskbarLauncherStateController.goingToAlignedLauncherState());
|
2020-12-23 16:12:18 -06:00
|
|
|
}
|
|
|
|
|
|
2021-12-12 11:16:29 +08:00
|
|
|
public void setShouldDelayLauncherStateAnim(boolean shouldDelayLauncherStateAnim) {
|
|
|
|
|
mTaskbarLauncherStateController.setShouldDelayLauncherStateAnim(
|
|
|
|
|
shouldDelayLauncherStateAnim);
|
|
|
|
|
}
|
2022-02-10 11:10:21 -08:00
|
|
|
|
2022-05-11 10:27:30 -07:00
|
|
|
/**
|
|
|
|
|
* Adds the Launcher resume animator to the given animator set.
|
|
|
|
|
*
|
|
|
|
|
* This should be used to run a Launcher resume animation whose progress matches a
|
|
|
|
|
* swipe progress.
|
|
|
|
|
*
|
|
|
|
|
* @param placeholderDuration a placeholder duration to be used to ensure all full-length
|
|
|
|
|
* sub-animations are properly coordinated. This duration should not
|
|
|
|
|
* actually be used since this animation tracks a swipe progress.
|
|
|
|
|
*/
|
|
|
|
|
protected void addLauncherResumeAnimation(AnimatorSet animation, int placeholderDuration) {
|
|
|
|
|
animation.play(onLauncherResumedOrPaused(
|
|
|
|
|
/* isResumed= */ true,
|
|
|
|
|
/* fromInit= */ false,
|
|
|
|
|
/* startAnimation= */ false,
|
|
|
|
|
placeholderDuration));
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-23 16:12:18 -06:00
|
|
|
/**
|
|
|
|
|
* Should be called from onResume() and onPause(), and animates the Taskbar accordingly.
|
|
|
|
|
*/
|
|
|
|
|
public void onLauncherResumedOrPaused(boolean isResumed) {
|
2021-09-28 15:09:25 -07:00
|
|
|
onLauncherResumedOrPaused(isResumed, false /* fromInit */);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onLauncherResumedOrPaused(boolean isResumed, boolean fromInit) {
|
2022-05-11 10:27:30 -07:00
|
|
|
onLauncherResumedOrPaused(
|
|
|
|
|
isResumed,
|
|
|
|
|
fromInit,
|
|
|
|
|
/* startAnimation= */ true,
|
2022-11-14 12:28:20 -08:00
|
|
|
DisplayController.isTransientTaskbar(mLauncher)
|
|
|
|
|
? TRANSIENT_TASKBAR_TRANSITION_DURATION
|
|
|
|
|
: (!isResumed
|
|
|
|
|
? QuickstepTransitionManager.TASKBAR_TO_APP_DURATION
|
|
|
|
|
: QuickstepTransitionManager.TASKBAR_TO_HOME_DURATION));
|
2022-05-11 10:27:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
|
private Animator onLauncherResumedOrPaused(
|
|
|
|
|
boolean isResumed, boolean fromInit, boolean startAnimation, int duration) {
|
2021-06-04 15:35:46 -07:00
|
|
|
if (mKeyguardController.isScreenOff()) {
|
|
|
|
|
if (!isResumed) {
|
2022-05-11 10:27:30 -07:00
|
|
|
return null;
|
2021-06-04 15:35:46 -07:00
|
|
|
} else {
|
|
|
|
|
// Resuming implicitly means device unlocked
|
|
|
|
|
mKeyguardController.setScreenOn();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-14 00:07:23 +00:00
|
|
|
if (ENABLE_SHELL_TRANSITIONS && isResumed
|
2022-08-29 21:35:56 +00:00
|
|
|
&& !mLauncher.getStateManager().getState().isTaskbarAlignedWithHotseat(mLauncher)) {
|
|
|
|
|
// Launcher is resumed, but in a state where taskbar is still independent, so
|
|
|
|
|
// ignore the state change.
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-08 00:48:53 -08:00
|
|
|
mTaskbarLauncherStateController.updateStateForFlag(FLAG_RESUMED, isResumed);
|
2022-05-11 10:27:30 -07:00
|
|
|
return mTaskbarLauncherStateController.applyState(fromInit ? 0 : duration, startAnimation);
|
2020-12-23 16:12:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-06-15 14:49:28 -07:00
|
|
|
* Create Taskbar animation when going from an app to Launcher as part of recents transition.
|
2020-12-23 16:12:18 -06:00
|
|
|
* @param toState If known, the state we will end up in when reaching Launcher.
|
2021-06-15 14:49:28 -07:00
|
|
|
* @param callbacks callbacks to track the recents animation lifecycle. The state change is
|
|
|
|
|
* automatically reset once the recents animation finishes
|
2020-12-23 16:12:18 -06:00
|
|
|
*/
|
2021-06-15 14:49:28 -07:00
|
|
|
public Animator createAnimToLauncher(@NonNull LauncherState toState,
|
2021-08-04 22:31:08 -07:00
|
|
|
@NonNull RecentsAnimationCallbacks callbacks, long duration) {
|
2023-02-25 00:10:45 +00:00
|
|
|
return mTaskbarLauncherStateController.createAnimToLauncher(toState, callbacks, duration);
|
2020-12-23 16:12:18 -06:00
|
|
|
}
|
|
|
|
|
|
2021-01-22 18:45:04 -08:00
|
|
|
public boolean isDraggingItem() {
|
2021-10-18 16:02:21 -07:00
|
|
|
return mControllers.taskbarDragController.isDragging();
|
2021-01-11 14:54:23 -06:00
|
|
|
}
|
|
|
|
|
|
2021-07-22 14:28:04 -10:00
|
|
|
@Override
|
|
|
|
|
protected void onStashedInAppChanged() {
|
|
|
|
|
onStashedInAppChanged(mLauncher.getDeviceProfile());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onStashedInAppChanged(DeviceProfile deviceProfile) {
|
|
|
|
|
boolean taskbarStashedInApps = mControllers.taskbarStashController.isStashedInApp();
|
|
|
|
|
deviceProfile.isTaskbarPresentInApps = !taskbarStashedInApps;
|
2021-10-05 01:11:08 +02:00
|
|
|
updateTaskTransitionSpec(taskbarStashedInApps);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateTaskTransitionSpec(boolean taskbarIsHidden) {
|
|
|
|
|
try {
|
|
|
|
|
if (taskbarIsHidden) {
|
|
|
|
|
// Clear custom task transition settings when the taskbar is stashed
|
|
|
|
|
WindowManagerGlobal.getWindowManagerService().clearTaskTransitionSpec();
|
|
|
|
|
} else {
|
|
|
|
|
// Adjust task transition spec to account for taskbar being visible
|
2023-02-24 23:43:05 +00:00
|
|
|
WindowManagerGlobal.getWindowManagerService().setTaskTransitionSpec(
|
|
|
|
|
new TaskTransitionSpec(
|
|
|
|
|
mLauncher.getColor(R.color.taskbar_background),
|
|
|
|
|
Set.of(ITYPE_EXTRA_NAVIGATION_BAR)));
|
2021-10-05 01:11:08 +02:00
|
|
|
}
|
|
|
|
|
} catch (RemoteException e) {
|
|
|
|
|
// This shouldn't happen but if it does task animations won't look good until the
|
|
|
|
|
// taskbar stashing state is changed.
|
|
|
|
|
Log.e(TAG, "Failed to update task transition spec to account for new taskbar state",
|
|
|
|
|
e);
|
|
|
|
|
}
|
2021-07-22 14:28:04 -10:00
|
|
|
}
|
|
|
|
|
|
2021-07-30 16:00:20 -10:00
|
|
|
/**
|
2022-12-21 03:23:32 +00:00
|
|
|
* Starts a Taskbar EDU flow, if the user should see one upon launching an application.
|
2021-07-30 16:00:20 -10:00
|
|
|
*/
|
2022-12-21 03:23:32 +00:00
|
|
|
public void showEduOnAppLaunch() {
|
|
|
|
|
if (!shouldShowEduOnAppLaunch()) {
|
2021-07-30 16:00:20 -10:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-21 03:23:32 +00:00
|
|
|
// Transient and persistent bottom sheet.
|
|
|
|
|
if (!ENABLE_TASKBAR_EDU_TOOLTIP.get()) {
|
|
|
|
|
mLauncher.getOnboardingPrefs().markChecked(OnboardingPrefs.TASKBAR_EDU_SEEN);
|
|
|
|
|
mControllers.taskbarEduController.showEdu();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Persistent features EDU tooltip.
|
|
|
|
|
if (!DisplayController.isTransientTaskbar(mLauncher)) {
|
|
|
|
|
mControllers.taskbarEduTooltipController.maybeShowFeaturesEdu();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Transient swipe EDU tooltip.
|
|
|
|
|
mControllers.taskbarEduTooltipController.maybeShowSwipeEdu();
|
2021-07-30 16:00:20 -10:00
|
|
|
}
|
|
|
|
|
|
2022-01-25 10:09:44 +00:00
|
|
|
/**
|
2022-12-21 03:23:32 +00:00
|
|
|
* Returns {@code true} if a Taskbar education should be shown on application launch.
|
2022-01-25 10:09:44 +00:00
|
|
|
*/
|
2022-12-21 03:23:32 +00:00
|
|
|
public boolean shouldShowEduOnAppLaunch() {
|
2023-03-02 19:45:23 +00:00
|
|
|
if (Utilities.isRunningInTestHarness()) {
|
2022-12-21 03:23:32 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Transient and persistent bottom sheet.
|
|
|
|
|
if (!ENABLE_TASKBAR_EDU_TOOLTIP.get()) {
|
|
|
|
|
return !mLauncher.getOnboardingPrefs().getBoolean(OnboardingPrefs.TASKBAR_EDU_SEEN);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Persistent features EDU tooltip.
|
|
|
|
|
if (!DisplayController.isTransientTaskbar(mLauncher)) {
|
|
|
|
|
return !mLauncher.getOnboardingPrefs().hasReachedMaxCount(
|
|
|
|
|
OnboardingPrefs.TASKBAR_EDU_TOOLTIP_STEP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Transient swipe EDU tooltip.
|
|
|
|
|
return mControllers.taskbarEduTooltipController.getTooltipStep() < TOOLTIP_STEP_FEATURES;
|
2022-01-25 10:09:44 +00:00
|
|
|
}
|
|
|
|
|
|
2021-08-30 14:15:56 -07:00
|
|
|
@Override
|
2022-01-24 22:54:21 -05:00
|
|
|
public void onTaskbarIconLaunched(ItemInfo item) {
|
2023-02-08 21:37:40 +00:00
|
|
|
super.onTaskbarIconLaunched(item);
|
2021-08-30 14:15:56 -07:00
|
|
|
InstanceId instanceId = new InstanceIdSequence().newInstanceId();
|
2021-10-18 16:02:21 -07:00
|
|
|
mLauncher.logAppLaunch(mControllers.taskbarActivityContext.getStatsLogManager(), item,
|
|
|
|
|
instanceId);
|
2021-08-30 14:15:56 -07:00
|
|
|
}
|
Stash taskbar when IME is present, including during gestures
- SysUI removes SYSUI_STATE_IME_SHOWING when starting a gesture from an app, but because unstashing has implications on the gesture transition (e.g. clips the bottom of the app), we defer handling the ime hiding until the gesture settles. Repurposed the flow that swaps the taskbar background during the gesture to support this case as well.
- Delay the unstash when IME is closing, to align with the end of the IME exit transition
- Remove TaskbarViewController.ALPHA_INDEX_IME now that we stash when IME is opening, since stashing already hides the taskbar icons
- Also support passing a starting progress to the stashed handle reveal animation, to allow it to be reversed when cancelled. For example, when returning to an app that has IME showing, we first start unstashing because we're in an app, but then we get the signal that IME is attached so we stash again almost immediately (within a frame or two).
Test: In both 3 button and fully gestural, open a keyboard in an app, ensure taskbar gets out of the way and then reappears at the end when the keyboard is dismissed
Bug: 202511986
Change-Id: I93c298a98ba369ea6310466ff3f802231c582687
2021-11-16 17:38:36 -08:00
|
|
|
|
2022-03-24 14:47:32 -07:00
|
|
|
/**
|
|
|
|
|
* Animates Taskbar elements during a transition to a Launcher state that should use in-app
|
|
|
|
|
* layouts.
|
|
|
|
|
*
|
|
|
|
|
* @param progress [0, 1]
|
|
|
|
|
* 0 => use home layout
|
|
|
|
|
* 1 => use in-app layout
|
|
|
|
|
*/
|
|
|
|
|
public void onTaskbarInAppDisplayProgressUpdate(float progress, int progressIndex) {
|
2023-01-12 16:02:12 -08:00
|
|
|
mTaskbarInAppDisplayProgressMultiProp.get(progressIndex).setValue(progress);
|
2022-03-24 14:47:32 -07:00
|
|
|
if (mControllers == null) {
|
|
|
|
|
// This method can be called before init() is called.
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-01-03 18:41:21 +00:00
|
|
|
if (mControllers.uiController.isIconAlignedWithHotseat()
|
2022-03-24 14:47:32 -07:00
|
|
|
&& !mTaskbarLauncherStateController.isAnimatingToLauncher()) {
|
|
|
|
|
// Only animate the nav buttons while home and not animating home, otherwise let
|
|
|
|
|
// the TaskbarViewController handle it.
|
|
|
|
|
mControllers.navbarButtonsViewController
|
|
|
|
|
.getTaskbarNavButtonTranslationYForInAppDisplay()
|
|
|
|
|
.updateValue(mLauncher.getDeviceProfile().getTaskbarOffsetY()
|
2023-01-12 16:02:12 -08:00
|
|
|
* mTaskbarInAppDisplayProgress.value);
|
2022-03-24 14:47:32 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Returns true iff any in-app display progress > 0. */
|
|
|
|
|
public boolean shouldUseInAppLayout() {
|
2023-01-12 16:02:12 -08:00
|
|
|
return mTaskbarInAppDisplayProgress.value > 0;
|
2022-03-24 14:47:32 -07:00
|
|
|
}
|
|
|
|
|
|
2022-07-27 08:06:42 -07:00
|
|
|
@Override
|
|
|
|
|
public void onExpandPip() {
|
|
|
|
|
super.onExpandPip();
|
|
|
|
|
mTaskbarLauncherStateController.updateStateForFlag(FLAG_RESUMED, false);
|
|
|
|
|
mTaskbarLauncherStateController.applyState();
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-26 10:29:46 -07:00
|
|
|
@Override
|
|
|
|
|
public boolean isIconAlignedWithHotseat() {
|
|
|
|
|
return mTaskbarLauncherStateController.isIconAlignedWithHotseat();
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-08 15:43:29 +00:00
|
|
|
@Override
|
|
|
|
|
public boolean isHotseatIconOnTopWhenAligned() {
|
|
|
|
|
return mTaskbarLauncherStateController.isInHotseatOnTopStates()
|
2023-01-12 16:02:12 -08:00
|
|
|
&& mTaskbarInAppDisplayProgressMultiProp.get(MINUS_ONE_PAGE_PROGRESS_INDEX)
|
|
|
|
|
.getValue() == 0;
|
2022-11-08 15:43:29 +00:00
|
|
|
}
|
|
|
|
|
|
2023-01-24 15:05:08 -08:00
|
|
|
@Override
|
2023-03-04 01:42:26 +00:00
|
|
|
protected boolean isInOverview() {
|
|
|
|
|
return mTaskbarLauncherStateController.isInOverview();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2023-01-24 15:05:08 -08:00
|
|
|
public RecentsView getRecentsView() {
|
|
|
|
|
return mLauncher.getOverviewPanel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2023-02-16 09:41:07 -08:00
|
|
|
public void launchSplitTasks(@NonNull View taskView, @NonNull GroupTask groupTask) {
|
2023-01-24 15:05:08 -08:00
|
|
|
mLauncher.launchSplitTasks(taskView, groupTask);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-14 21:02:25 -08:00
|
|
|
@Override
|
|
|
|
|
protected void onIconLayoutBoundsChanged() {
|
|
|
|
|
mTaskbarLauncherStateController.resetIconAlignment();
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-07 12:49:56 -08:00
|
|
|
@Override
|
|
|
|
|
public void dumpLogs(String prefix, PrintWriter pw) {
|
|
|
|
|
super.dumpLogs(prefix, pw);
|
|
|
|
|
|
2022-03-24 14:47:32 -07:00
|
|
|
pw.println(String.format("%s\tTaskbar in-app display progress:", prefix));
|
2023-01-12 16:02:12 -08:00
|
|
|
mTaskbarInAppDisplayProgressMultiProp.dump(
|
|
|
|
|
prefix + "\t",
|
|
|
|
|
pw,
|
|
|
|
|
"mTaskbarInAppDisplayProgressMultiProp",
|
|
|
|
|
"MINUS_ONE_PAGE_PROGRESS_INDEX",
|
|
|
|
|
"ALL_APPS_PAGE_PROGRESS_INDEX",
|
|
|
|
|
"WIDGETS_PAGE_PROGRESS_INDEX",
|
|
|
|
|
"SYSUI_SURFACE_PROGRESS_INDEX");
|
2022-03-24 14:47:32 -07:00
|
|
|
|
2022-03-07 12:49:56 -08:00
|
|
|
mTaskbarLauncherStateController.dumpLogs(prefix + "\t", pw);
|
|
|
|
|
}
|
2020-12-22 12:40:09 -06:00
|
|
|
}
|