Change the load logic of FolderNameProvider

Work profile apps are suggested as "Work" folder name

Bug: 147359653
Bug: 147359733

Change-Id: Idb2438de9c71c85cfeca6a6b0e116174ea2f3b62
This commit is contained in:
Hyunyoung Song committed 2020-01-08 23:31:58 -08:00
1 parent 2f3d0566c9
commit 97253ec3ab
5 files changed
+177 -35

No files matched your search

+17 -6
View File
@@ -16,12 +16,6 @@
package com.android.launcher3;
import static com.android.launcher3.LauncherAppState.ACTION_FORCE_ROLOAD;
import static com.android.launcher3.config.FeatureFlags.IS_DOGFOOD_BUILD;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
import static com.android.launcher3.util.PackageManagerHelper.hasShortcutsPermission;
import android.content.Context;
import android.content.Intent;
import android.content.pm.LauncherApps;
@@ -68,10 +62,17 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CancellationException;
import java.util.concurrent.Executor;
import java.util.function.Supplier;
import static com.android.launcher3.LauncherAppState.ACTION_FORCE_ROLOAD;
import static com.android.launcher3.config.FeatureFlags.IS_DOGFOOD_BUILD;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
import static com.android.launcher3.util.PackageManagerHelper.hasShortcutsPermission;
/**
* Maintains in-memory state of the Launcher. It is expected that there should be only one
* LauncherModel object held in a static. Also provide APIs for updating the database state
@@ -126,6 +127,16 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi
mBgAllAppsList = new AllAppsList(iconCache, appFilter);
}
/**
* Returns AppInfo with corresponding package name.
* TODO: move to enqueueModelTask
*/
public Optional<AppInfo> getAppInfoByPackageName(String pkg) {
return mBgAllAppsList.data.stream()
.filter(info -> info.componentName.getPackageName().equals(pkg))
.findAny();
}
/**
* Adds the provided items to the workspace.
*/