Adding support for customizing shortcut pinning logic
> Allowing support for overring shortcut badge
> Updating pendingShortcutInfo so that the
handler can be easily overridden
Bug: 268253894
Test: Verified on device
Change-Id: I3184cb6494bc98c7eed33798b35b4e6e6a1e7ddc
diff --git a/src/com/android/launcher3/PendingAddItemInfo.java b/src/com/android/launcher3/PendingAddItemInfo.java
index b7a22fc..000ddd8 100644
--- a/src/com/android/launcher3/PendingAddItemInfo.java
+++ b/src/com/android/launcher3/PendingAddItemInfo.java
@@ -21,7 +21,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.model.data.ItemInfoWithIcon;
import java.util.Optional;
@@ -29,13 +29,20 @@
* Meta data that is used for deferred binding. e.g., this object is used to pass information on
* draggable targets when they are dropped onto the workspace from another container.
*/
-public class PendingAddItemInfo extends ItemInfo {
+public class PendingAddItemInfo extends ItemInfoWithIcon {
/**
* The component that will be created.
*/
public ComponentName componentName;
+ public PendingAddItemInfo() { }
+
+ public PendingAddItemInfo(PendingAddItemInfo info) {
+ super(info);
+ componentName = info.componentName;
+ }
+
@Override
protected String dumpProperties() {
return super.dumpProperties() + " componentName=" + componentName;
@@ -46,13 +53,18 @@
*/
@NonNull
@Override
- public ItemInfo makeShallowCopy() {
+ public PendingAddItemInfo makeShallowCopy() {
PendingAddItemInfo itemInfo = new PendingAddItemInfo();
itemInfo.copyFrom(this);
itemInfo.componentName = this.componentName;
return itemInfo;
}
+ @Override
+ public PendingAddItemInfo clone() {
+ return makeShallowCopy();
+ }
+
@Nullable
@Override
public ComponentName getTargetComponent() {