Merge "Change PS app behavior when clicking" into main

This commit is contained in:
Brandon Dayauon
2025-05-10 03:11:55 -07:00
committed by Android (Google) Code Review
2 changed files with 19 additions and 1 deletions

View File

@@ -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);
}

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");
}