diff options
author | 2024-06-25 12:48:32 -0700 | |
---|---|---|
committer | 2024-07-15 13:33:23 -0700 | |
commit | e48daa217dc397cce855a5357ee11a87b0c7bce4 (patch) | |
tree | aea79b4a9f640e60f4422bb996ca7ec125310a46 /tests/shared | |
parent | 1936da00dab547490ac4f0a349063fee3591d9d2 (diff) |
Update ImageLoader interface to receive preview sizes along with the URI
The UI calculates and provides view sizes but they are not used by the
existing ImageLoader implementations thus no functional change is
expected.
Bug: 348665058
Test: atest IntentResolver-tests-unit
Test: atest IntentResolver-tests-activity
Test: inject debug logging and verify preview values being requested for
app preview types
Flag: EXEMPT refactor
Change-Id: I0e282f773c424b6fe81587a71e1b8630452ac63c
Diffstat (limited to 'tests/shared')
-rw-r--r-- | tests/shared/src/com/android/intentresolver/FakeImageLoader.kt | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/shared/src/com/android/intentresolver/FakeImageLoader.kt b/tests/shared/src/com/android/intentresolver/FakeImageLoader.kt index c57ea78b..76eb5e0d 100644 --- a/tests/shared/src/com/android/intentresolver/FakeImageLoader.kt +++ b/tests/shared/src/com/android/intentresolver/FakeImageLoader.kt @@ -18,6 +18,7 @@ package com.android.intentresolver import android.graphics.Bitmap import android.net.Uri +import android.util.Size import com.android.intentresolver.contentpreview.ImageLoader import java.util.function.Consumer import kotlinx.coroutines.CoroutineScope @@ -25,13 +26,18 @@ import kotlinx.coroutines.CoroutineScope class FakeImageLoader(initialBitmaps: Map<Uri, Bitmap> = emptyMap()) : ImageLoader { private val bitmaps = HashMap<Uri, Bitmap>().apply { putAll(initialBitmaps) } - override fun loadImage(callerScope: CoroutineScope, uri: Uri, callback: Consumer<Bitmap?>) { + override fun loadImage( + callerScope: CoroutineScope, + uri: Uri, + size: Size, + callback: Consumer<Bitmap?>, + ) { callback.accept(bitmaps[uri]) } - override suspend fun invoke(uri: Uri, caching: Boolean): Bitmap? = bitmaps[uri] + override suspend fun invoke(uri: Uri, size: Size, caching: Boolean): Bitmap? = bitmaps[uri] - override fun prePopulate(uris: List<Uri>) = Unit + override fun prePopulate(uriSizePairs: List<Pair<Uri, Size>>) = Unit fun setBitmap(uri: Uri, bitmap: Bitmap) { bitmaps[uri] = bitmap |