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-05-09 14:59:45 -07:00
parent 29b86863f2
commit 424d5686e4
2 changed files with 19 additions and 1 deletions
@@ -523,8 +523,9 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
}
private void setNonPendingIcon(ItemInfoWithIcon info) {
boolean isPrivateSpaceIcon = Objects.equals(info.getTargetPackage(), PRIVATE_SPACE_PACKAGE);
// Set nonPendingIcon acts as a restart which should refresh the flag state when applicable.
int flags = Objects.equals(info.getTargetPackage(), PRIVATE_SPACE_PACKAGE)
int flags = isPrivateSpaceIcon
? info.bitmap.creationFlags : shouldUseTheme() ? FLAG_THEMED : 0;
// Remove badge on icons smaller than 48dp.
if (mHideBadge || mDisplay == DISPLAY_SEARCH_RESULT_SMALL) {
@@ -536,6 +537,9 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver,
FastBitmapDrawable iconDrawable = info.newIcon(getContext(), flags);
mDotParams.appColor = iconDrawable.getIconColor();
mDotParams.dotColor = Themes.getAttrColor(getContext(), R.attr.notificationDotColor);
if (isPrivateSpaceIcon) {
iconDrawable.setAnimationEnabled(false);
}
setIcon(iconDrawable);
}
@@ -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");
}