Merge changes from topic "shape_communication_with_fix" into main
* changes:
Shape screen communication with the Launcher's app (2/2)
Fix grid entry is missing
diff --git a/quickstep/res/layout/task_desktop.xml b/quickstep/res/layout/task_desktop.xml
index 1564653..0472007 100644
--- a/quickstep/res/layout/task_desktop.xml
+++ b/quickstep/res/layout/task_desktop.xml
@@ -19,16 +19,11 @@
android:id="@+id/task_view_desktop"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:clipChildren="true"
- android:clipToPadding="true"
android:contentDescription="@string/recent_task_desktop"
android:defaultFocusHighlightEnabled="false"
android:focusable="true"
- android:padding="0.1dp"
launcher:focusBorderColor="?attr/materialColorOutline"
launcher:hoverBorderColor="?attr/materialColorPrimary">
- <!-- Setting a padding of 0.1 dp since android:clipToPadding needs a non-zero value for
- padding to work-->
<View
android:id="@+id/background"
android:layout_width="match_parent"
@@ -40,4 +35,9 @@
android:layout_height="wrap_content"
android:inflatedId="@id/icon" />
+ <com.android.quickstep.views.DesktopTaskContentView
+ android:id="@+id/desktop_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
</com.android.quickstep.views.DesktopTaskView>
diff --git a/quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java
index 929e793..e3bcb0d 100644
--- a/quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java
@@ -25,20 +25,24 @@
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.statemanager.StateManager;
-import com.android.quickstep.RecentsActivity;
+import com.android.launcher3.statemanager.StatefulContainer;
import com.android.quickstep.TopTaskTracker;
import com.android.quickstep.fallback.RecentsState;
import com.android.quickstep.util.TISBindHelper;
import com.android.quickstep.views.RecentsView;
+import com.android.quickstep.views.RecentsViewContainer;
import java.util.stream.Stream;
/**
* A data source which integrates with the fallback RecentsActivity instance (for 3P launchers).
+ * @param <T> The type of the RecentsViewContainer that will handle Recents state changes.
*/
-public class FallbackTaskbarUIController extends TaskbarUIController {
+public class FallbackTaskbarUIController
+ <T extends RecentsViewContainer & StatefulContainer<RecentsState>>
+ extends TaskbarUIController {
- private final RecentsActivity mRecentsActivity;
+ private final T mRecentsContainer;
private final StateManager.StateListener<RecentsState> mStateListener =
new StateManager.StateListener<RecentsState>() {
@@ -63,23 +67,23 @@
}
};
- public FallbackTaskbarUIController(RecentsActivity recentsActivity) {
- mRecentsActivity = recentsActivity;
+ public FallbackTaskbarUIController(T recentsContainer) {
+ mRecentsContainer = recentsContainer;
}
@Override
protected void init(TaskbarControllers taskbarControllers) {
super.init(taskbarControllers);
- mRecentsActivity.setTaskbarUIController(this);
- mRecentsActivity.getStateManager().addStateListener(mStateListener);
+ mRecentsContainer.setTaskbarUIController(this);
+ mRecentsContainer.getStateManager().addStateListener(mStateListener);
}
@Override
protected void onDestroy() {
super.onDestroy();
getRecentsView().setTaskLaunchListener(null);
- mRecentsActivity.setTaskbarUIController(null);
- mRecentsActivity.getStateManager().removeStateListener(mStateListener);
+ mRecentsContainer.setTaskbarUIController(null);
+ mRecentsContainer.getStateManager().removeStateListener(mStateListener);
}
/**
@@ -109,7 +113,7 @@
@Override
public RecentsView getRecentsView() {
- return mRecentsActivity.getOverviewPanel();
+ return mRecentsContainer.getOverviewPanel();
}
@Override
@@ -131,11 +135,11 @@
@Nullable
@Override
protected TISBindHelper getTISBindHelper() {
- return mRecentsActivity.getTISBindHelper();
+ return mRecentsContainer.getTISBindHelper();
}
@Override
protected String getTaskbarUIControllerName() {
- return "FallbackTaskbarUIController";
+ return "FallbackTaskbarUIController<" + mRecentsContainer.getClass().getSimpleName() + ">";
}
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java
index 3f71870..7a63f74 100644
--- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java
@@ -31,12 +31,14 @@
import androidx.annotation.Nullable;
import com.android.internal.jank.Cuj;
+import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.desktop.DesktopAppLaunchTransition;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayDragLayer;
+import com.android.launcher3.util.DisplayController;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.util.GroupTask;
@@ -101,7 +103,16 @@
boolean hasDesktopTask,
boolean wasDesktopTaskFilteredOut,
boolean wasOpenedFromTaskbar) {
- positionView(wasOpenedFromTaskbar);
+ final boolean isTransientTaskBar = DisplayController.isTransientTaskbar(
+ mControllers.taskbarActivityContext);
+ positionView(wasOpenedFromTaskbar, isTransientTaskBar);
+
+ // Keep the taskbar unstashed if the KQS is opened.
+ if (wasOpenedFromTaskbar && isTransientTaskBar) {
+ mControllers.taskbarStashController.updateTaskbarTimeout(/* isAutohideSuspended= */
+ true);
+ }
+
mOverlayContext.getDragLayer().addView(mKeyboardQuickSwitchView);
mOnDesktop = onDesktop;
mWasDesktopTaskFilteredOut = wasDesktopTaskFilteredOut;
@@ -117,7 +128,7 @@
/* useDesktopTaskView= */ !onDesktop && hasDesktopTask);
}
- protected void positionView(boolean wasOpenedFromTaskbar) {
+ protected void positionView(boolean wasOpenedFromTaskbar, boolean isTransientTaskbar) {
if (!wasOpenedFromTaskbar) {
// Keep the default positioning.
return;
@@ -128,8 +139,16 @@
final Resources resources = mKeyboardQuickSwitchView.getResources();
final int marginHorizontal = resources.getDimensionPixelSize(
R.dimen.keyboard_quick_switch_margin_ends);
- final int marginBottom = resources.getDimensionPixelSize(
+
+ final DeviceProfile dp = mControllers.taskbarActivityContext.getDeviceProfile();
+ // Calculate the additional margin space that the KQS should move up for the transient
+ // taskbar. The value of spaceForTaskbar is the distance between the bottom of the KQS
+ // view with 0 bottom margin to the top of the transient taskbar view.
+ final int spaceForTaskbar = isTransientTaskbar ? dp.taskbarHeight + dp.taskbarBottomMargin
+ - dp.stashedTaskbarHeight : 0;
+ final int marginBottom = spaceForTaskbar + resources.getDimensionPixelSize(
R.dimen.keyboard_quick_switch_margin_bottom);
+
lp.setMargins(marginHorizontal, 0, marginHorizontal, marginBottom);
lp.width = BaseDragLayer.LayoutParams.WRAP_CONTENT;
lp.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
index 4a85acc..5a63ca6 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarControllers.java
@@ -169,7 +169,7 @@
taskbarOverlayController.init(this);
taskbarAllAppsController.init(this, sharedState.allAppsVisible);
navButtonController.init(this);
- bubbleControllers.ifPresent(controllers -> controllers.init(this));
+ bubbleControllers.ifPresent(controllers -> controllers.init(sharedState, this));
taskbarInsetsController.init(this);
voiceInteractionWindowController.init(this);
taskbarRecentAppsController.init(this);
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
index a0440c1..ab4b1b6 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
@@ -71,7 +71,9 @@
import com.android.quickstep.AllAppsActionManager;
import com.android.quickstep.RecentsActivity;
import com.android.quickstep.SystemUiProxy;
+import com.android.quickstep.fallback.window.RecentsWindowManager;
import com.android.quickstep.util.ContextualSearchInvoker;
+import com.android.quickstep.views.RecentsViewContainer;
import com.android.systemui.shared.statusbar.phone.BarTransitions;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
@@ -130,6 +132,8 @@
private TaskbarActivityContext mTaskbarActivityContext;
private StatefulActivity mActivity;
+ private RecentsViewContainer mRecentsViewContainer;
+
/**
* Cache a copy here so we can initialize state whenever taskbar is recreated, since
* this class does not get re-initialized w/ new taskbars.
@@ -403,9 +407,28 @@
}
mUnfoldProgressProvider.setSourceProvider(unfoldTransitionProgressProvider);
+ if (activity instanceof RecentsViewContainer recentsViewContainer) {
+ setRecentsViewContainer(recentsViewContainer);
+ }
+ }
+
+ /**
+ * Sets the current RecentsViewContainer, from which we create a TaskbarUIController.
+ */
+ public void setRecentsViewContainer(@NonNull RecentsViewContainer recentsViewContainer) {
+ if (mRecentsViewContainer == recentsViewContainer) {
+ return;
+ }
+ if (mRecentsViewContainer == mActivity) {
+ // When switching to RecentsWindowManager (not an Activity), the old mActivity is not
+ // destroyed, nor is there a new Activity to replace it. Thus if we don't clear it here,
+ // it will not get re-set properly if we return to the Activity (e.g. NexusLauncher).
+ mActivityOnDestroyCallback.run();
+ }
+ mRecentsViewContainer = recentsViewContainer;
if (mTaskbarActivityContext != null) {
mTaskbarActivityContext.setUIController(
- createTaskbarUIControllerForActivity(mActivity));
+ createTaskbarUIControllerForRecentsViewContainer(mRecentsViewContainer));
}
}
@@ -428,12 +451,18 @@
/**
* Creates a {@link TaskbarUIController} to use while the given StatefulActivity is active.
*/
- private TaskbarUIController createTaskbarUIControllerForActivity(StatefulActivity activity) {
- if (activity instanceof QuickstepLauncher) {
- return new LauncherTaskbarUIController((QuickstepLauncher) activity);
+ private TaskbarUIController createTaskbarUIControllerForRecentsViewContainer(
+ RecentsViewContainer container) {
+ if (container instanceof QuickstepLauncher quickstepLauncher) {
+ return new LauncherTaskbarUIController(quickstepLauncher);
}
- if (activity instanceof RecentsActivity) {
- return new FallbackTaskbarUIController((RecentsActivity) activity);
+ // If a 3P Launcher is default, always use FallbackTaskbarUIController regardless of
+ // whether the recents container is RecentsActivity or RecentsWindowManager.
+ if (container instanceof RecentsActivity recentsActivity) {
+ return new FallbackTaskbarUIController<>(recentsActivity);
+ }
+ if (container instanceof RecentsWindowManager recentsWindowManager) {
+ return new FallbackTaskbarUIController<>(recentsWindowManager);
}
return TaskbarUIController.DEFAULT;
}
@@ -481,9 +510,9 @@
mSharedState.allAppsVisible = mSharedState.allAppsVisible && isLargeScreenTaskbar;
mTaskbarActivityContext.init(mSharedState);
- if (mActivity != null) {
+ if (mRecentsViewContainer != null) {
mTaskbarActivityContext.setUIController(
- createTaskbarUIControllerForActivity(mActivity));
+ createTaskbarUIControllerForRecentsViewContainer(mRecentsViewContainer));
}
if (enableTaskbarNoRecreate()) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java
index 729cbe9..a64dab1 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarSharedState.java
@@ -30,6 +30,10 @@
import android.view.InsetsFrameProvider;
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
+import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
+import com.android.wm.shell.shared.bubbles.BubbleInfo;
+
+import java.util.List;
/**
* State shared across different taskbar instance
@@ -69,6 +73,15 @@
public boolean allAppsVisible = false;
+ public BubbleBarLocation bubbleBarLocation;
+
+ public List<BubbleInfo> bubbleInfoItems;
+
+ /** Returns whether there are a saved bubbles. */
+ public boolean hasSavedBubbles() {
+ return bubbleInfoItems != null && !bubbleInfoItems.isEmpty();
+ }
+
// LauncherTaskbarUIController#mTaskbarInAppDisplayProgressMultiProp
public float[] inAppDisplayProgressMultiPropValues = new float[DISPLAY_PROGRESS_COUNT];
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java
index b22fd6f..30e4e47 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java
@@ -35,6 +35,7 @@
import android.util.ArrayMap;
import android.util.Log;
+import com.android.launcher3.taskbar.TaskbarSharedState;
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController;
import com.android.launcher3.util.Executors.SimpleThreadFactory;
import com.android.quickstep.SystemUiProxy;
@@ -47,6 +48,7 @@
import com.android.wm.shell.shared.bubbles.RemovedBubble;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@@ -112,6 +114,7 @@
private BubbleBarItem mSelectedBubble;
+ private TaskbarSharedState mSharedState;
private ImeVisibilityChecker mImeVisibilityChecker;
private BubbleBarViewController mBubbleBarViewController;
private BubbleStashController mBubbleStashController;
@@ -173,12 +176,25 @@
public void onDestroy() {
mSystemUiProxy.setBubblesListener(null);
+ // Saves bubble bar state
+ BubbleInfo[] bubbleInfoItems = new BubbleInfo[mBubbles.size()];
+ mBubbles.values().forEach(bubbleBarBubble -> {
+ int index = mBubbleBarViewController.bubbleViewIndex(bubbleBarBubble.getView());
+ if (index < 0 || index >= bubbleInfoItems.length) {
+ Log.e(TAG, "Found improper index: " + index + " for " + bubbleBarBubble);
+ } else {
+ bubbleInfoItems[index] = bubbleBarBubble.getInfo();
+ }
+ });
+ mSharedState.bubbleInfoItems = Arrays.asList(bubbleInfoItems);
}
/** Initializes controllers. */
public void init(BubbleControllers bubbleControllers,
BubbleBarLocationListener bubbleBarLocationListener,
- ImeVisibilityChecker imeVisibilityChecker) {
+ ImeVisibilityChecker imeVisibilityChecker,
+ TaskbarSharedState sharedState) {
+ mSharedState = sharedState;
mImeVisibilityChecker = imeVisibilityChecker;
mBubbleBarViewController = bubbleControllers.bubbleBarViewController;
mBubbleStashController = bubbleControllers.bubbleStashController;
@@ -188,6 +204,7 @@
mBubbleBarLocationListener = bubbleBarLocationListener;
bubbleControllers.runAfterInit(() -> {
+ restoreSavedState(sharedState);
mBubbleBarViewController.setHiddenForBubbles(
!sBubbleBarEnabled || mBubbles.isEmpty());
mBubbleStashedHandleViewController.ifPresent(
@@ -266,6 +283,26 @@
}
}
+ private void restoreSavedState(TaskbarSharedState sharedState) {
+ if (sharedState.bubbleBarLocation != null) {
+ updateBubbleBarLocationInternal(sharedState.bubbleBarLocation);
+ }
+ List<BubbleInfo> bubbleInfos = sharedState.bubbleInfoItems;
+ if (bubbleInfos == null || bubbleInfos.isEmpty()) return;
+ // Iterate in reverse because new bubbles are added in front and the list is in order.
+ for (int i = bubbleInfos.size() - 1; i >= 0; i--) {
+ BubbleBarBubble bubble = mBubbleCreator.populateBubble(mContext,
+ bubbleInfos.get(i), mBarView, /* existingBubble = */ null);
+ if (bubble == null) {
+ Log.e(TAG, "Could not instantiate BubbleBarBubble for " + bubbleInfos.get(i));
+ continue;
+ }
+ addBubbleInternally(bubble, /* showAppBadge = */
+ mBubbleBarViewController.isExpanded() || i == 0,
+ /* isExpanding = */ false, /* suppressAnimation = */ true);
+ }
+ }
+
private void applyViewChanges(BubbleBarViewUpdate update) {
final boolean isCollapsed = (update.expandedChanged && !update.expanded)
|| (!update.expandedChanged && !mBubbleBarViewController.isExpanded());
@@ -277,6 +314,12 @@
update.initialState || mBubbleBarViewController.isHiddenForSysui()
|| mImeVisibilityChecker.isImeVisible();
+ if (update.initialState && mSharedState.hasSavedBubbles()) {
+ // clear restored state
+ mBubbleBarViewController.removeAllBubbles();
+ mBubbles.clear();
+ }
+
BubbleBarBubble bubbleToSelect = null;
if (Flags.enableOptionalBubbleOverflow()
@@ -347,8 +390,8 @@
for (int i = update.currentBubbles.size() - 1; i >= 0; i--) {
BubbleBarBubble bubble = update.currentBubbles.get(i);
if (bubble != null) {
- mBubbles.put(bubble.getKey(), bubble);
- mBubbleBarViewController.addBubble(bubble, isExpanding, suppressAnimation);
+ addBubbleInternally(bubble, /* showAppBadge = */ !isCollapsed || i == 0,
+ isExpanding, suppressAnimation);
if (isCollapsed) {
// If we're collapsed, the most recently added bubble will be selected.
bubbleToSelect = bubble;
@@ -420,6 +463,7 @@
}
}
if (update.bubbleBarLocation != null) {
+ mSharedState.bubbleBarLocation = update.bubbleBarLocation;
if (update.bubbleBarLocation != mBubbleBarViewController.getBubbleBarLocation()) {
updateBubbleBarLocationInternal(update.bubbleBarLocation);
}
@@ -519,6 +563,14 @@
}
}
+ private void addBubbleInternally(BubbleBarBubble bubble, boolean showAppBadge,
+ boolean isExpanding, boolean suppressAnimation) {
+ //TODO(b/360652359): remove setting scale to the app badge once issue is fixed
+ bubble.getView().setBadgeScale(showAppBadge ? 1 : 0);
+ mBubbles.put(bubble.getKey(), bubble);
+ mBubbleBarViewController.addBubble(bubble, isExpanding, suppressAnimation);
+ }
+
/** Interface for checking whether the IME is visible. */
public interface ImeVisibilityChecker {
/** Whether the IME is visible. */
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
index 31b1ea0..96fadf7 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
@@ -57,6 +57,7 @@
import com.android.launcher3.util.MultiPropertyFactory;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.quickstep.SystemUiProxy;
+import com.android.wm.shell.Flags;
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
import java.io.PrintWriter;
@@ -177,6 +178,9 @@
mBubbleBarClickListener = v -> expandBubbleBar();
mBubbleDragController.setupBubbleBarView(mBarView);
mOverflowBubble = bubbleControllers.bubbleCreator.createOverflow(mBarView);
+ if (!Flags.enableOptionalBubbleOverflow()) {
+ showOverflow(true);
+ }
mBarView.setOnClickListener(mBubbleBarClickListener);
mBarView.addOnLayoutChangeListener(
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
@@ -324,6 +328,7 @@
}
private void onBubbleClicked(BubbleView bubbleView) {
+ if (mBubbleBarPinning.isAnimating()) return;
bubbleView.markSeen();
BubbleBarItem bubble = bubbleView.getBubble();
if (bubble == null) {
@@ -872,9 +877,14 @@
/** Animates the bubble bar to notify the user about a bubble change. */
public void animateBubbleNotification(BubbleBarBubble bubble, boolean isExpanding,
boolean isUpdate) {
- // if we're expanded, don't animate the bubble bar. just show the notification dot.
+ // if we're not already animating another bubble, update the dot visibility. otherwise the
+ // the dot will be handled as part of the animation.
+ if (!mBubbleBarViewAnimator.isAnimating()) {
+ bubble.getView().updateDotVisibility(
+ /* animate= */ !mBubbleStashController.isStashed());
+ }
+ // if we're expanded, don't animate the bubble bar.
if (isExpanded()) {
- bubble.getView().updateDotVisibility(/* animate= */ true);
return;
}
boolean isInApp = mTaskbarStashController.isInApp();
@@ -918,7 +928,7 @@
* from Launcher.
*/
public void setExpanded(boolean isExpanded) {
- if (isExpanded != mBarView.isExpanded()) {
+ if (!mBubbleBarPinning.isAnimating() && isExpanded != mBarView.isExpanded()) {
mBarView.setExpanded(isExpanded);
adjustTaskbarAndHotseatToBubbleBarState(isExpanded);
if (!isExpanded) {
@@ -1060,6 +1070,16 @@
mSystemUiProxy.removeAllBubbles();
}
+ /** Removes all existing bubble views */
+ public void removeAllBubbles() {
+ mBarView.removeAllViews();
+ }
+
+ /** Returns the view index of the existing bubble */
+ public int bubbleViewIndex(View bubbleView) {
+ return mBarView.indexOfChild(bubbleView);
+ }
+
/**
* Set listener to be notified when bubble bar bounds have changed
*/
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleControllers.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleControllers.java
index b5d94bd..d993685 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleControllers.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleControllers.java
@@ -21,6 +21,7 @@
import android.view.View;
import com.android.launcher3.taskbar.TaskbarControllers;
+import com.android.launcher3.taskbar.TaskbarSharedState;
import com.android.launcher3.taskbar.bubbles.BubbleBarViewController.TaskbarViewPropertiesProvider;
import com.android.launcher3.taskbar.bubbles.stashing.BubbleBarLocationOnDemandListener;
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController;
@@ -79,7 +80,7 @@
* BubbleControllers instance, but should be careful to only access things that were created
* in constructors for now, as some controllers may still be waiting for init().
*/
- public void init(TaskbarControllers taskbarControllers) {
+ public void init(TaskbarSharedState taskbarSharedState, TaskbarControllers taskbarControllers) {
BubbleBarLocationCompositeListener bubbleBarLocationListeners =
new BubbleBarLocationCompositeListener(
taskbarControllers.navbarButtonsViewController,
@@ -88,7 +89,8 @@
);
bubbleBarController.init(this,
bubbleBarLocationListeners,
- taskbarControllers.navbarButtonsViewController::isImeVisible);
+ taskbarControllers.navbarButtonsViewController::isImeVisible,
+ taskbarSharedState);
bubbleStashedHandleViewController.ifPresent(
controller -> controller.init(/* bubbleControllers = */ this));
bubbleStashController.init(
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleView.java
index 4f3e1ae..114edf4 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleView.java
@@ -299,7 +299,8 @@
return mBubble;
}
- void updateDotVisibility(boolean animate) {
+ /** Updates the dot visibility if it's not suppressed based on whether it has unseen content. */
+ public void updateDotVisibility(boolean animate) {
if (mDotSuppressedForBubbleUpdate) {
// if the dot is suppressed for an update, there's nothing to do
return;
@@ -321,16 +322,12 @@
}
}
- /**
- * Suppresses or un-suppresses drawing the dot due to an update for this bubble.
- *
- * <p>If the dot is being suppressed and is already visible, it remains visible because it is
- * used as a starting point for the animation. If the dot is being unsuppressed, it is
- * redrawn if needed.
- */
+ /** Suppresses or un-suppresses drawing the dot due to an update for this bubble. */
public void suppressDotForBubbleUpdate(boolean suppress) {
mDotSuppressedForBubbleUpdate = suppress;
- if (!suppress) {
+ if (suppress) {
+ setDotScale(0);
+ } else {
showDotIfNeeded(/* animate= */ false);
}
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt
index eca2bc8..6c354f3 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt
@@ -59,7 +59,7 @@
private companion object {
/** The time to show the flyout. */
- const val FLYOUT_DELAY_MS: Long = 10000
+ const val FLYOUT_DELAY_MS: Long = 3000
/** The initial scale Y value that the new bubble is set to before the animation starts. */
const val BUBBLE_ANIMATION_INITIAL_SCALE_Y = 0.3f
/** The minimum alpha value to make the bubble bar touchable. */
@@ -484,13 +484,14 @@
val bubble = bubbleView?.bubble as? BubbleBarBubble
val flyout = bubble?.flyoutMessage
if (flyout != null) {
- bubbleView.suppressDotForBubbleUpdate(true)
bubbleBarFlyoutController.setUpAndShowFlyout(
- BubbleBarFlyoutMessage(flyout.icon, flyout.title, flyout.message)
- ) {
- moveToState(AnimatingBubble.State.IN)
- bubbleStashController.updateTaskbarTouchRegion()
- }
+ BubbleBarFlyoutMessage(flyout.icon, flyout.title, flyout.message),
+ onInit = { bubbleView.suppressDotForBubbleUpdate(true) },
+ onEnd = {
+ moveToState(AnimatingBubble.State.IN)
+ bubbleStashController.updateTaskbarTouchRegion()
+ },
+ )
} else {
moveToState(AnimatingBubble.State.IN)
}
@@ -563,7 +564,8 @@
if (!bubbleBarFlyoutController.hasFlyout()) {
// if the flyout does not yet exist, then we're only animating the bubble bar.
// the animating bubble has been updated, so the when the flyout expands it will
- // show the right message.
+ // show the right message. we only need to update the dot visibility.
+ bubbleView.updateDotVisibility(/* animate= */ !bubbleStashController.isStashed)
return
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt
index 1452cf6..7b20eea 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt
@@ -59,7 +59,7 @@
return rect
}
- fun setUpAndShowFlyout(message: BubbleBarFlyoutMessage, onEnd: () -> Unit) {
+ fun setUpAndShowFlyout(message: BubbleBarFlyoutMessage, onInit: () -> Unit, onEnd: () -> Unit) {
flyout?.let(container::removeView)
val flyout = BubbleBarFlyoutView(container.context, positioner, flyoutScheduler)
@@ -76,7 +76,11 @@
container.addView(flyout, lp)
this.flyout = flyout
- flyout.showFromCollapsed(message) { showFlyout(AnimationType.MORPH, onEnd) }
+ flyout.showFromCollapsed(message) {
+ flyout.updateExpansionProgress(0f)
+ onInit()
+ showFlyout(AnimationType.MORPH, onEnd)
+ }
}
private fun showFlyout(animationType: AnimationType, endAction: () -> Unit) {
@@ -160,7 +164,15 @@
flyout.updateExpansionProgress(animator.animatedValue as Float)
}
}
- animator.addListener(onStart = { flyout.setOnClickListener(null) }, onEnd = { endAction() })
+ animator.addListener(
+ onStart = {
+ flyout.setOnClickListener(null)
+ if (animationType == AnimationType.MORPH) {
+ flyout.updateTranslationToCollapsedPosition()
+ }
+ },
+ onEnd = { endAction() },
+ )
animator.start()
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutView.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutView.kt
index af8aaf8..418675c 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutView.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutView.kt
@@ -192,18 +192,8 @@
title.alpha = 0f
message.alpha = 0f
setData(flyoutMessage)
- val txToCollapsedPosition =
- if (positioner.isOnLeft) {
- positioner.distanceToCollapsedPosition.x
- } else {
- -positioner.distanceToCollapsedPosition.x
- }
- // TODO: b/277815200 - before collapsing, recalculate translationToCollapsedPosition because
- // the collapsed position may have changed
- val tyToCollapsedPosition =
- positioner.distanceToCollapsedPosition.y + triangleHeight - triangleOverlap
- translationToCollapsedPosition = PointF(txToCollapsedPosition, tyToCollapsedPosition)
+ updateTranslationToCollapsedPosition()
collapsedSize = positioner.collapsedSize
collapsedCornerRadius = collapsedSize / 2
collapsedColor = positioner.collapsedColor
@@ -212,7 +202,7 @@
// calculate the expansion progress required before we start showing the triangle as part of
// the expansion animation
minExpansionProgressForTriangle =
- positioner.distanceToRevealTriangle / tyToCollapsedPosition
+ positioner.distanceToRevealTriangle / translationToCollapsedPosition.y
// post the request to start the expand animation to the looper so the view can measure
// itself
@@ -259,6 +249,22 @@
message.text = flyoutMessage.message
}
+ /**
+ * This should be called to update [translationToCollapsedPosition] before we start expanding or
+ * collapsing to make sure that we're animating the flyout to and from the correct position.
+ */
+ fun updateTranslationToCollapsedPosition() {
+ val txToCollapsedPosition =
+ if (positioner.isOnLeft) {
+ positioner.distanceToCollapsedPosition.x
+ } else {
+ -positioner.distanceToCollapsedPosition.x
+ }
+ val tyToCollapsedPosition =
+ positioner.distanceToCollapsedPosition.y + triangleHeight - triangleOverlap
+ translationToCollapsedPosition = PointF(txToCollapsedPosition, tyToCollapsedPosition)
+ }
+
/** Updates the flyout view with the progress of the animation. */
fun updateExpansionProgress(fraction: Float) {
expansionProgress = fraction
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index 228dc91..fe68ebc 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -139,6 +139,7 @@
import com.android.launcher3.statemanager.StateManager.StateHandler;
import com.android.launcher3.taskbar.LauncherTaskbarUIController;
import com.android.launcher3.taskbar.TaskbarManager;
+import com.android.launcher3.taskbar.TaskbarUIController;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.uioverrides.QuickstepWidgetHolder.QuickstepHolderFactory;
@@ -1089,10 +1090,12 @@
);
}
- public void setTaskbarUIController(LauncherTaskbarUIController taskbarUIController) {
- mTaskbarUIController = taskbarUIController;
+ @Override
+ public void setTaskbarUIController(@Nullable TaskbarUIController taskbarUIController) {
+ mTaskbarUIController = (LauncherTaskbarUIController) taskbarUIController;
}
+ @Override
public @Nullable LauncherTaskbarUIController getTaskbarUIController() {
return mTaskbarUIController;
}
@@ -1399,6 +1402,7 @@
}
@NonNull
+ @Override
public TISBindHelper getTISBindHelper() {
return mTISBindHelper;
}
diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java
index 05bef35..a5cc32a 100644
--- a/quickstep/src/com/android/quickstep/RecentTasksList.java
+++ b/quickstep/src/com/android/quickstep/RecentTasksList.java
@@ -119,6 +119,11 @@
topTaskTracker.onTaskMovedToFront(taskInfo);
});
}
+
+ @Override
+ public void onTaskInfoChanged(ActivityManager.RunningTaskInfo taskInfo) {
+ mMainThreadExecutor.execute(() -> topTaskTracker.onTaskChanged(taskInfo));
+ }
});
// We may receive onRunningTaskAppeared events later for tasks which have already been
// included in the list returned by mSysUiProxy.getRunningTasks(), or may receive
diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java
index b19f651..6075294 100644
--- a/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -70,6 +70,7 @@
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.taskbar.FallbackTaskbarUIController;
import com.android.launcher3.taskbar.TaskbarManager;
+import com.android.launcher3.taskbar.TaskbarUIController;
import com.android.launcher3.util.ActivityOptionsWrapper;
import com.android.launcher3.util.ContextTracker;
import com.android.launcher3.util.RunnableList;
@@ -115,7 +116,7 @@
private FallbackRecentsView mFallbackRecentsView;
private OverviewActionsView<?> mActionsView;
private TISBindHelper mTISBindHelper;
- private @Nullable FallbackTaskbarUIController mTaskbarUIController;
+ private @Nullable FallbackTaskbarUIController<RecentsActivity> mTaskbarUIController;
private StateManager<RecentsState, RecentsActivity> mStateManager;
@@ -174,11 +175,14 @@
mTISBindHelper.runOnBindToTouchInteractionService(r);
}
- public void setTaskbarUIController(FallbackTaskbarUIController taskbarUIController) {
- mTaskbarUIController = taskbarUIController;
+ @Override
+ public void setTaskbarUIController(@Nullable TaskbarUIController taskbarUIController) {
+ mTaskbarUIController = (FallbackTaskbarUIController<RecentsActivity>) taskbarUIController;
}
- public FallbackTaskbarUIController getTaskbarUIController() {
+ @Nullable
+ @Override
+ public FallbackTaskbarUIController<RecentsActivity> getTaskbarUIController() {
return mTaskbarUIController;
}
@@ -515,6 +519,7 @@
}
@NonNull
+ @Override
public TISBindHelper getTISBindHelper() {
return mTISBindHelper;
}
diff --git a/quickstep/src/com/android/quickstep/TopTaskTracker.java b/quickstep/src/com/android/quickstep/TopTaskTracker.java
index 23a1ec7..71b6573 100644
--- a/quickstep/src/com/android/quickstep/TopTaskTracker.java
+++ b/quickstep/src/com/android/quickstep/TopTaskTracker.java
@@ -135,6 +135,15 @@
}
}
+ public void onTaskChanged(RunningTaskInfo taskInfo) {
+ for (int i = 0; i < mOrderedTaskList.size(); i++) {
+ if (mOrderedTaskList.get(i).taskId == taskInfo.taskId) {
+ mOrderedTaskList.set(i, taskInfo);
+ break;
+ }
+ }
+ }
+
@Override
public void onTaskStageChanged(int taskId, @StageType int stage, boolean visible) {
// If a task is not visible anymore or has been moved to undefined, stop tracking it.
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 032e755..e8f38be 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -776,10 +776,13 @@
mAllAppsActionManager.setHomeAndOverviewSame(isHomeAndOverviewSame);
RecentsViewContainer newOverviewContainer =
mOverviewComponentObserver.getContainerInterface().getCreatedContainer();
- if (newOverviewContainer != null
- && newOverviewContainer instanceof StatefulActivity activity) {
- //TODO(b/368030750) refactor taskbarManager to accept RecentsViewContainer
- mTaskbarManager.setActivity(activity);
+ if (newOverviewContainer != null) {
+ if (newOverviewContainer instanceof StatefulActivity activity) {
+ // This will also call setRecentsViewContainer() internally.
+ mTaskbarManager.setActivity(activity);
+ } else {
+ mTaskbarManager.setRecentsViewContainer(newOverviewContainer);
+ }
}
mTISBinder.onOverviewTargetChange();
}
diff --git a/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt b/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt
index 74f9901..78224ae 100644
--- a/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt
+++ b/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt
@@ -40,6 +40,7 @@
import com.android.launcher3.statemanager.StateManager
import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory
import com.android.launcher3.statemanager.StatefulContainer
+import com.android.launcher3.taskbar.TaskbarUIController
import com.android.launcher3.util.ContextTracker
import com.android.launcher3.util.DisplayController
import com.android.launcher3.util.RunnableList
@@ -117,6 +118,7 @@
private var callbacks: RecentsAnimationCallbacks? = null
+ private var taskbarUIController: TaskbarUIController? = null
private var tisBindHelper: TISBindHelper = TISBindHelper(this) {}
// Callback array that corresponds to events defined in @ActivityEvent
@@ -290,6 +292,18 @@
return tisBindHelper.desktopVisibilityController
}
+ override fun setTaskbarUIController(taskbarUIController: TaskbarUIController?) {
+ this.taskbarUIController = taskbarUIController
+ }
+
+ override fun getTaskbarUIController(): TaskbarUIController? {
+ return taskbarUIController
+ }
+
+ override fun getTISBindHelper(): TISBindHelper {
+ return tisBindHelper
+ }
+
fun registerInitListener(onInitListener: Predicate<Boolean>) {
this.onInitListener = onInitListener
}
diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskContentView.kt b/quickstep/src/com/android/quickstep/views/DesktopTaskContentView.kt
new file mode 100644
index 0000000..481acac
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/views/DesktopTaskContentView.kt
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2024 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.quickstep.views
+
+import android.content.Context
+import android.graphics.Outline
+import android.graphics.Rect
+import android.util.AttributeSet
+import android.view.View
+import android.view.ViewOutlineProvider
+import android.widget.FrameLayout
+import com.android.quickstep.views.TaskView.FullscreenDrawParams
+
+class DesktopTaskContentView
+@JvmOverloads
+constructor(context: Context, attrs: AttributeSet? = null) : FrameLayout(context, attrs) {
+ private val currentFullscreenParams = FullscreenDrawParams(context)
+ private val taskCornerRadius: Float
+ get() = currentFullscreenParams.cornerRadius
+
+ private val bounds = Rect()
+
+ init {
+ clipToOutline = true
+ outlineProvider =
+ object : ViewOutlineProvider() {
+ override fun getOutline(view: View, outline: Outline) {
+ outline.setRoundRect(bounds, taskCornerRadius)
+ }
+ }
+ }
+
+ override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
+ super.onSizeChanged(w, h, oldw, oldh)
+ bounds.set(0, 0, w, h)
+ invalidateOutline()
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
index 15b0a6b..5e842aa 100644
--- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
@@ -26,6 +26,7 @@
import android.util.Log
import android.view.Gravity
import android.view.View
+import android.widget.FrameLayout
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.updateLayoutParams
import com.android.launcher3.Flags.enableRefactorTaskThumbnail
@@ -81,12 +82,12 @@
private val tempRect = Rect()
private lateinit var backgroundView: View
private lateinit var iconView: TaskViewIcon
- private var childCountAtInflation = 0
+ private lateinit var contentView: FrameLayout
override fun onFinishInflate() {
super.onFinishInflate()
backgroundView =
- findViewById<View>(R.id.background)!!.apply {
+ findViewById<View>(R.id.background).apply {
updateLayoutParams<LayoutParams> {
topMargin = container.deviceProfile.overviewTaskThumbnailTopMarginPx
}
@@ -113,7 +114,12 @@
)
setText(resources.getText(R.string.recent_task_desktop))
}
- childCountAtInflation = childCount
+ contentView =
+ findViewById<FrameLayout>(R.id.desktop_content).apply {
+ updateLayoutParams<LayoutParams> {
+ topMargin = container.deviceProfile.overviewTaskThumbnailTopMarginPx
+ }
+ }
}
/** Updates this desktop task to the gives task list defined in `tasks` */
@@ -137,13 +143,8 @@
} else {
taskThumbnailViewDeprecatedPool!!.view
}
+ contentView.addView(snapshotView, 0)
- addView(
- snapshotView,
- // Add snapshotView to the front after initial views e.g. icon and
- // background.
- childCountAtInflation,
- )
TaskContainer(
this,
task,
@@ -164,7 +165,7 @@
super.onRecycle()
visibility = VISIBLE
taskContainers.forEach {
- removeView(it.snapshotView)
+ contentView.removeView(it.snapshotView)
if (enableRefactorTaskThumbnail()) {
taskThumbnailViewPool!!.recycle(it.thumbnailView)
} else {
@@ -227,9 +228,7 @@
width = (taskSize.width() * scaleWidth).toInt()
height = (taskSize.height() * scaleHeight).toInt()
leftMargin = (positionInParent.x * scaleWidth).toInt()
- topMargin =
- (positionInParent.y * scaleHeight).toInt() +
- container.deviceProfile.overviewTaskThumbnailTopMarginPx
+ topMargin = (positionInParent.y * scaleHeight).toInt()
}
if (DEBUG) {
with(it.snapshotView.layoutParams as LayoutParams) {
diff --git a/quickstep/src/com/android/quickstep/views/RecentsViewContainer.java b/quickstep/src/com/android/quickstep/views/RecentsViewContainer.java
index d8036aa..b04753b 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsViewContainer.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsViewContainer.java
@@ -16,8 +16,6 @@
package com.android.quickstep.views;
-import android.app.Activity;
-import android.content.ComponentName;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.LocusId;
@@ -27,13 +25,16 @@
import android.view.View;
import android.view.Window;
+import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.launcher3.BaseActivity;
import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.statehandlers.DesktopVisibilityController;
+import com.android.launcher3.taskbar.TaskbarUIController;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.ScrimView;
+import com.android.quickstep.util.TISBindHelper;
/**
* Interface to be implemented by the parent view of RecentsView
@@ -212,4 +213,10 @@
@Nullable
DesktopVisibilityController getDesktopVisibilityController();
+
+ void setTaskbarUIController(@Nullable TaskbarUIController taskbarUIController);
+
+ @Nullable TaskbarUIController getTaskbarUIController();
+
+ @NonNull TISBindHelper getTISBindHelper();
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskContainer.kt b/quickstep/src/com/android/quickstep/views/TaskContainer.kt
index 959516f..25aba39 100644
--- a/quickstep/src/com/android/quickstep/views/TaskContainer.kt
+++ b/quickstep/src/com/android/quickstep/views/TaskContainer.kt
@@ -151,7 +151,7 @@
if (enableRefactorTaskThumbnail()) {
bindThumbnailView()
} else {
- thumbnailViewDeprecated.bind(task, overlay)
+ thumbnailViewDeprecated.bind(task, overlay, taskView)
}
overlay.init()
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailViewDeprecated.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailViewDeprecated.java
index 56ca043..5dbc2ef 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailViewDeprecated.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailViewDeprecated.java
@@ -110,6 +110,7 @@
private TaskView.FullscreenDrawParams mFullscreenParams;
private ImageView mSplashView;
private Drawable mSplashViewDrawable;
+ private TaskView mTaskView;
@Nullable
private Task mTask;
@@ -153,10 +154,11 @@
/**
* Updates the thumbnail to draw the provided task
*/
- public void bind(Task task, TaskOverlay<?> overlay) {
+ public void bind(Task task, TaskOverlay<?> overlay, TaskView taskView) {
mOverlay = overlay;
mOverlay.reset();
mTask = task;
+ mTaskView = taskView;
int color = task == null ? Color.BLACK : task.colorBackground | 0xFF000000;
mPaint.setColor(color);
mBackgroundPaint.setColor(color);
@@ -292,8 +294,8 @@
public void drawOnCanvas(Canvas canvas, float x, float y, float width, float height,
float cornerRadius) {
- if (mTask != null && getTaskView().isRunningTask()
- && !getTaskView().getShouldShowScreenshot()) {
+ if (mTask != null && mTaskView.isRunningTask()
+ && !mTaskView.getShouldShowScreenshot()) {
canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mClearPaint);
canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius,
mDimmingPaintAfterClearing);
@@ -334,10 +336,6 @@
}
}
- public TaskView getTaskView() {
- return (TaskView) getParent();
- }
-
public void setOverlayEnabled(boolean overlayEnabled) {
if (mOverlayEnabled != overlayEnabled) {
mOverlayEnabled = overlayEnabled;
@@ -390,9 +388,9 @@
float viewCenterY = viewHeight / 2f;
float centeredDrawableLeft = (viewWidth - drawableWidth) / 2f;
float centeredDrawableTop = (viewHeight - drawableHeight) / 2f;
- float nonGridScale = getTaskView() == null ? 1 : 1 / getTaskView().getNonGridScale();
- float recentsMaxScale = getTaskView() == null || getTaskView().getRecentsView() == null
- ? 1 : 1 / getTaskView().getRecentsView().getMaxScaleForFullScreen();
+ float nonGridScale = mTaskView == null ? 1 : 1 / mTaskView.getNonGridScale();
+ float recentsMaxScale = mTaskView == null || mTaskView.getRecentsView() == null
+ ? 1 : 1 / mTaskView.getRecentsView().getMaxScaleForFullScreen();
float scaleX = nonGridScale * recentsMaxScale * (1 / getScaleX());
float scaleY = nonGridScale * recentsMaxScale * (1 / getScaleY());
@@ -419,7 +417,7 @@
}
private boolean isThumbnailRotationDifferentFromTask() {
- RecentsView recents = getTaskView().getRecentsView();
+ RecentsView recents = mTaskView.getRecentsView();
if (recents == null || mThumbnailData == null) {
return false;
}
@@ -467,7 +465,7 @@
if (mBitmapShader != null && mThumbnailData != null) {
mPreviewRect.set(0, 0, mThumbnailData.getThumbnail().getWidth(),
mThumbnailData.getThumbnail().getHeight());
- int currentRotation = getTaskView().getOrientedState().getRecentsActivityRotation();
+ int currentRotation = mTaskView.getOrientedState().getRecentsActivityRotation();
boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
mPreviewPositionHelper.updateThumbnailMatrix(mPreviewRect, mThumbnailData,
getMeasuredWidth(), getMeasuredHeight(), dp.isTablet, currentRotation, isRtl);
@@ -475,7 +473,7 @@
mBitmapShader.setLocalMatrix(mPreviewPositionHelper.getMatrix());
mPaint.setShader(mBitmapShader);
}
- getTaskView().updateCurrentFullscreenParams();
+ mTaskView.updateCurrentFullscreenParams();
invalidate();
}
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutControllerTest.kt
index fef82c1..2997ac9 100644
--- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutControllerTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutControllerTest.kt
@@ -76,7 +76,7 @@
@Test
fun flyoutPosition_left() {
InstrumentationRegistry.getInstrumentation().runOnMainSync {
- flyoutController.setUpAndShowFlyout(flyoutMessage) {}
+ setupAndShowFlyout()
assertThat(flyoutContainer.childCount).isEqualTo(1)
val flyout = flyoutContainer.getChildAt(0)
val lp = flyout.layoutParams as FrameLayout.LayoutParams
@@ -89,7 +89,7 @@
fun flyoutPosition_right() {
onLeft = false
InstrumentationRegistry.getInstrumentation().runOnMainSync {
- flyoutController.setUpAndShowFlyout(flyoutMessage) {}
+ setupAndShowFlyout()
assertThat(flyoutContainer.childCount).isEqualTo(1)
val flyout = flyoutContainer.getChildAt(0)
val lp = flyout.layoutParams as FrameLayout.LayoutParams
@@ -101,7 +101,7 @@
@Test
fun flyoutMessage() {
InstrumentationRegistry.getInstrumentation().runOnMainSync {
- flyoutController.setUpAndShowFlyout(flyoutMessage) {}
+ setupAndShowFlyout()
assertThat(flyoutContainer.childCount).isEqualTo(1)
val flyout = flyoutContainer.getChildAt(0)
val sender = flyout.findViewById<TextView>(R.id.bubble_flyout_title)
@@ -114,7 +114,7 @@
@Test
fun hideFlyout_removedFromContainer() {
InstrumentationRegistry.getInstrumentation().runOnMainSync {
- flyoutController.setUpAndShowFlyout(flyoutMessage) {}
+ setupAndShowFlyout()
assertThat(flyoutController.hasFlyout()).isTrue()
assertThat(flyoutContainer.childCount).isEqualTo(1)
flyoutController.collapseFlyout {}
@@ -130,7 +130,7 @@
// boundary
flyoutTy = -50f
InstrumentationRegistry.getInstrumentation().runOnMainSync {
- flyoutController.setUpAndShowFlyout(flyoutMessage) {}
+ setupAndShowFlyout()
assertThat(flyoutContainer.childCount).isEqualTo(1)
}
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
@@ -143,7 +143,7 @@
@Test
fun showFlyout_withinBoundary() {
InstrumentationRegistry.getInstrumentation().runOnMainSync {
- flyoutController.setUpAndShowFlyout(flyoutMessage) {}
+ setupAndShowFlyout()
assertThat(flyoutContainer.childCount).isEqualTo(1)
}
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
@@ -156,7 +156,7 @@
@Test
fun collapseFlyout_resetsTopBoundary() {
InstrumentationRegistry.getInstrumentation().runOnMainSync {
- flyoutController.setUpAndShowFlyout(flyoutMessage) {}
+ setupAndShowFlyout()
assertThat(flyoutContainer.childCount).isEqualTo(1)
flyoutController.collapseFlyout {}
animatorTestRule.advanceTimeBy(300)
@@ -167,7 +167,7 @@
@Test
fun cancelFlyout_fadesOutFlyout() {
InstrumentationRegistry.getInstrumentation().runOnMainSync {
- flyoutController.setUpAndShowFlyout(flyoutMessage) {}
+ setupAndShowFlyout()
assertThat(flyoutContainer.childCount).isEqualTo(1)
val flyoutView = flyoutContainer.findViewById<View>(R.id.bubble_bar_flyout_view)
assertThat(flyoutView.alpha).isEqualTo(1f)
@@ -181,7 +181,7 @@
@Test
fun clickFlyout_notifiesCallback() {
InstrumentationRegistry.getInstrumentation().runOnMainSync {
- flyoutController.setUpAndShowFlyout(flyoutMessage) {}
+ setupAndShowFlyout()
assertThat(flyoutContainer.childCount).isEqualTo(1)
val flyoutView = flyoutContainer.findViewById<View>(R.id.bubble_bar_flyout_view)
assertThat(flyoutView.alpha).isEqualTo(1f)
@@ -194,7 +194,7 @@
@Test
fun updateFlyoutWhileExpanding() {
InstrumentationRegistry.getInstrumentation().runOnMainSync {
- flyoutController.setUpAndShowFlyout(flyoutMessage) {}
+ setupAndShowFlyout()
assertThat(flyoutController.hasFlyout()).isTrue()
val flyout = flyoutContainer.findViewById<View>(R.id.bubble_bar_flyout_view)
assertThat(flyout.findViewById<TextView>(R.id.bubble_flyout_text).text)
@@ -220,7 +220,7 @@
@Test
fun updateFlyoutFullyExpanded() {
InstrumentationRegistry.getInstrumentation().runOnMainSync {
- flyoutController.setUpAndShowFlyout(flyoutMessage) {}
+ setupAndShowFlyout()
animatorTestRule.advanceTimeBy(300)
}
assertThat(flyoutController.hasFlyout()).isTrue()
@@ -249,7 +249,7 @@
@Test
fun updateFlyoutWhileCollapsing() {
InstrumentationRegistry.getInstrumentation().runOnMainSync {
- flyoutController.setUpAndShowFlyout(flyoutMessage) {}
+ setupAndShowFlyout()
animatorTestRule.advanceTimeBy(300)
}
assertThat(flyoutController.hasFlyout()).isTrue()
@@ -280,6 +280,10 @@
assertThat(flyoutController.hasFlyout()).isTrue()
}
+ private fun setupAndShowFlyout() {
+ flyoutController.setUpAndShowFlyout(flyoutMessage, {}, {})
+ }
+
class FakeFlyoutCallbacks : FlyoutCallbacks {
var topBoundaryExtendedSpace = 0
diff --git a/quickstep/tests/src/com/android/launcher3/taskbar/FallbackTaskbarUIControllerTest.kt b/quickstep/tests/src/com/android/launcher3/taskbar/FallbackTaskbarUIControllerTest.kt
index 04012c0..df98606 100644
--- a/quickstep/tests/src/com/android/launcher3/taskbar/FallbackTaskbarUIControllerTest.kt
+++ b/quickstep/tests/src/com/android/launcher3/taskbar/FallbackTaskbarUIControllerTest.kt
@@ -33,7 +33,7 @@
@RunWith(AndroidJUnit4::class)
class FallbackTaskbarUIControllerTest : TaskbarBaseTestCase() {
- lateinit var fallbackTaskbarUIController: FallbackTaskbarUIController
+ lateinit var fallbackTaskbarUIController: FallbackTaskbarUIController<RecentsActivity>
lateinit var stateListener: StateManager.StateListener<RecentsState>
private val recentsActivity: RecentsActivity = mock()
diff --git a/res/values-fr-rCA/strings.xml b/res/values-fr-rCA/strings.xml
index cae77dc..a941d88 100644
--- a/res/values-fr-rCA/strings.xml
+++ b/res/values-fr-rCA/strings.xml
@@ -192,7 +192,7 @@
<string name="private_space_label" msgid="2359721649407947001">"Espace privé"</string>
<string name="private_space_secondary_label" msgid="9203933341714508907">"Touchez pour configurer ou ouvrir"</string>
<string name="ps_container_title" msgid="4391796149519594205">"Privé"</string>
- <string name="ps_container_settings" msgid="6059734123353320479">"Paramètres de l\'Espace privé"</string>
+ <string name="ps_container_settings" msgid="6059734123353320479">"Paramètres de l\'espace privé"</string>
<string name="ps_container_unlock_button_content_description" msgid="9181551784092204234">"Privé, déverrouillé."</string>
<string name="ps_container_lock_button_content_description" msgid="5961993384382649530">"Privé, verrouillé."</string>
<string name="ps_container_lock_title" msgid="2640257399982364682">"Verrouiller"</string>
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index 731f839..9cdb5aa 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -192,7 +192,7 @@
<string name="private_space_label" msgid="2359721649407947001">"Spazio privato"</string>
<string name="private_space_secondary_label" msgid="9203933341714508907">"Tocca per configurare o aprire"</string>
<string name="ps_container_title" msgid="4391796149519594205">"Privato"</string>
- <string name="ps_container_settings" msgid="6059734123353320479">"Impostazioni dello Spazio privato"</string>
+ <string name="ps_container_settings" msgid="6059734123353320479">"Impostazioni dello spazio privato"</string>
<string name="ps_container_unlock_button_content_description" msgid="9181551784092204234">"Privato, sbloccato."</string>
<string name="ps_container_lock_button_content_description" msgid="5961993384382649530">"Privato, bloccato."</string>
<string name="ps_container_lock_title" msgid="2640257399982364682">"Blocca"</string>