diff options
author | Kenny Guy <kennyguy@google.com> | 2014-04-30 03:02:21 +0100 |
---|---|---|
committer | Kenny Guy <kennyguy@google.com> | 2014-04-30 23:43:00 +0100 |
commit | ed13187a745866483139e2878037e1f8427ce567 (patch) | |
tree | a60e4ab78d5365095fe90026df4dfa4e98e80d46 /src/com/android/launcher3/Workspace.java | |
parent | 70c3d1da65fcdaf32b860a5582b211c1f0ae8718 (diff) | |
download | android_packages_apps_Trebuchet-ed13187a745866483139e2878037e1f8427ce567.tar.gz android_packages_apps_Trebuchet-ed13187a745866483139e2878037e1f8427ce567.tar.bz2 android_packages_apps_Trebuchet-ed13187a745866483139e2878037e1f8427ce567.zip |
Launcher3 multi-profile support
Use LauncherApps API and badging APIs instead of PackageManager.
With compatability layer that uses PackageManager pre L.
Adds support to show apps from current user and any managed profiles.
Background: Managed profiles are user sandboxes that are visible from
the primary user and can be launched as if they are a part of this user.
A launcher should now be capable of listing apps from this user as well
as related profiles of this user.
Launching of activities is now via the LauncherApps interface, to allow
for cross-profile app launching. Only activities with category LAUNCHER
can be added as a shortcut on the workspace for a managed profile.
Widgets and non-application shortcuts are only supported for the
current profile. Widgets from the managed profile are not available.
Change-Id: I5f396b1bf7f91ad91a5710ea4a0fd14573972eb9
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index f7ca141a7..9bf2c2343 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -60,6 +60,8 @@ import android.view.accessibility.AccessibilityManager; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import android.widget.TextView; + +import com.android.launcher3.compat.UserHandleCompat; import com.android.launcher3.FolderIcon.FolderRingAnimator; import com.android.launcher3.Launcher.CustomContentCallbacks; import com.android.launcher3.LauncherSettings.Favorites; @@ -4621,7 +4623,7 @@ public class Workspace extends SmoothPagedView // Removes ALL items that match a given package name, this is usually called when a package // has been removed and we want to remove all components (widgets, shortcuts, apps) that // belong to that package. - void removeItemsByPackageName(final ArrayList<String> packages) { + void removeItemsByPackageName(final ArrayList<String> packages, final UserHandleCompat user) { final HashSet<String> packageNames = new HashSet<String>(); packageNames.addAll(packages); @@ -4641,7 +4643,8 @@ public class Workspace extends SmoothPagedView @Override public boolean filterItem(ItemInfo parent, ItemInfo info, ComponentName cn) { - if (packageNames.contains(cn.getPackageName())) { + if (packageNames.contains(cn.getPackageName()) + && info.user.equals(user)) { cns.add(cn); return true; } @@ -4651,13 +4654,13 @@ public class Workspace extends SmoothPagedView LauncherModel.filterItemInfos(infos, filter); // Remove the affected components - removeItemsByComponentName(cns); + removeItemsByComponentName(cns, user); } // Removes items that match the application info specified, when applications are removed // as a part of an update, this is called to ensure that other widgets and application // shortcuts are not removed. - void removeItemsByApplicationInfo(final ArrayList<AppInfo> appInfos) { + void removeItemsByApplicationInfo(final ArrayList<AppInfo> appInfos, UserHandleCompat user) { // Just create a hash table of all the specific components that this will affect HashSet<ComponentName> cns = new HashSet<ComponentName>(); for (AppInfo info : appInfos) { @@ -4665,10 +4668,11 @@ public class Workspace extends SmoothPagedView } // Remove all the things - removeItemsByComponentName(cns); + removeItemsByComponentName(cns, user); } - void removeItemsByComponentName(final HashSet<ComponentName> componentNames) { + void removeItemsByComponentName(final HashSet<ComponentName> componentNames, + final UserHandleCompat user) { ArrayList<CellLayout> cellLayouts = getWorkspaceAndHotseatCellLayouts(); for (final CellLayout layoutParent: cellLayouts) { final ViewGroup layout = layoutParent.getShortcutsAndWidgets(); @@ -4687,7 +4691,7 @@ public class Workspace extends SmoothPagedView public boolean filterItem(ItemInfo parent, ItemInfo info, ComponentName cn) { if (parent instanceof FolderInfo) { - if (componentNames.contains(cn)) { + if (componentNames.contains(cn) && info.user.equals(user)) { FolderInfo folder = (FolderInfo) parent; ArrayList<ShortcutInfo> appsToRemove; if (folderAppsToRemove.containsKey(folder)) { @@ -4700,7 +4704,7 @@ public class Workspace extends SmoothPagedView return true; } } else { - if (componentNames.contains(cn)) { + if (componentNames.contains(cn) && info.user.equals(user)) { childrenToRemove.add(children.get(info)); return true; } |