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
This commit is contained in:
Sunny Goyal
2017-01-06 16:32:57 -08:00
parent 19ea5cc0c8
commit 1cc1c9ad83
10 changed files with 67 additions and 35 deletions
@@ -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();
}
}
}