[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
This commit is contained in:
Holly Sun
2023-06-22 14:55:32 -07:00
parent a3808a8e33
commit 40df2fc8d8
2 changed files with 15 additions and 2 deletions
@@ -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.
*/
@@ -118,6 +118,11 @@ public abstract class ItemInfoWithIcon extends ItemInfo {
| FLAG_DISABLED_QUIET_USER | FLAG_DISABLED_BY_PUBLISHER | FLAG_DISABLED_LOCKED_USER
| 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.