privatebooleanstartLoader(@NonNullfinal Callbacks[] newCallbacks) { ... synchronized (mLock) { ... if (callbacksList.length > 0) { ... if (bindDirectly) { // Divide the set of loaded items into those that we are binding synchronously, // and everything else that is to be bound normally (asynchronously). launcherBinder.bindWorkspace(bindAllCallbacks, /* isBindSync= */true);
// For now, continue posting the binding of AllApps as there are other // issues that arise from that. launcherBinder.bindAllApps(); launcherBinder.bindDeepShortcuts(); launcherBinder.bindWidgets(); if (FeatureFlags.CHANGE_MODEL_DELEGATE_LOADING_ORDER.get()) { mModelDelegate.bindAllModelExtras(callbacksList); } returntrue; } else { // Always post the loader task, instead of running directly // (even on same thread) so that we exit any nested synchronized blocks MODEL_EXECUTOR.post(mLoaderTask); } } } returnfalse; }
packages/apps/Launcher3/src/com/android/launcher3/allapps/AlphabeticalAppsList.java publicvoidonAppsUpdated() { if (mAllAppsStore == null) { return; } // Sort the list of apps mApps.clear();
// As a special case for some languages (currently only Simplified Chinese), we may need to // coalesce sections LocalecurLocale= mActivityContext.getResources().getConfiguration().locale; booleanlocaleRequiresSectionSorting= curLocale.equals(Locale.SIMPLIFIED_CHINESE); if (localeRequiresSectionSorting) { // Compute the section headers. We use a TreeMap with the section name comparator to // ensure that the sections are ordered when we iterate over it later appSteam = appSteam.collect(Collectors.groupingBy( info -> info.sectionName, () -> newTreeMap<>(newLabelComparator()), Collectors.toCollection(ArrayList::new))) .values() .stream() .flatMap(ArrayList::stream); }
appSteam.forEachOrdered(mApps::add); // Recompose the set of adapter items from the current set of apps if (mSearchResults.isEmpty()) { updateAdapterItems(); } }