mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Merge "Fixes to support transient taskbar in desktop mode" into tm-qpr-dev am: 83a8dad319
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20858638 Change-Id: Ib2e57c5d0e5e13846e240c36c9396588326c19a5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -33,6 +33,7 @@ public class DesktopVisibilityController {
|
||||
|
||||
private boolean mFreeformTasksVisible;
|
||||
private boolean mInOverviewState;
|
||||
private boolean mGestureInProgress;
|
||||
|
||||
public DesktopVisibilityController(Launcher launcher) {
|
||||
mLauncher = launcher;
|
||||
@@ -57,9 +58,24 @@ public class DesktopVisibilityController {
|
||||
* Sets whether freeform windows are visible and updates launcher visibility based on that.
|
||||
*/
|
||||
public void setFreeformTasksVisible(boolean freeformTasksVisible) {
|
||||
if (!isDesktopModeSupported()) {
|
||||
return;
|
||||
}
|
||||
if (freeformTasksVisible != mFreeformTasksVisible) {
|
||||
mFreeformTasksVisible = freeformTasksVisible;
|
||||
updateLauncherVisibility();
|
||||
if (mFreeformTasksVisible) {
|
||||
setLauncherViewsVisibility(View.INVISIBLE);
|
||||
if (!mInOverviewState) {
|
||||
// When freeform is visible & we're not in overview, we want launcher to appear
|
||||
// paused, this ensures that taskbar displays.
|
||||
markLauncherPaused();
|
||||
}
|
||||
} else {
|
||||
setLauncherViewsVisibility(View.VISIBLE);
|
||||
// If freeform isn't visible ensure that launcher appears resumed to behave
|
||||
// normally.
|
||||
markLauncherResumed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,40 +83,67 @@ public class DesktopVisibilityController {
|
||||
* Sets whether the overview is visible and updates launcher visibility based on that.
|
||||
*/
|
||||
public void setOverviewStateEnabled(boolean overviewStateEnabled) {
|
||||
if (!isDesktopModeSupported()) {
|
||||
return;
|
||||
}
|
||||
if (overviewStateEnabled != mInOverviewState) {
|
||||
mInOverviewState = overviewStateEnabled;
|
||||
updateLauncherVisibility();
|
||||
if (mInOverviewState) {
|
||||
setLauncherViewsVisibility(View.VISIBLE);
|
||||
markLauncherResumed();
|
||||
} else if (mFreeformTasksVisible) {
|
||||
setLauncherViewsVisibility(View.INVISIBLE);
|
||||
markLauncherPaused();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates launcher visibility and state to look like it is paused or resumed depending on
|
||||
* whether freeform windows are showing in desktop mode.
|
||||
* Whether recents gesture is currently in progress.
|
||||
*/
|
||||
private void updateLauncherVisibility() {
|
||||
StatefulActivity<LauncherState> activity =
|
||||
QuickstepLauncher.ACTIVITY_TRACKER.getCreatedActivity();
|
||||
View workspaceView = mLauncher.getWorkspace();
|
||||
if (activity == null || workspaceView == null || !isDesktopModeSupported()) {
|
||||
public boolean isGestureInProgress() {
|
||||
return mGestureInProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether recents gesture is in progress.
|
||||
*/
|
||||
public void setGestureInProgress(boolean gestureInProgress) {
|
||||
if (!isDesktopModeSupported()) {
|
||||
return;
|
||||
}
|
||||
if (gestureInProgress != mGestureInProgress) {
|
||||
mGestureInProgress = gestureInProgress;
|
||||
}
|
||||
}
|
||||
|
||||
if (mFreeformTasksVisible) {
|
||||
workspaceView.setVisibility(View.INVISIBLE);
|
||||
if (!mInOverviewState) {
|
||||
// When freeform is visible & we're not in overview, we want launcher to appear
|
||||
// paused, this ensures that taskbar displays.
|
||||
activity.setPaused();
|
||||
}
|
||||
} else {
|
||||
workspaceView.setVisibility(View.VISIBLE);
|
||||
// If freeform isn't visible ensure that launcher appears resumed to behave normally.
|
||||
// Check activity state before calling setResumed(). Launcher may have been actually
|
||||
// paused (eg fullscreen task moved to front).
|
||||
// In this case we should not mark the activity as resumed.
|
||||
if (activity.isResumed()) {
|
||||
activity.setResumed();
|
||||
}
|
||||
private void setLauncherViewsVisibility(int visibility) {
|
||||
View workspaceView = mLauncher.getWorkspace();
|
||||
if (workspaceView != null) {
|
||||
workspaceView.setVisibility(visibility);
|
||||
}
|
||||
View dragLayer = mLauncher.getDragLayer();
|
||||
if (dragLayer != null) {
|
||||
dragLayer.setVisibility(visibility);
|
||||
}
|
||||
}
|
||||
|
||||
private void markLauncherPaused() {
|
||||
StatefulActivity<LauncherState> activity =
|
||||
QuickstepLauncher.ACTIVITY_TRACKER.getCreatedActivity();
|
||||
if (activity != null) {
|
||||
activity.setPaused();
|
||||
}
|
||||
}
|
||||
|
||||
private void markLauncherResumed() {
|
||||
StatefulActivity<LauncherState> activity =
|
||||
QuickstepLauncher.ACTIVITY_TRACKER.getCreatedActivity();
|
||||
// Check activity state before calling setResumed(). Launcher may have been actually
|
||||
// paused (eg fullscreen task moved to front).
|
||||
// In this case we should not mark the activity as resumed.
|
||||
if (activity != null && activity.isResumed()) {
|
||||
activity.setResumed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,7 +668,8 @@ public class QuickstepLauncher extends Launcher {
|
||||
public void setResumed() {
|
||||
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) {
|
||||
DesktopVisibilityController controller = mDesktopVisibilityController;
|
||||
if (controller != null && controller.areFreeformTasksVisible()) {
|
||||
if (controller != null && controller.areFreeformTasksVisible()
|
||||
&& !controller.isGestureInProgress()) {
|
||||
// Return early to skip setting activity to appear as resumed
|
||||
// TODO(b/255649902): shouldn't be needed when we have a separate launcher state
|
||||
// for desktop that we can use to control other parts of launcher
|
||||
|
||||
@@ -36,12 +36,15 @@ import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.popup.QuickstepSystemShortcut;
|
||||
import com.android.launcher3.statehandlers.DepthController;
|
||||
import com.android.launcher3.statehandlers.DesktopVisibilityController;
|
||||
import com.android.launcher3.statemanager.StateManager.StateListener;
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
import com.android.launcher3.util.PendingSplitSelectInfo;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.quickstep.LauncherActivityInterface;
|
||||
import com.android.quickstep.RotationTouchHelper;
|
||||
import com.android.quickstep.util.SplitSelectStateController;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
|
||||
/**
|
||||
* {@link RecentsView} used in Launcher activity
|
||||
@@ -205,4 +208,25 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
|
||||
protected boolean canLaunchFullscreenTask() {
|
||||
return !mActivity.isInState(OVERVIEW_SPLIT_SELECT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGestureAnimationStart(Task[] runningTasks,
|
||||
RotationTouchHelper rotationTouchHelper) {
|
||||
super.onGestureAnimationStart(runningTasks, rotationTouchHelper);
|
||||
DesktopVisibilityController desktopVisibilityController =
|
||||
mActivity.getDesktopVisibilityController();
|
||||
if (desktopVisibilityController != null) {
|
||||
desktopVisibilityController.setGestureInProgress(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGestureAnimationEnd() {
|
||||
super.onGestureAnimationEnd();
|
||||
DesktopVisibilityController desktopVisibilityController =
|
||||
mActivity.getDesktopVisibilityController();
|
||||
if (desktopVisibilityController != null) {
|
||||
desktopVisibilityController.setGestureInProgress(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user