From 8c48d8bea64b95916b18bd41a4fdb58d4d7477be Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 25 Jan 2019 15:10:18 -0800 Subject: Changing min sdk to 25 Change-Id: I0d28069967854357ca755bf25dec19d4979bdecf --- .../android/launcher3/shortcuts/ShortcutCache.java | 73 ---------------------- .../launcher3/shortcuts/ShortcutInfoCompat.java | 4 -- 2 files changed, 77 deletions(-) delete mode 100644 src/com/android/launcher3/shortcuts/ShortcutCache.java (limited to 'src/com/android/launcher3/shortcuts') 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 mCachedShortcuts; - // We always keep pinned shortcuts in the cache. - private final ArrayMap 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 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) -- cgit v1.2.3