Merge "Add logging to help debug additional app infos being updated by CacheDataUpdatedTask" into tm-qpr-dev am: 4eec22f818

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/19462408

Change-Id: I8d115d1f8da1c95625ae03787fd525fda68dc5fb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Schneider Victor-tulias
2022-08-01 22:15:06 +00:00
committed by Automerger Merge Worker
3 changed files with 18 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ package com.android.launcher3.model;
import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR;
import static com.android.launcher3.model.data.AppInfo.EMPTY_ARRAY;
import static com.android.launcher3.testing.shared.TestProtocol.INCORRECT_INFO_UPDATED;
import android.content.ComponentName;
import android.content.Context;
@@ -38,6 +39,7 @@ import com.android.launcher3.model.BgDataModel.Callbacks;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.pm.PackageInstallInfo;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.FlagOp;
import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.util.SafeCloseable;
@@ -270,8 +272,14 @@ public class AllAppsList {
}
public void updateIconsAndLabels(HashSet<String> packages, UserHandle user) {
if (TestProtocol.sDebugTracing) {
Log.i(INCORRECT_INFO_UPDATED, "updateIconsAndLabels: packages=" + packages);
}
for (AppInfo info : data) {
if (info.user.equals(user) && packages.contains(info.componentName.getPackageName())) {
if (TestProtocol.sDebugTracing) {
Log.i(INCORRECT_INFO_UPDATED, "updateIconsAndLabels: updating info=" + info);
}
mIconCache.updateTitleAndIcon(info);
info.sectionName = mIndex.computeSectionName(info.title);
mDataChanged = true;

View File

@@ -137,6 +137,7 @@ public final class TestProtocol {
public static final String NULL_INT_SET = "b/200572078";
public static final String MISSING_PROMISE_ICON = "b/202985412";
public static final String TASKBAR_IN_APP_STATE = "b/227657604";
public static final String INCORRECT_INFO_UPDATED = "b/239465630";
public static final String REQUEST_EMULATE_DISPLAY = "emulate-display";
public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display";

View File

@@ -1,5 +1,7 @@
package com.android.launcher3.model;
import static com.android.launcher3.testing.shared.TestProtocol.INCORRECT_INFO_UPDATED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
@@ -14,6 +16,7 @@ import android.graphics.Color;
import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -26,6 +29,7 @@ import com.android.launcher3.icons.cache.CachingLogic;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.LauncherModelHelper;
import org.junit.After;
@@ -43,12 +47,15 @@ import java.util.HashSet;
@RunWith(AndroidJUnit4.class)
public class CacheDataUpdatedTaskTest {
private static final String TAG = "CacheDataUpdatedTaskTest";
private static final String NEW_LABEL_PREFIX = "new-label-";
private LauncherModelHelper mModelHelper;
@Before
public void setup() throws Exception {
TestProtocol.sDebugTracing = true;
mModelHelper = new LauncherModelHelper();
mModelHelper.initializeData("cache_data_updated_task_data");
@@ -88,6 +95,7 @@ public class CacheDataUpdatedTaskTest {
@After
public void tearDown() {
mModelHelper.destroy();
TestProtocol.sDebugTracing = false;
}
private CacheDataUpdatedTask newTask(int op, String... pkg) {
@@ -111,6 +119,7 @@ public class CacheDataUpdatedTaskTest {
// Verify that only app1 var updated in allAppsList
assertFalse(mModelHelper.getAllAppsList().data.isEmpty());
for (AppInfo info : mModelHelper.getAllAppsList().data) {
Log.i(INCORRECT_INFO_UPDATED, "testCacheUpdate_update_apps: checking info=" + info);
if (info.componentName.getPackageName().equals("app1")) {
assertFalse(info.bitmap.isNullOrLowRes());
} else {