BRD: Correct @NonNull annotation

Bug: 140600285
Test: Ifd9e9abe3f2c89f724a0b918d99ec4e9db65ad56

After adding some tests, I confirmed that newInstance(InputStream) (and
the deprecated version that includes boolean isShareable) can return
null if the InputStream is null. Update the annotations for both - the
old one that has always been wrong, and the new one added in
I0bf8c4c72cc118d2799a59e8eb6c2cede546fceb.

Change-Id: Ib820edd1ad62665092c272a7b89b0a29b0e1bb32
This commit is contained in:
Leon Scroggins III
2020-03-23 14:18:25 -04:00
parent ede504903d
commit f54df24a25
2 changed files with 7 additions and 4 deletions

View File

@@ -14190,8 +14190,8 @@ package android.graphics {
method @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull byte[], int, int) throws java.io.IOException;
method @Deprecated @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull java.io.FileDescriptor, boolean) throws java.io.IOException;
method @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull android.os.ParcelFileDescriptor) throws java.io.IOException;
method @Deprecated @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull java.io.InputStream, boolean) throws java.io.IOException;
method @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull java.io.InputStream) throws java.io.IOException;
method @Deprecated @Nullable public static android.graphics.BitmapRegionDecoder newInstance(@NonNull java.io.InputStream, boolean) throws java.io.IOException;
method @Nullable public static android.graphics.BitmapRegionDecoder newInstance(@NonNull java.io.InputStream) throws java.io.IOException;
method @Deprecated @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull String, boolean) throws java.io.IOException;
method @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull String) throws java.io.IOException;
method public void recycle();

View File

@@ -16,6 +16,7 @@
package android.graphics;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.res.AssetManager;
import android.os.Build;
@@ -125,6 +126,7 @@ public final class BitmapRegionDecoder {
* @param is The input stream that holds the raw data to be decoded into a
* BitmapRegionDecoder.
* @param isShareable This field has always been ignored.
* @return A new BitmapRegionDecoder, or {@code null} if {@code is} is {@code null}.
* @throws IOException if the image format is not supported or can not be decoded.
* @deprecated In favor of {@link #newInstance(InputStream)}
*
@@ -134,7 +136,7 @@ public final class BitmapRegionDecoder {
* {@link Build.VERSION_CODES#KITKAT}, this is no longer the case.</p>
*/
@Deprecated
@NonNull
@Nullable
public static BitmapRegionDecoder newInstance(@NonNull InputStream is,
boolean isShareable) throws IOException {
return newInstance(is);
@@ -148,9 +150,10 @@ public final class BitmapRegionDecoder {
*
* @param is The input stream that holds the raw data to be decoded into a
* BitmapRegionDecoder.
* @return A new BitmapRegionDecoder, or {@code null} if {@code is} is {@code null}.
* @throws IOException if the image format is not supported or can not be decoded.
*/
@NonNull
@Nullable
public static BitmapRegionDecoder newInstance(@NonNull InputStream is) throws IOException {
if (is instanceof AssetManager.AssetInputStream) {
return nativeNewInstance(