summaryrefslogtreecommitdiff
path: root/src/com/android
diff options
context:
space:
mode:
authorHolly Sun <jiuyu@google.com>2023-06-22 14:55:32 -0700
committerHolly Jiuyu Sun <jiuyu@google.com>2023-06-26 16:52:53 +0000
commitc3127d29b28ed2a7e1806cd2c0b2bd0c1d25fd06 (patch)
tree6739c10573d1f33344eeab60e14a30df7f30e8a6 /src/com/android
parentacced493f444fba2e86af8dad4d5ae261f391be7 (diff)
downloadLauncher3-c3127d29b28ed2a7e1806cd2c0b2bd0c1d25fd06.tar.gz
[a11y] Add FLAG_NOT_PINNABLE and modify `supportAddToWorkSpace`.
// play uninstalled app Bug: 286998395 Bug: 287156208 Bug: 287157282 // contact Bug: 287362865 Bug: 287370843 Bug: 287372663 // clock Bug: 287166186 Bug: 287166771 Bug: 287167527 Test: manual Flag: N/A Change-Id: I859deba6218e232a232f009793044ca4be2cab19
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java12
-rw-r--r--src/com/android/launcher3/model/data/ItemInfoWithIcon.java5
2 files changed, 15 insertions, 2 deletions
diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
index a7a25f4dce..758bffbeb8 100644
--- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
@@ -7,6 +7,7 @@ import static android.view.accessibility.AccessibilityNodeInfo.ACTION_LONG_CLICK
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE;
+import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_NOT_PINNABLE;
import android.appwidget.AppWidgetProviderInfo;
import android.graphics.Point;
@@ -124,12 +125,19 @@ public class LauncherAccessibilityDelegate extends BaseAccessibilityDelegate<Lau
}
}
- if ((item instanceof WorkspaceItemFactory) || (item instanceof WorkspaceItemInfo)
- || (item instanceof PendingAddItemInfo)) {
+ if (supportAddToWorkSpace(item)) {
out.add(mActions.get(ADD_TO_WORKSPACE));
}
}
+ private boolean supportAddToWorkSpace(ItemInfo item) {
+ return (item instanceof WorkspaceItemFactory)
+ || ((item instanceof WorkspaceItemInfo)
+ && (((WorkspaceItemInfo) item).runtimeStatusFlags & FLAG_NOT_PINNABLE) == 0)
+ || ((item instanceof PendingAddItemInfo)
+ && (((PendingAddItemInfo) item).runtimeStatusFlags & FLAG_NOT_PINNABLE) == 0);
+ }
+
/**
* Returns all the accessibility actions that can be handled by the host.
*/
diff --git a/src/com/android/launcher3/model/data/ItemInfoWithIcon.java b/src/com/android/launcher3/model/data/ItemInfoWithIcon.java
index e5fb015f2e..b4a935a74a 100644
--- a/src/com/android/launcher3/model/data/ItemInfoWithIcon.java
+++ b/src/com/android/launcher3/model/data/ItemInfoWithIcon.java
@@ -119,6 +119,11 @@ public abstract class ItemInfoWithIcon extends ItemInfo {
| FLAG_DISABLED_VERSION_LOWER;
/**
+ * Flag indicating this item can't be pinned to home screen.
+ */
+ public static final int FLAG_NOT_PINNABLE = 1 << 13;
+
+ /**
* Status associated with the system state of the underlying item. This is calculated every
* time a new info is created and not persisted on the disk.
*/