From 97eacc36a3551efcaf97e5c02f4427882e6d6030 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Tue, 24 Mar 2020 15:38:35 -0400 Subject: [PATCH] Make createSource(ContentResolver, Uri, Resources) a SystemApi Bug: 152322291 Test: make Once ImageDecoder is in a mainline module, the system (i.e. ImageView) needs to be able to access this method. External clients can already use createSource(ContentResolver, Uri). If they want density scaling, they can use createSource(Resources, int resId). Change-Id: I560972c1ef08ee5e610e3c2c182353a6767fd082 --- api/module-lib-current.txt | 8 ++++++++ graphics/java/android/graphics/ImageDecoder.java | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/api/module-lib-current.txt b/api/module-lib-current.txt index 593331b069d65..60c7b9a530960 100644 --- a/api/module-lib-current.txt +++ b/api/module-lib-current.txt @@ -17,6 +17,14 @@ package android.content.rollback { } +package android.graphics { + + public final class ImageDecoder implements java.lang.AutoCloseable { + method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull android.content.ContentResolver, @NonNull android.net.Uri, @Nullable android.content.res.Resources); + } + +} + package android.net { public final class TetheredClient implements android.os.Parcelable { diff --git a/graphics/java/android/graphics/ImageDecoder.java b/graphics/java/android/graphics/ImageDecoder.java index 3ecc0b3565dd7..9edaa3c56bbef 100644 --- a/graphics/java/android/graphics/ImageDecoder.java +++ b/graphics/java/android/graphics/ImageDecoder.java @@ -27,6 +27,7 @@ import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Px; +import android.annotation.SystemApi; import android.annotation.TestApi; import android.annotation.WorkerThread; import android.compat.annotation.UnsupportedAppUsage; @@ -923,8 +924,12 @@ public final class ImageDecoder implements AutoCloseable { /** * Provide Resources for density scaling. * + * This is a SystemApi to enable legacy behavior, so there is no need to + * make it public like the version above, which does not have a Resources + * parameter. * @hide */ + @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @AnyThread @NonNull public static Source createSource(@NonNull ContentResolver cr,