diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2019-01-25 15:10:18 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2019-01-29 11:29:52 -0800 |
commit | 8c48d8bea64b95916b18bd41a4fdb58d4d7477be (patch) | |
tree | 1a3538863bdb43b87eef0b1238d17ac908f045c5 /src/com/android/launcher3/shortcuts | |
parent | 9752705e92593adfb60568ac4d059cc776cfceaa (diff) | |
download | android_packages_apps_Trebuchet-8c48d8bea64b95916b18bd41a4fdb58d4d7477be.tar.gz android_packages_apps_Trebuchet-8c48d8bea64b95916b18bd41a4fdb58d4d7477be.tar.bz2 android_packages_apps_Trebuchet-8c48d8bea64b95916b18bd41a4fdb58d4d7477be.zip |
Changing min sdk to 25
Change-Id: I0d28069967854357ca755bf25dec19d4979bdecf
Diffstat (limited to 'src/com/android/launcher3/shortcuts')
-rw-r--r-- | src/com/android/launcher3/shortcuts/ShortcutCache.java | 73 | ||||
-rw-r--r-- | src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java | 4 |
2 files changed, 0 insertions, 77 deletions
diff --git a/src/com/android/launcher3/shortcuts/ShortcutCache.java b/src/com/android/launcher3/shortcuts/ShortcutCache.java deleted file mode 100644 index 5742d1de3..000000000 --- a/src/com/android/launcher3/shortcuts/ShortcutCache.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.launcher3.shortcuts; - -import android.annotation.TargetApi; -import android.os.Build; -import android.os.UserHandle; -import android.util.ArrayMap; -import android.util.LruCache; -import java.util.List; - -/** - * Loads {@link ShortcutInfoCompat}s on demand (e.g. when launcher - * loads for pinned shortcuts and on long-press for dynamic shortcuts), and caches them - * for handful of apps in an LruCache while launcher lives. - */ -@TargetApi(Build.VERSION_CODES.N) -public class ShortcutCache { - private static final int CACHE_SIZE = 30; // Max number shortcuts we cache. - - private final LruCache<ShortcutKey, ShortcutInfoCompat> mCachedShortcuts; - // We always keep pinned shortcuts in the cache. - private final ArrayMap<ShortcutKey, ShortcutInfoCompat> mPinnedShortcuts; - - public ShortcutCache() { - mCachedShortcuts = new LruCache<>(CACHE_SIZE); - mPinnedShortcuts = new ArrayMap<>(); - } - - /** - * Removes shortcuts from the cache when shortcuts change for a given package. - * - * Returns a map of ids to their evicted shortcuts. - * - * @see android.content.pm.LauncherApps.Callback#onShortcutsChanged(String, List, UserHandle). - */ - public void removeShortcuts(List<ShortcutInfoCompat> shortcuts) { - for (ShortcutInfoCompat shortcut : shortcuts) { - ShortcutKey key = ShortcutKey.fromInfo(shortcut); - mCachedShortcuts.remove(key); - mPinnedShortcuts.remove(key); - } - } - - public ShortcutInfoCompat get(ShortcutKey key) { - if (mPinnedShortcuts.containsKey(key)) { - return mPinnedShortcuts.get(key); - } - return mCachedShortcuts.get(key); - } - - public void put(ShortcutKey key, ShortcutInfoCompat shortcut) { - if (shortcut.isPinned()) { - mPinnedShortcuts.put(key, shortcut); - } else { - mCachedShortcuts.put(key, shortcut); - } - } -} diff --git a/src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java b/src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java index 325777d7f..e5bd00265 100644 --- a/src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java +++ b/src/com/android/launcher3/shortcuts/ShortcutInfoCompat.java @@ -16,12 +16,10 @@ package com.android.launcher3.shortcuts; -import android.annotation.TargetApi; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ShortcutInfo; -import android.os.Build; import android.os.UserHandle; import com.android.launcher3.R; @@ -31,7 +29,6 @@ import com.android.launcher3.R; * * Not to be confused with {@link com.android.launcher3.ShortcutInfo}. */ -@TargetApi(Build.VERSION_CODES.N) public class ShortcutInfoCompat { private static final String INTENT_CATEGORY = "com.android.launcher3.DEEP_SHORTCUT"; private static final String EXTRA_BADGEPKG = "badge_package"; @@ -42,7 +39,6 @@ public class ShortcutInfoCompat { mShortcutInfo = shortcutInfo; } - @TargetApi(Build.VERSION_CODES.N) public Intent makeIntent() { return new Intent(Intent.ACTION_MAIN) .addCategory(INTENT_CATEGORY) |