Fix NPE for where intent.package is null but targetpkg is not.

- Also update WorkspaceItemProcessorTest with a new test and to use real intent instead of mock

Bug: 330250727
Test: unit tests
Flag: N/A
Change-Id: I77e17901f4754c301ca20b3c6f93bbe29bead59b
This commit is contained in:
Charlie Anderson committed 2024-04-18 17:48:27 -04:00
1 parent 4d91e16589
commit ce255ff6fd
2 files changed
+80 -35

No files matched your search

@@ -184,6 +184,9 @@ class WorkspaceItemProcessor(
}
}
}
if (intent.`package` == null) {
intent.`package` = targetPkg
}
// else if cn == null => can't infer much, leave it
// else if !validPkg => could be restored icon or missing sd-card
when {
@@ -329,8 +332,12 @@ class WorkspaceItemProcessor(
}
val activityInfo = c.launcherActivityInfo
if (activityInfo != null) {
AppInfo.updateRuntimeFlagsForActivityTarget(info, activityInfo,
userCache.getUserInfo(c.user), ApiWrapper.INSTANCE[app.context])
AppInfo.updateRuntimeFlagsForActivityTarget(
info,
activityInfo,
userCache.getUserInfo(c.user),
ApiWrapper.INSTANCE[app.context]
)
}
if (
(c.restoreFlag != 0 ||