Merge "Fix bug where Taskbar was not auto-hiding after splitscreen launch from icon menu" into tm-qpr-dev am: 3c8def9f88 am: ce97be3d12

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/22077752

Change-Id: I38ab3fedc4a6cbb164a8b0f8e5a8be8f1c4a4aea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jeremy Sim
2023-03-22 00:15:48 +00:00
committed by Automerger Merge Worker
6 changed files with 37 additions and 19 deletions
@@ -65,4 +65,10 @@ public abstract class BaseTaskbarContext extends ContextThemeWrapper implements
/** Callback invoked when a popup is shown or closed within this context. */ /** Callback invoked when a popup is shown or closed within this context. */
public abstract void onPopupVisibilityChanged(boolean isVisible); public abstract void onPopupVisibilityChanged(boolean isVisible);
/**
* Callback invoked when user attempts to split the screen through a long-press menu in Taskbar
* or AllApps.
*/
public abstract void onSplitScreenMenuButtonClicked();
} }
@@ -80,6 +80,7 @@ import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.FolderInfo;
import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.popup.PopupDataProvider; import com.android.launcher3.popup.PopupDataProvider;
import com.android.launcher3.taskbar.TaskbarAutohideSuspendController.AutohideSuspendFlag; import com.android.launcher3.taskbar.TaskbarAutohideSuspendController.AutohideSuspendFlag;
import com.android.launcher3.taskbar.TaskbarTranslationController.TransitionCallback; import com.android.launcher3.taskbar.TaskbarTranslationController.TransitionCallback;
@@ -525,6 +526,16 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
setTaskbarWindowFocusable(isVisible); setTaskbarWindowFocusable(isVisible);
} }
@Override
public void onSplitScreenMenuButtonClicked() {
PopupContainerWithArrow popup = PopupContainerWithArrow.getOpen(this);
if (popup != null) {
popup.addOnCloseCallback(() -> {
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
});
}
}
/** /**
* Sets a new data-source for this taskbar instance * Sets a new data-source for this taskbar instance
*/ */
@@ -65,6 +65,7 @@ import java.util.stream.Stream;
/** /**
* Implements interfaces required to show and allow interacting with a PopupContainerWithArrow. * Implements interfaces required to show and allow interacting with a PopupContainerWithArrow.
* Controls the long-press menu on Taskbar and AllApps icons.
*/ */
public class TaskbarPopupController implements TaskbarControllers.LoggableTaskbarController { public class TaskbarPopupController implements TaskbarControllers.LoggableTaskbarController {
@@ -191,9 +192,8 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
// Make focusable to receive back events // Make focusable to receive back events
context.onPopupVisibilityChanged(true); context.onPopupVisibilityChanged(true);
container.setOnCloseCallback(() -> { container.addOnCloseCallback(() -> {
context.getDragLayer().post(() -> context.onPopupVisibilityChanged(false)); context.getDragLayer().post(() -> context.onPopupVisibilityChanged(false));
container.setOnCloseCallback(null);
}); });
return container; return container;
@@ -294,13 +294,19 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
@Override @Override
public void onClick(View view) { public void onClick(View view) {
// Add callbacks depending on what type of Taskbar context we're in (Taskbar or AllApps)
mTarget.onSplitScreenMenuButtonClicked();
AbstractFloatingView.closeAllOpenViews(mTarget); AbstractFloatingView.closeAllOpenViews(mTarget);
// Depending on what app state we're in, we either want to initiate the split screen
// staging process or immediately launch a split with an existing app.
// - Initiate the split screen staging process
if (mAllowInitialSplitSelection) { if (mAllowInitialSplitSelection) {
super.onClick(view); super.onClick(view);
return; return;
} }
// Initiate splitscreen from the in-app Taskbar or Taskbar All Apps // - Immediately launch split with the running app
Pair<InstanceId, com.android.launcher3.logging.InstanceId> instanceIds = Pair<InstanceId, com.android.launcher3.logging.InstanceId> instanceIds =
LogUtils.getShellShareableInstanceId(); LogUtils.getShellShareableInstanceId();
mTarget.getStatsLogManager().logger() mTarget.getStatsLogManager().logger()
@@ -15,8 +15,6 @@
*/ */
package com.android.launcher3.taskbar.overlay; package com.android.launcher3.taskbar.overlay;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import android.content.Context; import android.content.Context;
import android.view.View; import android.view.View;
@@ -33,10 +31,6 @@ import com.android.launcher3.taskbar.TaskbarStashController;
import com.android.launcher3.taskbar.TaskbarUIController; import com.android.launcher3.taskbar.TaskbarUIController;
import com.android.launcher3.taskbar.allapps.TaskbarAllAppsContainerView; import com.android.launcher3.taskbar.allapps.TaskbarAllAppsContainerView;
import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource; import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.recents.model.Task;
import java.util.function.Consumer;
/** /**
* Window context for the taskbar overlays such as All Apps and EDU. * Window context for the taskbar overlays such as All Apps and EDU.
@@ -141,4 +135,8 @@ public class TaskbarOverlayContext extends BaseTaskbarContext {
@Override @Override
public void onPopupVisibilityChanged(boolean isVisible) {} public void onPopupVisibilityChanged(boolean isVisible) {}
@Override
public void onSplitScreenMenuButtonClicked() {
}
} }
@@ -174,7 +174,7 @@ public class LauncherAccessibilityDelegate extends BaseAccessibilityDelegate<Lau
mContext.getDragLayer().getDescendantRectRelativeToSelf(host, pos); mContext.getDragLayer().getDescendantRectRelativeToSelf(host, pos);
ArrowPopup popup = OptionsPopupView.show(mContext, new RectF(pos), actions, false); ArrowPopup popup = OptionsPopupView.show(mContext, new RectF(pos), actions, false);
popup.requestFocus(); popup.requestFocus();
popup.setOnCloseCallback(() -> { popup.addOnCloseCallback(() -> {
host.requestFocus(); host.requestFocus();
host.sendAccessibilityEvent(TYPE_VIEW_FOCUSED); host.sendAccessibilityEvent(TYPE_VIEW_FOCUSED);
host.performAccessibilityAction(ACTION_ACCESSIBILITY_FOCUS, null); host.performAccessibilityAction(ACTION_ACCESSIBILITY_FOCUS, null);
@@ -48,14 +48,13 @@ import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator; import android.view.animation.PathInterpolator;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.InsettableFrameLayout; import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.R; import com.android.launcher3.R;
import com.android.launcher3.Utilities; import com.android.launcher3.Utilities;
import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.shortcuts.DeepShortcutView; import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.util.RunnableList;
import com.android.launcher3.util.Themes; import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext; import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.BaseDragLayer; import com.android.launcher3.views.BaseDragLayer;
@@ -124,7 +123,7 @@ public abstract class ArrowPopup<T extends Context & ActivityContext>
private final GradientDrawable mRoundedTop; private final GradientDrawable mRoundedTop;
private final GradientDrawable mRoundedBottom; private final GradientDrawable mRoundedBottom;
@Nullable private Runnable mOnCloseCallback = null; private RunnableList mOnCloseCallbacks = new RunnableList();
// The rect string of the view that the arrow is attached to, in screen reference frame. // The rect string of the view that the arrow is attached to, in screen reference frame.
protected int mArrowColor; protected int mArrowColor;
@@ -785,16 +784,14 @@ public abstract class ArrowPopup<T extends Context & ActivityContext>
mDeferContainerRemoval = false; mDeferContainerRemoval = false;
getPopupContainer().removeView(this); getPopupContainer().removeView(this);
getPopupContainer().removeView(mArrow); getPopupContainer().removeView(mArrow);
if (mOnCloseCallback != null) { mOnCloseCallbacks.executeAllAndClear();
mOnCloseCallback.run();
}
} }
/** /**
* Callback to be called when the popup is closed * Callbacks to be called when the popup is closed
*/ */
public void setOnCloseCallback(@Nullable Runnable callback) { public void addOnCloseCallback(Runnable callback) {
mOnCloseCallback = callback; mOnCloseCallbacks.add(callback);
} }
protected BaseDragLayer getPopupContainer() { protected BaseDragLayer getPopupContainer() {