summaryrefslogtreecommitdiff
path: root/src/com/android
diff options
context:
space:
mode:
authorSchneider Victor-tulias <victortulias@google.com>2023-06-06 10:55:54 -0700
committerSchneider Victor-tulias <victortulias@google.com>2023-06-06 11:02:09 -0700
commitab51f2110a83cae189f0bf2c4615278e7b97e5ea (patch)
tree21cd8048250b67154ed8c34e996f36cc87f5db77 /src/com/android
parent014a6843430399267b3415d85ba48428234ba36e (diff)
downloadLauncher3-ab51f2110a83cae189f0bf2c4615278e7b97e5ea.tar.gz
Add null-check to findLastActiveTaskAndRunCallback
ItemInfo.getTargetComponent is nullable, so we can't always create a ComponentKey. Added a null-check and proper creation of ComponentKeys Flag: not needed Fixes: 286053950 Test: started and completed splitscreen selection from home, taskbar and overview Change-Id: Ifa30f194ae064fab8aad79c5116f8c859dfd8cf1
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher3/model/data/ItemInfo.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/com/android/launcher3/model/data/ItemInfo.java b/src/com/android/launcher3/model/data/ItemInfo.java
index bfb80b322e..660929c566 100644
--- a/src/com/android/launcher3/model/data/ItemInfo.java
+++ b/src/com/android/launcher3/model/data/ItemInfo.java
@@ -62,6 +62,7 @@ import com.android.launcher3.logger.LauncherAtom.TaskSwitcherContainer;
import com.android.launcher3.logger.LauncherAtom.WallpapersContainer;
import com.android.launcher3.logger.LauncherAtomExtensions.ExtendedContainers;
import com.android.launcher3.model.ModelWriter;
+import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.ContentWriter;
import com.android.launcher3.util.SettingsCache;
@@ -211,6 +212,12 @@ public class ItemInfo {
return Optional.ofNullable(getIntent()).map(Intent::getComponent).orElse(mComponentName);
}
+ @Nullable
+ public final ComponentKey getComponentKey() {
+ ComponentName targetComponent = getTargetComponent();
+ return targetComponent == null ? null : new ComponentKey(targetComponent, user);
+ }
+
/**
* Returns this item's package name.
*