Fix incremental download progress of workspaceiteminfos.

WorkspaceItemInfo intent package names could be null, while the item info itself had a non-null package name. Added a helper method checking component package names first, then intent package names as a fallback for deep shortcuts.

Demo: https://drive.google.com/file/d/1No44OD7SAD9qdmu-O6g3WaGdFjFLu2in/view?usp=sharing

Fixes: 181261930
Test: Manually on device
Change-Id: Ie2e10a79865b4898038fbdd4bbd9a7e9e1d42366
This commit is contained in:
Schneider Victor-tulias
2021-02-26 11:53:25 -08:00
parent 4092352a99
commit eedab487e3
3 changed files with 21 additions and 7 deletions

View File

@@ -15,7 +15,6 @@
*/
package com.android.launcher3.model;
import android.content.Intent;
import android.os.UserHandle;
import com.android.launcher3.LauncherAppState;
@@ -66,8 +65,7 @@ public class PackageIncrementalDownloadUpdatedTask extends BaseModelUpdateTask {
final ArrayList<WorkspaceItemInfo> updatedWorkspaceItems = new ArrayList<>();
synchronized (dataModel) {
dataModel.forAllWorkspaceItemInfos(mUser, si -> {
Intent intent = si.getIntent();
if ((intent != null) && mPackageName.equals(intent.getPackage())) {
if (mPackageName.equals(si.getTargetPackage())) {
si.runtimeStatusFlags &= ~ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE;
si.setProgressLevel(downloadInfo);
updatedWorkspaceItems.add(si);