summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/compat/LauncherAppsCompatVL.java
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2016-05-19 11:19:39 -0700
committerTony Wickham <twickham@google.com>2016-06-21 15:49:16 -0700
commitbfbf7f9f4a0b300613f0ff27a4eb592d88c08325 (patch)
tree6906865484b6a03199eecd0f352eba24345af33e /src/com/android/launcher3/compat/LauncherAppsCompatVL.java
parentae50284e0a838139c67caf0064a0977c871497fa (diff)
downloadandroid_packages_apps_Trebuchet-bfbf7f9f4a0b300613f0ff27a4eb592d88c08325.tar.gz
android_packages_apps_Trebuchet-bfbf7f9f4a0b300613f0ff27a4eb592d88c08325.tar.bz2
android_packages_apps_Trebuchet-bfbf7f9f4a0b300613f0ff27a4eb592d88c08325.zip
Add support for launcher shortcuts.
- This CL has no UI but provides the necessary backing for one. - Adds new item type: ITEM_TYPE_DEEP_SHORTCUT, to distinguish from ITEM_TYPE_SHORTCUT. We can reconsider these names. - Adds ShortcutCache, using LruCache for up to 30 dynamic shortcuts (pinned shortcuts are always cached in a HashMap). - DeepShortcutManager queries for shortcuts and other things like pin them. In a future CL it will use the cache, but for now it simply makes an RPC for all queries. - LauncherModel maintains counts for pinned shortcuts, pinning and unpinning when counts reach 1 or 0, respectively. - LauncherModel maintains a map of components to lists of shortcut ids, which Launcher gets a copy of after it is changed in the background. This will allow us to know how many shortcuts an app has immediately, and query for details as the UI is animating. Change-Id: Ic526f374dd10d72a261bae67f07f098fca8d8bca
Diffstat (limited to 'src/com/android/launcher3/compat/LauncherAppsCompatVL.java')
-rw-r--r--src/com/android/launcher3/compat/LauncherAppsCompatVL.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/com/android/launcher3/compat/LauncherAppsCompatVL.java b/src/com/android/launcher3/compat/LauncherAppsCompatVL.java
index 7270d023b..d97bf2f74 100644
--- a/src/com/android/launcher3/compat/LauncherAppsCompatVL.java
+++ b/src/com/android/launcher3/compat/LauncherAppsCompatVL.java
@@ -22,11 +22,14 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.LauncherActivityInfo;
import android.content.pm.LauncherApps;
+import android.content.pm.ShortcutInfo;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.UserHandle;
+import com.android.launcher3.shortcuts.ShortcutInfoCompat;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -34,7 +37,7 @@ import java.util.List;
import java.util.Map;
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
-public class LauncherAppsCompatVL extends LauncherAppsCompat {
+public class LauncherAppsCompatVL extends LauncherAppsCompatV16 {
protected LauncherApps mLauncherApps;
@@ -42,7 +45,7 @@ public class LauncherAppsCompatVL extends LauncherAppsCompat {
= new HashMap<OnAppsChangedCallbackCompat, WrappedCallback>();
LauncherAppsCompatVL(Context context) {
- super();
+ super(context);
mLauncherApps = (LauncherApps) context.getSystemService("launcherapps");
}
@@ -146,6 +149,18 @@ public class LauncherAppsCompatVL extends LauncherAppsCompat {
public void onPackagesUnsuspended(String[] packageNames, UserHandle user) {
mCallback.onPackagesUnsuspended(packageNames, UserHandleCompat.fromUser(user));
}
+
+ @Override
+ public void onShortcutsChanged(String packageName, List<ShortcutInfo> shortcuts,
+ UserHandle user) {
+ List<ShortcutInfoCompat> shortcutInfoCompats = new ArrayList<>(shortcuts.size());
+ for (ShortcutInfo shortcutInfo : shortcuts) {
+ shortcutInfoCompats.add(new ShortcutInfoCompat(shortcutInfo));
+ }
+
+ mCallback.onShortcutsChanged(packageName, shortcutInfoCompats,
+ UserHandleCompat.fromUser(user));
+ }
}
}