Merge "Add nullable annotation to getAndInvalidateIfModified which returns null" into main

This commit is contained in:
Treehugger Robot
2025-01-15 02:09:16 -08:00
committed by Android (Google) Code Review
4 changed files with 9 additions and 1 deletions
@@ -119,7 +119,7 @@ internal constructor(
highResLoadingState.isEnabled
) {
val newCachedThumbnail = cache.getAndInvalidateIfModified(task.key)
if (newCachedThumbnail.thumbnail != null && !newCachedThumbnail.reducedResolution) {
if (newCachedThumbnail?.thumbnail != null && !newCachedThumbnail.reducedResolution) {
return newCachedThumbnail
}
}
@@ -17,6 +17,7 @@ package com.android.quickstep.util;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.android.systemui.shared.recents.model.Task;
@@ -94,6 +95,7 @@ public class TaskKeyByLastActiveTimeCache<V> implements TaskKeyCache<V> {
* Gets the entry if it is still valid
*/
@Override
@Nullable
public synchronized V getAndInvalidateIfModified(Task.TaskKey key) {
Entry<V> entry = mMap.get(key.id);
if (entry != null && entry.mKey.windowingMode == key.windowingMode
@@ -15,6 +15,8 @@
*/
package com.android.quickstep.util;
import androidx.annotation.Nullable;
import com.android.systemui.shared.recents.model.Task;
import java.util.function.Predicate;
@@ -44,6 +46,7 @@ public interface TaskKeyCache<V> {
/**
* Gets the entry if it is still valid.
*/
@Nullable
V getAndInvalidateIfModified(Task.TaskKey key);
/**
@@ -17,6 +17,8 @@ package com.android.quickstep.util;
import android.util.Log;
import androidx.annotation.Nullable;
import com.android.systemui.shared.recents.model.Task.TaskKey;
import java.util.LinkedHashMap;
@@ -59,6 +61,7 @@ public class TaskKeyLruCache<V> implements TaskKeyCache<V> {
/**
* Gets the entry if it is still valid
*/
@Nullable
public synchronized V getAndInvalidateIfModified(TaskKey key) {
Entry<V> entry = mMap.get(key.id);