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;
|
|
|
|
|
|
2021-11-08 00:48:53 -08:00
|
|
|
import static com.android.launcher3.taskbar.TaskbarLauncherStateController.FLAG_RESUMED;
|
2021-10-05 01:11:08 +02:00
|
|
|
import static com.android.systemui.shared.system.WindowManagerWrapper.ITYPE_EXTRA_NAVIGATION_BAR;
|
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-01-22 18:45:04 -08:00
|
|
|
import android.view.MotionEvent;
|
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;
|
2022-02-10 11:10:21 -08:00
|
|
|
import androidx.annotation.VisibleForTesting;
|
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;
|
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;
|
2021-08-24 10:56:31 -07:00
|
|
|
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
2022-08-18 09:51:07 -07:00
|
|
|
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
2021-08-04 13:56:43 -10:00
|
|
|
import com.android.launcher3.util.OnboardingPrefs;
|
2021-05-25 14:35:01 -07:00
|
|
|
import com.android.quickstep.AnimatedFloat;
|
2021-06-15 14:49:28 -07:00
|
|
|
import com.android.quickstep.RecentsAnimationCallbacks;
|
2021-05-25 14:35:01 -07:00
|
|
|
|
2022-03-07 12:49:56 -08:00
|
|
|
import java.io.PrintWriter;
|
2021-08-24 10:56:31 -07:00
|
|
|
import java.util.Arrays;
|
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() {
|
2021-11-08 00:48:53 -08:00
|
|
|
return !mTaskbarLauncherStateController.isAnimatingToLauncher();
|
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
|
|
|
/**
|
|
|
|
|
* Enables manual taskbar stashing. This method should only be used for tests that need to
|
|
|
|
|
* stash/unstash the taskbar.
|
|
|
|
|
*/
|
|
|
|
|
@VisibleForTesting
|
|
|
|
|
public void enableManualStashingForTests(boolean enableManualStashing) {
|
|
|
|
|
mControllers.taskbarStashController.enableManualStashingForTests(enableManualStashing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Unstashes the Taskbar if it is stashed. This method should only be used to unstash the
|
|
|
|
|
* taskbar at the end of a test.
|
|
|
|
|
*/
|
|
|
|
|
@VisibleForTesting
|
|
|
|
|
public void unstashTaskbarIfStashed() {
|
|
|
|
|
mControllers.taskbarStashController.onLongPressToUnstashTaskbar();
|
|
|
|
|
}
|
|
|
|
|
|
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-06-09 15:09:26 +01:00
|
|
|
!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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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) {
|
2021-11-08 00:48:53 -08:00
|
|
|
return mTaskbarLauncherStateController.createAnimToLauncher(toState, callbacks, duration);
|
2020-12-23 16:12:18 -06:00
|
|
|
}
|
|
|
|
|
|
2021-01-22 18:45:04 -08:00
|
|
|
/**
|
|
|
|
|
* @param ev MotionEvent in screen coordinates.
|
|
|
|
|
* @return Whether any Taskbar item could handle the given MotionEvent if given the chance.
|
|
|
|
|
*/
|
|
|
|
|
public boolean isEventOverAnyTaskbarItem(MotionEvent ev) {
|
2021-10-21 15:31:51 +01:00
|
|
|
return mControllers.taskbarViewController.isEventOverAnyItem(ev)
|
|
|
|
|
|| mControllers.navbarButtonsViewController.isEventOverAnyItem(ev);
|
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 =
|
|
|
|
|
mLauncher.getColor(R.color.taskbar_background);
|
|
|
|
|
|
|
|
|
|
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-08-24 10:56:31 -07:00
|
|
|
@Override
|
|
|
|
|
public Stream<ItemInfoWithIcon> getAppIconsForEdu() {
|
|
|
|
|
return Arrays.stream(mLauncher.getAppsView().getAppsStore().getApps());
|
|
|
|
|
}
|
|
|
|
|
|
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-07-30 16:00:20 -10:00
|
|
|
/**
|
|
|
|
|
* Manually ends the taskbar education flow.
|
|
|
|
|
*/
|
|
|
|
|
public void hideEdu() {
|
|
|
|
|
mControllers.taskbarEduController.hideEdu();
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
// 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);
|
|
|
|
|
}
|
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);
|
|
|
|
|
if (!mControllers.taskbarStashController.isInApp()
|
|
|
|
|
&& !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-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);
|
|
|
|
|
}
|
2020-12-22 12:40:09 -06:00
|
|
|
}
|