runOnMainThread(r);
}
- final UserHandleCompat user, final List<LauncherActivityInfoCompat> apps) {
+ private void scheduleManagedHeuristicRunnable(final ManagedProfileHeuristic heuristic,
- final List<LauncherActivityInfoCompat> updatedApps =
++ final UserHandle user, final List<LauncherActivityInfo> apps) {
+ if (heuristic != null) {
+ // Assume the app lists now is updated.
+ mIsManagedHeuristicAppsUpdated = false;
+ final Runnable managedHeuristicRunnable = new Runnable() {
+ @Override
+ public void run() {
+ if (mIsManagedHeuristicAppsUpdated) {
+ // If app list is updated, we need to reschedule it otherwise old app
+ // list will override everything in processUserApps().
+ sWorker.post(new Runnable() {
+ public void run() {
++ final List<LauncherActivityInfo> updatedApps =
+ mLauncherApps.getActivityList(null, user);
+ scheduleManagedHeuristicRunnable(heuristic, user,
+ updatedApps);
+ }
+ });
+ } else {
+ heuristic.processUserApps(apps);
+ }
+ }
+ };
+ runOnMainThread(new Runnable() {
+ @Override
+ public void run() {
+ // Check isLoadingWorkspace on the UI thread, as it is updated on the UI
+ // thread.
+ if (mIsLoadingAndBindingWorkspace) {
+ synchronized (mBindCompleteRunnables) {
+ mBindCompleteRunnables.add(managedHeuristicRunnable);
+ }
+ } else {
+ runOnWorkerThread(managedHeuristicRunnable);
+ }
+ }
+ });
+ }
+ }
+
private void loadAllApps() {
final long loadTime = DEBUG_LOADERS ? SystemClock.uptimeMillis() : 0;
boolean quietMode = mUserManager.isQuietModeEnabled(user);
// Create the ApplicationInfos
for (int i = 0; i < apps.size(); i++) {
- LauncherActivityInfoCompat app = apps.get(i);
+ LauncherActivityInfo app = apps.get(i);
// This builds the icon bitmaps.
- mBgAllAppsList.add(new AppInfo(mContext, app, user, mIconCache, quietMode));
+ mBgAllAppsList.add(new AppInfo(app, user, quietMode), app);
}
-
final ManagedProfileHeuristic heuristic = ManagedProfileHeuristic.get(mContext, user);
if (heuristic != null) {
- final Runnable r = new Runnable() {
-
- @Override
- public void run() {
- heuristic.processUserApps(apps);
- }
- };
- runOnMainThread(new Runnable() {
-
- @Override
- public void run() {
- // Check isLoadingWorkspace on the UI thread, as it is updated on
- // the UI thread.
- if (mIsLoadingAndBindingWorkspace) {
- synchronized (mBindCompleteRunnables) {
- mBindCompleteRunnables.add(r);
- }
- } else {
- runOnWorkerThread(r);
- }
- }
- });
+ scheduleManagedHeuristicRunnable(heuristic, user, apps);
}
}
// Huh? Shouldn't this be inside the Runnable below?
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
- LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ub-uiautomator
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ub-uiautomator mockito-target-minus-junit4
++LOCAL_STATIC_JAVA_LIBRARIES := \
++ android-support-test \
++ ub-uiautomator \
++ mockito-target-minus-junit4 \
++ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
+ LOCAL_FULL_LIBS_MANIFEST_FILES := $(LOCAL_PATH)/AndroidManifest-common.xml
LOCAL_SDK_VERSION := current
+ LOCAL_MIN_SDK_VERSION := 21
LOCAL_PACKAGE_NAME := Launcher3Tests