diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-01-06 16:32:57 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-01-10 23:42:49 -0800 |
commit | 1cc1c9ad83014ec8af54a44112138339c52795b0 (patch) | |
tree | c1b92a862d86a9c99ff06925861cd8f58da8ab75 /tests/src/com/android | |
parent | 19ea5cc0c853d48db59363f763d9a06c8691e00d (diff) | |
download | android_packages_apps_Trebuchet-1cc1c9ad83014ec8af54a44112138339c52795b0.tar.gz android_packages_apps_Trebuchet-1cc1c9ad83014ec8af54a44112138339c52795b0.tar.bz2 android_packages_apps_Trebuchet-1cc1c9ad83014ec8af54a44112138339c52795b0.zip |
Enforcing background thread when accessing iconCacheDb.
> Moving any icon cache access to background thread
> Updating Apps list to avoid loading icons for ignored apps
Bug: 21325319
Change-Id: Id72755100f1176ccfcc99249c5e02873cc249a13
Diffstat (limited to 'tests/src/com/android')
-rw-r--r-- | tests/src/com/android/launcher3/model/BaseModelUpdateTaskTestCase.java | 10 | ||||
-rw-r--r-- | tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java | 5 |
2 files changed, 13 insertions, 2 deletions
diff --git a/tests/src/com/android/launcher3/model/BaseModelUpdateTaskTestCase.java b/tests/src/com/android/launcher3/model/BaseModelUpdateTaskTestCase.java index 1d092ab04..3a27d0dbf 100644 --- a/tests/src/com/android/launcher3/model/BaseModelUpdateTaskTestCase.java +++ b/tests/src/com/android/launcher3/model/BaseModelUpdateTaskTestCase.java @@ -13,6 +13,7 @@ import android.support.test.InstrumentationRegistry; import android.test.ProviderTestCase2; import com.android.launcher3.AllAppsList; +import com.android.launcher3.AppFilter; import com.android.launcher3.AppInfo; import com.android.launcher3.DeferredHandler; import com.android.launcher3.IconCache; @@ -76,7 +77,7 @@ public class BaseModelUpdateTaskTestCase extends ProviderTestCase2<TestLauncherP idp = new InvariantDeviceProfile(); iconCache = new MyIconCache(targetContext, idp); - allAppsList = new AllAppsList(iconCache, null); + allAppsList = new AllAppsList(iconCache, new AppFilter()); when(appState.getIconCache()).thenReturn(iconCache); when(appState.getInvariantDeviceProfile()).thenReturn(idp); @@ -131,7 +132,7 @@ public class BaseModelUpdateTaskTestCase extends ProviderTestCase2<TestLauncherP (ItemInfo) initItem(classMap.get(commands[1]), commands, 2), false); break; case "allApps": - allAppsList.add((AppInfo) initItem(AppInfo.class, commands, 1)); + allAppsList.add((AppInfo) initItem(AppInfo.class, commands, 1), null); break; } } @@ -208,5 +209,10 @@ public class BaseModelUpdateTaskTestCase extends ProviderTestCase2<TestLauncherP public Bitmap newIcon() { return Bitmap.createBitmap(1, 1, Config.ARGB_8888); } + + @Override + protected Bitmap makeDefaultIcon(UserHandle user) { + return newIcon(); + } } } diff --git a/tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java b/tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java index 646ef2794..d595e6cf1 100644 --- a/tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java +++ b/tests/src/com/android/launcher3/model/CacheDataUpdatedTaskTest.java @@ -30,6 +30,11 @@ public class CacheDataUpdatedTaskTest extends BaseModelUpdateTaskTestCase { } public void testCacheUpdate_update_apps() throws Exception { + // Clear all icons from apps list so that its easy to check what was updated + for (AppInfo info : allAppsList.data) { + info.iconBitmap = null; + } + executeTaskForTest(newTask(CacheDataUpdatedTask.OP_CACHE_UPDATE, "app1")); // Verify that only the app icons of app1 (id 1 & 2) are updated. Custom shortcut (id 7) |