Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 606d3836 authored by Rajeev Kumar's avatar Rajeev Kumar Committed by Android (Google) Code Review
Browse files

Merge "1. Replace use of java.util.HashMap with android.util.ArrayMap in...

Merge "1. Replace use of java.util.HashMap with android.util.ArrayMap in ShortcutCache class 2. Get rid of unused constants from ShortcutCache class 3. Make instance variables final" into ub-launcher3-dorval-polish
parents 97d74913 0a3169bc
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -19,9 +19,8 @@ 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.HashMap;
import java.util.List;

/**
@@ -31,18 +30,15 @@ import java.util.List;
 */
@TargetApi(Build.VERSION_CODES.N)
public class ShortcutCache {
    private static final String TAG = "ShortcutCache";
    private static final boolean LOGD = false;

    private static final int CACHE_SIZE = 30; // Max number shortcuts we cache.

    private LruCache<ShortcutKey, ShortcutInfoCompat> mCachedShortcuts;
    private final LruCache<ShortcutKey, ShortcutInfoCompat> mCachedShortcuts;
    // We always keep pinned shortcuts in the cache.
    private HashMap<ShortcutKey, ShortcutInfoCompat> mPinnedShortcuts;
    private final ArrayMap<ShortcutKey, ShortcutInfoCompat> mPinnedShortcuts;

    public ShortcutCache() {
        mCachedShortcuts = new LruCache<>(CACHE_SIZE);
        mPinnedShortcuts = new HashMap<>();
        mPinnedShortcuts = new ArrayMap<>();
    }

    /**