Replace ImageDecoder.sApiLevel with a SystemApi helper

Bug: 152322291
Test: CtsGraphicsTestCases

ImageDecoder is moving to a mainline module, so the system can no longer
access the @hidden sApiLevel without making it @SystemApi. Instead of
promoting the existing API, provide a common class to be used by any UI
rendering class that needs to access the targetSdkVersion. Switch AVD to
use the new class, which is a SystemApi.

Change-Id: Ie7172fb93364a1e04ab844b8fa64887bf9d8b005
This commit is contained in:
Leon Scroggins III
2020-03-30 14:03:37 -04:00
parent 03fb4e10aa
commit 143dfeff2d
5 changed files with 60 additions and 21 deletions

View File

@@ -171,9 +171,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
* </pre>
*/
public final class ImageDecoder implements AutoCloseable {
/** @hide **/
public static int sApiLevel;
/**
* Source of encoded image data.
*
@@ -1933,7 +1930,8 @@ public final class ImageDecoder implements AutoCloseable {
// For P and above, only resize if it would be a downscale. Scale up prior
// to P in case the app relies on the Bitmap's size without considering density.
if (srcDensity < dstDensity && sApiLevel >= Build.VERSION_CODES.P) {
if (srcDensity < dstDensity
&& Compatibility.getTargetSdkVersion() >= Build.VERSION_CODES.P) {
return srcDensity;
}