Merge changes from topic "overview-to-desktop" into main
* changes: Account for freeform tasks being visible in overview Enable live tile for desktop
This commit is contained in:
+55
-12
@@ -15,8 +15,10 @@
|
||||
*/
|
||||
package com.android.launcher3.statehandlers;
|
||||
|
||||
import static com.android.launcher3.LauncherState.BACKGROUND_APP;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
|
||||
import android.os.Debug;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -46,6 +48,7 @@ public class DesktopVisibilityController {
|
||||
|
||||
private boolean mFreeformTasksVisible;
|
||||
private boolean mInOverviewState;
|
||||
private boolean mBackgroundStateEnabled;
|
||||
private boolean mGestureInProgress;
|
||||
|
||||
@Nullable
|
||||
@@ -113,7 +116,11 @@ public class DesktopVisibilityController {
|
||||
* Whether freeform windows are visible in desktop mode.
|
||||
*/
|
||||
public boolean areFreeformTasksVisible() {
|
||||
return mFreeformTasksVisible;
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "areFreeformTasksVisible: freeformVisible=" + mFreeformTasksVisible
|
||||
+ " overview=" + mInOverviewState);
|
||||
}
|
||||
return mFreeformTasksVisible && !mInOverviewState;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,7 +128,8 @@ public class DesktopVisibilityController {
|
||||
*/
|
||||
public void setFreeformTasksVisible(boolean freeformTasksVisible) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "setFreeformTasksVisible: visible=" + freeformTasksVisible);
|
||||
Log.d(TAG, "setFreeformTasksVisible: visible=" + freeformTasksVisible
|
||||
+ " currentValue=" + mFreeformTasksVisible);
|
||||
}
|
||||
if (!isDesktopModeSupported()) {
|
||||
return;
|
||||
@@ -146,11 +154,21 @@ public class DesktopVisibilityController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the overview is visible and updates launcher visibility based on that.
|
||||
* Process launcher state change and update launcher view visibility based on desktop state
|
||||
*/
|
||||
public void setOverviewStateEnabled(boolean overviewStateEnabled) {
|
||||
public void onLauncherStateChanged(LauncherState state) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "setOverviewStateEnabled: enabled=" + overviewStateEnabled);
|
||||
Log.d(TAG, "onLauncherStateChanged: newState=" + state);
|
||||
}
|
||||
setBackgroundStateEnabled(state == BACKGROUND_APP);
|
||||
// Desktop visibility tracks overview and background state separately
|
||||
setOverviewStateEnabled(state != BACKGROUND_APP && state.overviewUi);
|
||||
}
|
||||
|
||||
private void setOverviewStateEnabled(boolean overviewStateEnabled) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "setOverviewStateEnabled: enabled=" + overviewStateEnabled
|
||||
+ " currentValue=" + mInOverviewState);
|
||||
}
|
||||
if (!isDesktopModeSupported()) {
|
||||
return;
|
||||
@@ -160,7 +178,7 @@ public class DesktopVisibilityController {
|
||||
if (mInOverviewState) {
|
||||
setLauncherViewsVisibility(View.VISIBLE);
|
||||
markLauncherResumed();
|
||||
} else if (mFreeformTasksVisible && !mGestureInProgress) {
|
||||
} else if (areFreeformTasksVisible() && !mGestureInProgress) {
|
||||
// Switching out of overview state and gesture finished.
|
||||
// If freeform tasks are still visible, hide launcher again.
|
||||
setLauncherViewsVisibility(View.INVISIBLE);
|
||||
@@ -169,6 +187,27 @@ public class DesktopVisibilityController {
|
||||
}
|
||||
}
|
||||
|
||||
private void setBackgroundStateEnabled(boolean backgroundStateEnabled) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "setBackgroundStateEnabled: enabled=" + backgroundStateEnabled
|
||||
+ " currentValue=" + mBackgroundStateEnabled);
|
||||
}
|
||||
if (!isDesktopModeSupported()) {
|
||||
return;
|
||||
}
|
||||
if (backgroundStateEnabled != mBackgroundStateEnabled) {
|
||||
mBackgroundStateEnabled = backgroundStateEnabled;
|
||||
if (mBackgroundStateEnabled) {
|
||||
setLauncherViewsVisibility(View.VISIBLE);
|
||||
markLauncherResumed();
|
||||
} else if (areFreeformTasksVisible() && !mGestureInProgress) {
|
||||
// Switching out of background state. If freeform tasks are visible, pause launcher.
|
||||
setLauncherViewsVisibility(View.INVISIBLE);
|
||||
markLauncherPaused();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether recents gesture is currently in progress.
|
||||
*/
|
||||
@@ -183,6 +222,9 @@ public class DesktopVisibilityController {
|
||||
if (!isDesktopModeSupported()) {
|
||||
return;
|
||||
}
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "setRecentsGestureStart");
|
||||
}
|
||||
setRecentsGestureInProgress(true);
|
||||
}
|
||||
|
||||
@@ -194,6 +236,9 @@ public class DesktopVisibilityController {
|
||||
if (!isDesktopModeSupported()) {
|
||||
return;
|
||||
}
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "setRecentsGestureEnd: endTarget=" + endTarget);
|
||||
}
|
||||
setRecentsGestureInProgress(false);
|
||||
|
||||
if (endTarget == null) {
|
||||
@@ -203,9 +248,6 @@ public class DesktopVisibilityController {
|
||||
}
|
||||
|
||||
private void setRecentsGestureInProgress(boolean gestureInProgress) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "setGestureInProgress: inProgress=" + gestureInProgress);
|
||||
}
|
||||
if (gestureInProgress != mGestureInProgress) {
|
||||
mGestureInProgress = gestureInProgress;
|
||||
}
|
||||
@@ -222,7 +264,8 @@ public class DesktopVisibilityController {
|
||||
|
||||
private void setLauncherViewsVisibility(int visibility) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "setLauncherViewsVisibility: visibility=" + visibility);
|
||||
Log.d(TAG, "setLauncherViewsVisibility: visibility=" + visibility + " "
|
||||
+ Debug.getCaller());
|
||||
}
|
||||
View workspaceView = mLauncher.getWorkspace();
|
||||
if (workspaceView != null) {
|
||||
@@ -236,7 +279,7 @@ public class DesktopVisibilityController {
|
||||
|
||||
private void markLauncherPaused() {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "markLauncherPaused");
|
||||
Log.d(TAG, "markLauncherPaused " + Debug.getCaller());
|
||||
}
|
||||
StatefulActivity<LauncherState> activity =
|
||||
QuickstepLauncher.ACTIVITY_TRACKER.getCreatedActivity();
|
||||
@@ -247,7 +290,7 @@ public class DesktopVisibilityController {
|
||||
|
||||
private void markLauncherResumed() {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "markLauncherResumed");
|
||||
Log.d(TAG, "markLauncherResumed " + Debug.getCaller());
|
||||
}
|
||||
StatefulActivity<LauncherState> activity =
|
||||
QuickstepLauncher.ACTIVITY_TRACKER.getCreatedActivity();
|
||||
|
||||
@@ -2084,18 +2084,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
}
|
||||
|
||||
private void finishCurrentTransitionToRecents() {
|
||||
if (mRecentsView != null
|
||||
&& mActivityInterface.getDesktopVisibilityController() != null
|
||||
&& mActivityInterface.getDesktopVisibilityController().areFreeformTasksVisible()) {
|
||||
mRecentsView.switchToScreenshot(() -> {
|
||||
mRecentsView.finishRecentsAnimation(true /* toRecents */, false /* shouldPip */,
|
||||
() -> mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED));
|
||||
});
|
||||
} else {
|
||||
mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED);
|
||||
if (mRecentsAnimationController != null) {
|
||||
mRecentsAnimationController.detachNavigationBarFromApp(true);
|
||||
}
|
||||
mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED);
|
||||
if (mRecentsAnimationController != null) {
|
||||
mRecentsAnimationController.detachNavigationBarFromApp(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ import com.android.launcher3.testing.shared.TestProtocol;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.quickstep.TopTaskTracker.CachedTaskInfo;
|
||||
import com.android.quickstep.util.ActiveGestureLog;
|
||||
import com.android.quickstep.views.DesktopTaskView;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
@@ -261,12 +260,6 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
// to let the transition controller collect Home activity.
|
||||
CachedTaskInfo cti = gestureState.getRunningTask();
|
||||
boolean homeIsOnTop = cti != null && cti.isHomeTask();
|
||||
if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
|
||||
if (cti != null && cti.isFreeformTask()) {
|
||||
// No transient launch when desktop task is on top
|
||||
homeIsOnTop = true;
|
||||
}
|
||||
}
|
||||
if (activityInterface.allowAllAppsFromOverview()) {
|
||||
homeIsOnTop = true;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.quickstep.views;
|
||||
|
||||
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_UNDEFINED;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -41,7 +40,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.desktop.DesktopRecentsTransitionController;
|
||||
@@ -338,16 +336,18 @@ public class DesktopTaskView extends TaskView {
|
||||
@Override
|
||||
public RunnableList launchTaskAnimated() {
|
||||
RunnableList endCallback = new RunnableList();
|
||||
endCallback.add(() -> Launcher.getLauncher(mActivity).getStateManager().goToState(NORMAL));
|
||||
|
||||
RecentsView recentsView = getRecentsView();
|
||||
DesktopRecentsTransitionController recentsController =
|
||||
getRecentsView().getDesktopRecentsController();
|
||||
recentsView.getDesktopRecentsController();
|
||||
if (recentsController != null) {
|
||||
recentsController.launchDesktopFromRecents(this, success -> {
|
||||
endCallback.executeAllAndDestroy();
|
||||
});
|
||||
}
|
||||
|
||||
// Callbacks get run from recentsView for case when recents animation already running
|
||||
recentsView.addSideTaskLaunchCallback(endCallback);
|
||||
return endCallback;
|
||||
}
|
||||
|
||||
|
||||
@@ -137,16 +137,16 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
|
||||
@Override
|
||||
public void onStateTransitionStart(LauncherState toState) {
|
||||
setOverviewStateEnabled(toState.overviewUi);
|
||||
if (toState.overviewUi) {
|
||||
// If overview is enabled, we want to update at the start
|
||||
updateOverviewStateForDesktop(true);
|
||||
}
|
||||
|
||||
setOverviewGridEnabled(toState.displayOverviewTasksAsGrid(mActivity.getDeviceProfile()));
|
||||
setOverviewFullscreenEnabled(toState.getOverviewFullscreenProgress() == 1);
|
||||
if (toState == OVERVIEW_MODAL_TASK) {
|
||||
setOverviewSelectEnabled(true);
|
||||
}
|
||||
setFreezeViewVisibility(true);
|
||||
if (mActivity.getDesktopVisibilityController() != null) {
|
||||
mActivity.getDesktopVisibilityController().onLauncherStateChanged(toState);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,11 +167,6 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
|
||||
runActionOnRemoteHandles(remoteTargetHandle ->
|
||||
remoteTargetHandle.getTaskViewSimulator().setDrawsBelowRecents(true));
|
||||
}
|
||||
|
||||
if (!finalState.overviewUi) {
|
||||
// If overview is disabled, we want to update at the end
|
||||
updateOverviewStateForDesktop(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -183,9 +178,6 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
|
||||
& CLEAR_ALL_BUTTON) != 0;
|
||||
setDisallowScrollToClearAll(!hasClearAllButton);
|
||||
}
|
||||
if (mActivity.getDesktopVisibilityController() != null) {
|
||||
mActivity.getDesktopVisibilityController().setOverviewStateEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -282,11 +274,4 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
|
||||
null /* transition */);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateOverviewStateForDesktop(boolean enabled) {
|
||||
DesktopVisibilityController controller = mActivity.getDesktopVisibilityController();
|
||||
if (controller != null) {
|
||||
controller.setOverviewStateEnabled(enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user