Change PS app behavior when clicking

It should show the shortcuts upon tap and not animate like if you were to longpress to shortcuts on a regular app.

bug: 406724060
Test: manually video: https://drive.google.com/file/d/1ldodFhr00lTJ5583VxMe7PasZ0jre6wd/view?usp=sharing
Flag: android.multiuser.enable_moving_content_into_private_space
Change-Id: I5762689290b4078f9b1b4fdfd09fb2cef482744a
This commit is contained in:
Brandon Dayauon
2025-03-29 00:37:19 +00:00
parent 29b86863f2
commit 424d5686e4
2 changed files with 19 additions and 1 deletions

View File

@@ -15,8 +15,12 @@
*/
package com.android.launcher3.touch;
import static android.multiuser.Flags.enableMovingContentIntoPrivateSpace;
import static com.android.launcher3.LauncherConstants.ActivityCodes.REQUEST_BIND_PENDING_APPWIDGET;
import static com.android.launcher3.LauncherConstants.ActivityCodes.REQUEST_RECONFIGURE_APPWIDGET;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
import static com.android.launcher3.allapps.AlphabeticalAppsList.PRIVATE_SPACE_PACKAGE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_PRIVATE_SPACE_INSTALL_APP_BUTTON_TAP;
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_BY_PUBLISHER;
@@ -72,6 +76,7 @@ import com.android.launcher3.widget.WidgetAddFlowHandler;
import com.android.launcher3.widget.WidgetManagerHelper;
import java.util.Collections;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
@@ -392,6 +397,15 @@ public class ItemClickHandler {
LAUNCHER_PRIVATE_SPACE_INSTALL_APP_BUTTON_TAP);
}
}
if (enableMovingContentIntoPrivateSpace() &&
Objects.equals(item.getTargetPackage(), PRIVATE_SPACE_PACKAGE)
&& item.itemType != ITEM_TYPE_DEEP_SHORTCUT) {
// Only show the popup menu when clicking on the icon itself.
if (v instanceof BubbleTextView btv) {
btv.startLongPressAction();
return;
}
}
if (intent == null) {
throw new IllegalArgumentException("Input must have a valid intent");
}