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

Commit eb1b65a9 authored by Winson's avatar Winson
Browse files

Prevent and log invalid cache entries.

Bug: 25413518
Change-Id: Id0a7384eccd25ba766feb0c568b4c16db2b6f6c8
parent 15ca73ac
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -560,6 +560,11 @@ public class RecentsTaskLoader {
        ActivityInfo activityInfo = mActivityInfoCache.get(cn);
        if (activityInfo == null) {
            activityInfo = ssp.getActivityInfo(cn, taskKey.userId);
            if (cn == null || activityInfo == null) {
                Log.e(TAG, "Unexpected null component name or activity info: " + cn + ", " +
                        activityInfo);
                return null;
            }
            mActivityInfoCache.put(cn, activityInfo);
        }
        return activityInfo;
+7 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.recents.model;

import android.util.Log;
import android.util.LruCache;
import android.util.SparseArray;

@@ -29,6 +30,8 @@ import android.util.SparseArray;
 */
public class TaskKeyLruCache<V> {

    private static final String TAG = "TaskKeyLruCache";

    private final SparseArray<Task.TaskKey> mKeys = new SparseArray<>();
    private final LruCache<Integer, V> mCache;

@@ -71,6 +74,10 @@ public class TaskKeyLruCache<V> {

    /** Puts an entry in the cache for a specific key. */
    final void put(Task.TaskKey key, V value) {
        if (key == null || value == null) {
            Log.e(TAG, "Unexpected null key or value: " + key + ", " + value);
            return;
        }
        mKeys.put(key.id, key);
        mCache.put(key.id, value);
    }