Fix .equals call in ImageDecoder

Bug: 154954875
Bug: 143231863
Test: I93b01cb60a8c76110ea2ff4250d0048512629d8d

I9229039b752bafa9a9b85b914a62093dff1eec34 switched from "==" to
".equals", but it did not take into account that Uri#getScheme() can
return null. Switch around the .equals check so that it is called on
SCHEME_CONTENT, which will never be null.

Change-Id: I0df5d2407a32fad0e21e597697af293fbc2fb315
Merged-In: I0df5d2407a32fad0e21e597697af293fbc2fb315
This commit is contained in:
Leon Scroggins III
2020-04-27 15:31:21 -04:00
committed by Leon Scroggins
parent 3b8aa15911
commit 6419ebff5c

View File

@@ -270,7 +270,7 @@ public final class ImageDecoder implements AutoCloseable {
public ImageDecoder createImageDecoder(boolean preferAnimation) throws IOException { public ImageDecoder createImageDecoder(boolean preferAnimation) throws IOException {
AssetFileDescriptor assetFd = null; AssetFileDescriptor assetFd = null;
try { try {
if (mUri.getScheme().equals(ContentResolver.SCHEME_CONTENT)) { if (ContentResolver.SCHEME_CONTENT.equals(mUri.getScheme())) {
assetFd = mResolver.openTypedAssetFileDescriptor(mUri, assetFd = mResolver.openTypedAssetFileDescriptor(mUri,
"image/*", null); "image/*", null);
} else { } else {