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;
|
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.annotation.ColorInt;
|
|
|
|
|
import android.os.RemoteException;
|
|
|
|
|
import android.util.Log;
|
2022-03-24 14:47:32 -07:00
|
|
|
import android.util.SparseArray;
|
2021-10-05 01:11:08 +02:00
|
|
|
import android.view.TaskTransitionSpec;
|
|
|
|
|
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;
|
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
|
|
|
import com.android.launcher3.config.FeatureFlags;
|
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;
|
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;
|
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
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
private final SparseArray<Float> mTaskbarInAppDisplayProgress = new SparseArray<>(4);
|
|
|
|
|
|
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-07-22 14:28:04 -10:00
|
|
|
private AnimatedFloat mTaskbarOverrideBackgroundAlpha;
|
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-07-22 14:28:04 -10:00
|
|
|
mTaskbarOverrideBackgroundAlpha = mControllers.taskbarDragLayerController
|
|
|
|
|
.getOverrideBackgroundAlpha();
|
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) {
|
2022-11-07 13:50:49 -08:00
|
|
|
AnimatorSet set = new AnimatorSet();
|
|
|
|
|
Animator taskbarState = mTaskbarLauncherStateController
|
|
|
|
|
.createAnimToLauncher(toState, callbacks, duration);
|
|
|
|
|
long halfDuration = Math.round(duration * 0.5f);
|
|
|
|
|
Animator translation =
|
|
|
|
|
mControllers.taskbarTranslationController.createAnimToLauncher(halfDuration);
|
|
|
|
|
|
|
|
|
|
set.playTogether(taskbarState, translation);
|
|
|
|
|
return set;
|
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
|
|
|
|
|
@ColorInt int taskAnimationBackgroundColor =
|
2022-10-20 13:15:19 -07:00
|
|
|
DisplayController.isTransientTaskbar(mLauncher)
|
|
|
|
|
? mLauncher.getColor(R.color.transient_taskbar_background)
|
|
|
|
|
: mLauncher.getColor(R.color.taskbar_background);
|
2021-10-05 01:11:08 +02:00
|
|
|
|
|
|
|
|
TaskTransitionSpec customTaskAnimationSpec = new TaskTransitionSpec(
|
|
|
|
|
taskAnimationBackgroundColor,
|
|
|
|
|
Set.of(ITYPE_EXTRA_NAVIGATION_BAR)
|
|
|
|
|
);
|
|
|
|
|
WindowManagerGlobal.getWindowManagerService()
|
|
|
|
|
.setTaskTransitionSpec(customTaskAnimationSpec);
|
|
|
|
|
}
|
|
|
|
|
} 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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets whether the background behind the taskbar/nav bar should be hidden.
|
|
|
|
|
*/
|
|
|
|
|
public void forceHideBackground(boolean forceHide) {
|
|
|
|
|
mTaskbarOverrideBackgroundAlpha.updateValue(forceHide ? 0 : 1);
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-30 16:00:20 -10:00
|
|
|
/**
|
|
|
|
|
* Starts the taskbar education flow, if the user hasn't seen it yet.
|
|
|
|
|
*/
|
|
|
|
|
public void showEdu() {
|
2022-01-25 10:09:44 +00:00
|
|
|
if (!shouldShowEdu()) {
|
2021-07-30 16:00:20 -10:00
|
|
|
return;
|
|
|
|
|
}
|
2021-08-04 13:56:43 -10:00
|
|
|
mLauncher.getOnboardingPrefs().markChecked(OnboardingPrefs.TASKBAR_EDU_SEEN);
|
2021-07-30 16:00:20 -10:00
|
|
|
|
|
|
|
|
mControllers.taskbarEduController.showEdu();
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-25 10:09:44 +00:00
|
|
|
/**
|
|
|
|
|
* Whether the taskbar education should be shown.
|
|
|
|
|
*/
|
|
|
|
|
public boolean shouldShowEdu() {
|
2022-02-16 17:42:21 -08:00
|
|
|
return !Utilities.IS_RUNNING_IN_TEST_HARNESS
|
2022-01-25 10:09:44 +00:00
|
|
|
&& !mLauncher.getOnboardingPrefs().getBoolean(OnboardingPrefs.TASKBAR_EDU_SEEN);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-30 14:15:56 -07:00
|
|
|
@Override
|
2022-01-24 22:54:21 -05:00
|
|
|
public void onTaskbarIconLaunched(ItemInfo 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
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setSystemGestureInProgress(boolean inProgress) {
|
|
|
|
|
super.setSystemGestureInProgress(inProgress);
|
2022-10-20 13:15:19 -07:00
|
|
|
if (DisplayController.isTransientTaskbar(mLauncher)) {
|
|
|
|
|
forceHideBackground(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
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
|
|
|
if (!FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) {
|
|
|
|
|
// Launcher's ScrimView will draw the background throughout the gesture. But once the
|
|
|
|
|
// gesture ends, start drawing taskbar's background again since launcher might stop
|
|
|
|
|
// drawing.
|
|
|
|
|
forceHideBackground(inProgress);
|
|
|
|
|
}
|
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-07 12:49:56 -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) {
|
|
|
|
|
if (mControllers == null) {
|
|
|
|
|
// This method can be called before init() is called.
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
mTaskbarInAppDisplayProgress.put(progressIndex, progress);
|
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()
|
|
|
|
|
* getInAppDisplayProgress());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Returns true iff any in-app display progress > 0. */
|
|
|
|
|
public boolean shouldUseInAppLayout() {
|
|
|
|
|
return getInAppDisplayProgress() > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private float getInAppDisplayProgress(int index) {
|
|
|
|
|
if (!mTaskbarInAppDisplayProgress.contains(index)) {
|
|
|
|
|
mTaskbarInAppDisplayProgress.put(index, 0f);
|
|
|
|
|
}
|
|
|
|
|
return mTaskbarInAppDisplayProgress.get(index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private float getInAppDisplayProgress() {
|
|
|
|
|
return Stream.of(
|
|
|
|
|
getInAppDisplayProgress(MINUS_ONE_PAGE_PROGRESS_INDEX),
|
|
|
|
|
getInAppDisplayProgress(ALL_APPS_PAGE_PROGRESS_INDEX),
|
|
|
|
|
getInAppDisplayProgress(WIDGETS_PAGE_PROGRESS_INDEX),
|
|
|
|
|
getInAppDisplayProgress(SYSUI_SURFACE_PROGRESS_INDEX))
|
|
|
|
|
.max(Float::compareTo)
|
|
|
|
|
.get();
|
|
|
|
|
}
|
|
|
|
|
|
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()
|
|
|
|
|
&& getInAppDisplayProgress(MINUS_ONE_PAGE_PROGRESS_INDEX) == 0;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-07 12:49:56 -08:00
|
|
|
@Override
|
|
|
|
|
public void dumpLogs(String prefix, PrintWriter pw) {
|
|
|
|
|
super.dumpLogs(prefix, pw);
|
|
|
|
|
|
|
|
|
|
pw.println(String.format(
|
|
|
|
|
"%s\tmTaskbarOverrideBackgroundAlpha=%.2f",
|
|
|
|
|
prefix,
|
|
|
|
|
mTaskbarOverrideBackgroundAlpha.value));
|
|
|
|
|
|
2022-03-24 14:47:32 -07:00
|
|
|
pw.println(String.format("%s\tTaskbar in-app display progress:", prefix));
|
|
|
|
|
if (mControllers == null) {
|
|
|
|
|
pw.println(String.format("%s\t\tMissing mControllers", prefix));
|
|
|
|
|
} else {
|
|
|
|
|
pw.println(String.format(
|
|
|
|
|
"%s\t\tprogress at MINUS_ONE_PAGE_PROGRESS_INDEX=%.2f",
|
|
|
|
|
prefix,
|
|
|
|
|
getInAppDisplayProgress(MINUS_ONE_PAGE_PROGRESS_INDEX)));
|
|
|
|
|
pw.println(String.format(
|
|
|
|
|
"%s\t\tprogress at ALL_APPS_PAGE_PROGRESS_INDEX=%.2f",
|
|
|
|
|
prefix,
|
|
|
|
|
getInAppDisplayProgress(ALL_APPS_PAGE_PROGRESS_INDEX)));
|
|
|
|
|
pw.println(String.format(
|
|
|
|
|
"%s\t\tprogress at WIDGETS_PAGE_PROGRESS_INDEX=%.2f",
|
|
|
|
|
prefix,
|
|
|
|
|
getInAppDisplayProgress(WIDGETS_PAGE_PROGRESS_INDEX)));
|
|
|
|
|
pw.println(String.format(
|
|
|
|
|
"%s\t\tprogress at SYSUI_SURFACE_PROGRESS_INDEX=%.2f",
|
|
|
|
|
prefix,
|
|
|
|
|
getInAppDisplayProgress(SYSUI_SURFACE_PROGRESS_INDEX)));
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-07 12:49:56 -08:00
|
|
|
mTaskbarLauncherStateController.dumpLogs(prefix + "\t", pw);
|
|
|
|
|
}
|
2022-11-02 22:24:33 -07:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RecentsView getRecentsView() {
|
|
|
|
|
return mLauncher.getOverviewPanel();
|
|
|
|
|
}
|
2020-12-22 12:40:09 -06:00
|
|
|
}
|