Loading src/com/android/launcher3/PendingAddItemInfo.java +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.launcher3; import android.content.ComponentName; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.model.data.ItemInfo; Loading @@ -43,6 +44,7 @@ public class PendingAddItemInfo extends ItemInfo { /** * Returns shallow copy of the object. */ @NonNull @Override public ItemInfo makeShallowCopy() { PendingAddItemInfo itemInfo = new PendingAddItemInfo(); Loading src/com/android/launcher3/model/ItemInstallQueue.java +1 −0 Original line number Diff line number Diff line Loading @@ -288,6 +288,7 @@ public class ItemInstallQueue { } @Override @Nullable public Intent getIntent() { return intent; } Loading src/com/android/launcher3/model/data/AppInfo.java +2 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.os.UserHandle; import android.os.UserManager; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.launcher3.LauncherSettings; Loading Loading @@ -65,6 +66,7 @@ public class AppInfo extends ItemInfoWithIcon implements WorkspaceItemFactory { } @Override @Nullable public Intent getIntent() { return intent; } Loading src/com/android/launcher3/model/data/FolderInfo.java +6 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static com.android.launcher3.logger.LauncherAtom.Attribute.SUGGESTED_LABE import android.os.Process; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.LauncherSettings; Loading Loading @@ -154,7 +155,7 @@ public class FolderInfo extends ItemInfo { } @Override public void onAddToDatabase(ContentWriter writer) { public void onAddToDatabase(@NonNull ContentWriter writer) { super.onAddToDatabase(writer); writer.put(LauncherSettings.Favorites.TITLE, title) .put(LauncherSettings.Favorites.OPTIONS, options); Loading Loading @@ -206,8 +207,9 @@ public class FolderInfo extends ItemInfo { return String.format("%s; labelState=%s", super.dumpProperties(), getLabelState()); } @NonNull @Override public LauncherAtom.ItemInfo buildProto(FolderInfo fInfo) { public LauncherAtom.ItemInfo buildProto(@Nullable FolderInfo fInfo) { FolderIcon.Builder folderIcon = FolderIcon.newBuilder() .setCardinality(contents.size()); if (LabelState.SUGGESTED.equals(getLabelState())) { Loading Loading @@ -261,6 +263,7 @@ public class FolderInfo extends ItemInfo { : LabelState.SUGGESTED; } @NonNull @Override public ItemInfo makeShallowCopy() { FolderInfo folderInfo = new FolderInfo(); Loading @@ -272,6 +275,7 @@ public class FolderInfo extends ItemInfo { /** * Returns {@link LauncherAtom.FolderIcon} wrapped as {@link LauncherAtom.ItemInfo} for logging. */ @NonNull @Override public LauncherAtom.ItemInfo buildProto() { return buildProto(null); Loading src/com/android/launcher3/model/data/ItemInfo.java +23 −7 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.content.Intent; import android.os.Process; import android.os.UserHandle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.LauncherSettings; Loading Loading @@ -141,30 +142,34 @@ public class ItemInfo { /** * Title of the item */ @Nullable public CharSequence title; /** * Content description of the item. */ @Nullable public CharSequence contentDescription; /** * When the instance is created using {@link #copyFrom}, this field is used to keep track of * original {@link ComponentName}. */ @Nullable private ComponentName mComponentName; @NonNull public UserHandle user; public ItemInfo() { user = Process.myUserHandle(); } protected ItemInfo(ItemInfo info) { protected ItemInfo(@NonNull final ItemInfo info) { copyFrom(info); } public void copyFrom(ItemInfo info) { public void copyFrom(@NonNull final ItemInfo info) { id = info.id; title = info.title; cellX = info.cellX; Loading @@ -182,6 +187,7 @@ public class ItemInfo { mComponentName = info.getTargetComponent(); } @Nullable public Intent getIntent() { return null; } Loading Loading @@ -209,7 +215,7 @@ public class ItemInfo { : null; } public void writeToValues(ContentWriter writer) { public void writeToValues(@NonNull final ContentWriter writer) { writer.put(LauncherSettings.Favorites.ITEM_TYPE, itemType) .put(LauncherSettings.Favorites.CONTAINER, container) .put(LauncherSettings.Favorites.SCREEN, screenId) Loading @@ -220,7 +226,7 @@ public class ItemInfo { .put(LauncherSettings.Favorites.RANK, rank); } public void readFromValues(ContentValues values) { public void readFromValues(@NonNull final ContentValues values) { itemType = values.getAsInteger(LauncherSettings.Favorites.ITEM_TYPE); container = values.getAsInteger(LauncherSettings.Favorites.CONTAINER); screenId = values.getAsInteger(LauncherSettings.Favorites.SCREEN); Loading @@ -234,7 +240,7 @@ public class ItemInfo { /** * Write the fields of this item to the DB */ public void onAddToDatabase(ContentWriter writer) { public void onAddToDatabase(@NonNull final ContentWriter writer) { if (Workspace.EXTRA_EMPTY_SCREEN_IDS.contains(screenId)) { // We should never persist an item on the extra empty screen. throw new RuntimeException("Screen id should not be extra empty screen: " + screenId); Loading @@ -245,10 +251,12 @@ public class ItemInfo { } @Override @NonNull public final String toString() { return getClass().getSimpleName() + "(" + dumpProperties() + ")"; } @NonNull protected String dumpProperties() { return "id=" + id + " type=" + LauncherSettings.Favorites.itemTypeToString(itemType) Loading Loading @@ -288,14 +296,17 @@ public class ItemInfo { /** * Creates {@link LauncherAtom.ItemInfo} with important fields and parent container info. */ @NonNull public LauncherAtom.ItemInfo buildProto() { return buildProto(null); } /** * Creates {@link LauncherAtom.ItemInfo} with important fields and parent container info. * @param fInfo */ public LauncherAtom.ItemInfo buildProto(FolderInfo fInfo) { @NonNull public LauncherAtom.ItemInfo buildProto(@Nullable final FolderInfo fInfo) { LauncherAtom.ItemInfo.Builder itemBuilder = getDefaultItemInfoBuilder(); Optional<ComponentName> nullableComponent = Optional.ofNullable(getTargetComponent()); switch (itemType) { Loading Loading @@ -373,6 +384,7 @@ public class ItemInfo { return itemBuilder.build(); } @NonNull protected LauncherAtom.ItemInfo.Builder getDefaultItemInfoBuilder() { LauncherAtom.ItemInfo.Builder itemBuilder = LauncherAtom.ItemInfo.newBuilder(); itemBuilder.setIsWork(!Process.myUserHandle().equals(user)); Loading @@ -383,6 +395,7 @@ public class ItemInfo { /** * Returns {@link ContainerInfo} used when logging this item. */ @NonNull public ContainerInfo getContainerInfo() { switch (container) { case CONTAINER_HOTSEAT: Loading Loading @@ -447,6 +460,7 @@ public class ItemInfo { * Returns non-AOSP container wrapped by {@link ExtendedContainers} object. Should be overridden * by build variants. */ @NonNull protected ExtendedContainers getExtendedContainer() { return ExtendedContainers.getDefaultInstance(); } Loading @@ -454,6 +468,7 @@ public class ItemInfo { /** * Returns shallow copy of the object. */ @NonNull public ItemInfo makeShallowCopy() { ItemInfo itemInfo = new ItemInfo(); itemInfo.copyFrom(this); Loading @@ -463,7 +478,8 @@ public class ItemInfo { /** * Sets the title of the item and writes to DB model if needed. */ public void setTitle(CharSequence title, ModelWriter modelWriter) { public void setTitle(@Nullable final CharSequence title, @Nullable final ModelWriter modelWriter) { this.title = title; } } Loading
src/com/android/launcher3/PendingAddItemInfo.java +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.launcher3; import android.content.ComponentName; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.model.data.ItemInfo; Loading @@ -43,6 +44,7 @@ public class PendingAddItemInfo extends ItemInfo { /** * Returns shallow copy of the object. */ @NonNull @Override public ItemInfo makeShallowCopy() { PendingAddItemInfo itemInfo = new PendingAddItemInfo(); Loading
src/com/android/launcher3/model/ItemInstallQueue.java +1 −0 Original line number Diff line number Diff line Loading @@ -288,6 +288,7 @@ public class ItemInstallQueue { } @Override @Nullable public Intent getIntent() { return intent; } Loading
src/com/android/launcher3/model/data/AppInfo.java +2 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.os.UserHandle; import android.os.UserManager; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.launcher3.LauncherSettings; Loading Loading @@ -65,6 +66,7 @@ public class AppInfo extends ItemInfoWithIcon implements WorkspaceItemFactory { } @Override @Nullable public Intent getIntent() { return intent; } Loading
src/com/android/launcher3/model/data/FolderInfo.java +6 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static com.android.launcher3.logger.LauncherAtom.Attribute.SUGGESTED_LABE import android.os.Process; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.LauncherSettings; Loading Loading @@ -154,7 +155,7 @@ public class FolderInfo extends ItemInfo { } @Override public void onAddToDatabase(ContentWriter writer) { public void onAddToDatabase(@NonNull ContentWriter writer) { super.onAddToDatabase(writer); writer.put(LauncherSettings.Favorites.TITLE, title) .put(LauncherSettings.Favorites.OPTIONS, options); Loading Loading @@ -206,8 +207,9 @@ public class FolderInfo extends ItemInfo { return String.format("%s; labelState=%s", super.dumpProperties(), getLabelState()); } @NonNull @Override public LauncherAtom.ItemInfo buildProto(FolderInfo fInfo) { public LauncherAtom.ItemInfo buildProto(@Nullable FolderInfo fInfo) { FolderIcon.Builder folderIcon = FolderIcon.newBuilder() .setCardinality(contents.size()); if (LabelState.SUGGESTED.equals(getLabelState())) { Loading Loading @@ -261,6 +263,7 @@ public class FolderInfo extends ItemInfo { : LabelState.SUGGESTED; } @NonNull @Override public ItemInfo makeShallowCopy() { FolderInfo folderInfo = new FolderInfo(); Loading @@ -272,6 +275,7 @@ public class FolderInfo extends ItemInfo { /** * Returns {@link LauncherAtom.FolderIcon} wrapped as {@link LauncherAtom.ItemInfo} for logging. */ @NonNull @Override public LauncherAtom.ItemInfo buildProto() { return buildProto(null); Loading
src/com/android/launcher3/model/data/ItemInfo.java +23 −7 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.content.Intent; import android.os.Process; import android.os.UserHandle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.LauncherSettings; Loading Loading @@ -141,30 +142,34 @@ public class ItemInfo { /** * Title of the item */ @Nullable public CharSequence title; /** * Content description of the item. */ @Nullable public CharSequence contentDescription; /** * When the instance is created using {@link #copyFrom}, this field is used to keep track of * original {@link ComponentName}. */ @Nullable private ComponentName mComponentName; @NonNull public UserHandle user; public ItemInfo() { user = Process.myUserHandle(); } protected ItemInfo(ItemInfo info) { protected ItemInfo(@NonNull final ItemInfo info) { copyFrom(info); } public void copyFrom(ItemInfo info) { public void copyFrom(@NonNull final ItemInfo info) { id = info.id; title = info.title; cellX = info.cellX; Loading @@ -182,6 +187,7 @@ public class ItemInfo { mComponentName = info.getTargetComponent(); } @Nullable public Intent getIntent() { return null; } Loading Loading @@ -209,7 +215,7 @@ public class ItemInfo { : null; } public void writeToValues(ContentWriter writer) { public void writeToValues(@NonNull final ContentWriter writer) { writer.put(LauncherSettings.Favorites.ITEM_TYPE, itemType) .put(LauncherSettings.Favorites.CONTAINER, container) .put(LauncherSettings.Favorites.SCREEN, screenId) Loading @@ -220,7 +226,7 @@ public class ItemInfo { .put(LauncherSettings.Favorites.RANK, rank); } public void readFromValues(ContentValues values) { public void readFromValues(@NonNull final ContentValues values) { itemType = values.getAsInteger(LauncherSettings.Favorites.ITEM_TYPE); container = values.getAsInteger(LauncherSettings.Favorites.CONTAINER); screenId = values.getAsInteger(LauncherSettings.Favorites.SCREEN); Loading @@ -234,7 +240,7 @@ public class ItemInfo { /** * Write the fields of this item to the DB */ public void onAddToDatabase(ContentWriter writer) { public void onAddToDatabase(@NonNull final ContentWriter writer) { if (Workspace.EXTRA_EMPTY_SCREEN_IDS.contains(screenId)) { // We should never persist an item on the extra empty screen. throw new RuntimeException("Screen id should not be extra empty screen: " + screenId); Loading @@ -245,10 +251,12 @@ public class ItemInfo { } @Override @NonNull public final String toString() { return getClass().getSimpleName() + "(" + dumpProperties() + ")"; } @NonNull protected String dumpProperties() { return "id=" + id + " type=" + LauncherSettings.Favorites.itemTypeToString(itemType) Loading Loading @@ -288,14 +296,17 @@ public class ItemInfo { /** * Creates {@link LauncherAtom.ItemInfo} with important fields and parent container info. */ @NonNull public LauncherAtom.ItemInfo buildProto() { return buildProto(null); } /** * Creates {@link LauncherAtom.ItemInfo} with important fields and parent container info. * @param fInfo */ public LauncherAtom.ItemInfo buildProto(FolderInfo fInfo) { @NonNull public LauncherAtom.ItemInfo buildProto(@Nullable final FolderInfo fInfo) { LauncherAtom.ItemInfo.Builder itemBuilder = getDefaultItemInfoBuilder(); Optional<ComponentName> nullableComponent = Optional.ofNullable(getTargetComponent()); switch (itemType) { Loading Loading @@ -373,6 +384,7 @@ public class ItemInfo { return itemBuilder.build(); } @NonNull protected LauncherAtom.ItemInfo.Builder getDefaultItemInfoBuilder() { LauncherAtom.ItemInfo.Builder itemBuilder = LauncherAtom.ItemInfo.newBuilder(); itemBuilder.setIsWork(!Process.myUserHandle().equals(user)); Loading @@ -383,6 +395,7 @@ public class ItemInfo { /** * Returns {@link ContainerInfo} used when logging this item. */ @NonNull public ContainerInfo getContainerInfo() { switch (container) { case CONTAINER_HOTSEAT: Loading Loading @@ -447,6 +460,7 @@ public class ItemInfo { * Returns non-AOSP container wrapped by {@link ExtendedContainers} object. Should be overridden * by build variants. */ @NonNull protected ExtendedContainers getExtendedContainer() { return ExtendedContainers.getDefaultInstance(); } Loading @@ -454,6 +468,7 @@ public class ItemInfo { /** * Returns shallow copy of the object. */ @NonNull public ItemInfo makeShallowCopy() { ItemInfo itemInfo = new ItemInfo(); itemInfo.copyFrom(this); Loading @@ -463,7 +478,8 @@ public class ItemInfo { /** * Sets the title of the item and writes to DB model if needed. */ public void setTitle(CharSequence title, ModelWriter modelWriter) { public void setTitle(@Nullable final CharSequence title, @Nullable final ModelWriter modelWriter) { this.title = title; } }