summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Winson Chung <winsonc@google.com> 2015-11-02 18:36:27 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2015-11-02 18:36:27 +0000
commit723b5d90df6a1acbb56bf8fc6c93e58ff105e599 (patch)
treeae260bb8e7ecf252b827185aea92897caf0612f0
parent36555baa556a1531b6b6edc2dea1de5469f74b64 (diff)
parenteb1b65a976d143810acab199aecd17b987661973 (diff)
Merge "Prevent and log invalid cache entries."
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/TaskKeyLruCache.java7
2 files changed, 12 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
index 71e39573537a..bba453a09172 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
@@ -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;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskKeyLruCache.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskKeyLruCache.java
index 6d11f1463f25..67a6a9f1d514 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskKeyLruCache.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskKeyLruCache.java
@@ -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);
}