Merge "[a11y] Add FLAG_NOT_PINNABLE and modify supportAddToWorkSpace." into udc-d1-dev

This commit is contained in:
Holly Jiuyu Sun
2023-06-26 21:56:11 +00:00
committed by Android (Google) Code Review
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.