Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad5658bb authored by Alan Viverette's avatar Alan Viverette
Browse files

Nullability annotations for animation and graphics

I inferred nullability annotations in Jetpack based on the guaranteed
behavior of the platform, so now I'm propagating those inferences back
to the platform as annotations.

Test: nullability presubmit checks
Fixes: 206801689
Change-Id: If969bbe8a2263a3dd6cc1497a01354648a8795e9
parent 1a8fe9a3
Loading
Loading
Loading
Loading
+26 −26
Original line number Diff line number Diff line
@@ -3591,17 +3591,17 @@ package android.animation {
  }
  public static interface Animator.AnimatorListener {
    method public void onAnimationCancel(android.animation.Animator);
    method public default void onAnimationEnd(android.animation.Animator, boolean);
    method public void onAnimationEnd(android.animation.Animator);
    method public void onAnimationRepeat(android.animation.Animator);
    method public default void onAnimationStart(android.animation.Animator, boolean);
    method public void onAnimationStart(android.animation.Animator);
    method public void onAnimationCancel(@NonNull android.animation.Animator);
    method public default void onAnimationEnd(@NonNull android.animation.Animator, boolean);
    method public void onAnimationEnd(@NonNull android.animation.Animator);
    method public void onAnimationRepeat(@NonNull android.animation.Animator);
    method public default void onAnimationStart(@NonNull android.animation.Animator, boolean);
    method public void onAnimationStart(@NonNull android.animation.Animator);
  }
  public static interface Animator.AnimatorPauseListener {
    method public void onAnimationPause(android.animation.Animator);
    method public void onAnimationResume(android.animation.Animator);
    method public void onAnimationPause(@NonNull android.animation.Animator);
    method public void onAnimationResume(@NonNull android.animation.Animator);
  }
  public class AnimatorInflater {
@@ -3888,7 +3888,7 @@ package android.animation {
  }
  public static interface ValueAnimator.AnimatorUpdateListener {
    method public void onAnimationUpdate(android.animation.ValueAnimator);
    method public void onAnimationUpdate(@NonNull android.animation.ValueAnimator);
  }
}
@@ -15766,9 +15766,9 @@ package android.graphics.drawable {
    method public final void copyBounds(@NonNull android.graphics.Rect);
    method @NonNull public final android.graphics.Rect copyBounds();
    method @Nullable public static android.graphics.drawable.Drawable createFromPath(String);
    method public static android.graphics.drawable.Drawable createFromResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, String);
    method @Nullable public static android.graphics.drawable.Drawable createFromResourceStream(@Nullable android.content.res.Resources, @Nullable android.util.TypedValue, @Nullable java.io.InputStream, @Nullable String);
    method @Deprecated @Nullable public static android.graphics.drawable.Drawable createFromResourceStream(@Nullable android.content.res.Resources, @Nullable android.util.TypedValue, @Nullable java.io.InputStream, @Nullable String, @Nullable android.graphics.BitmapFactory.Options);
    method public static android.graphics.drawable.Drawable createFromStream(java.io.InputStream, String);
    method @Nullable public static android.graphics.drawable.Drawable createFromStream(@Nullable java.io.InputStream, @Nullable String);
    method @NonNull public static android.graphics.drawable.Drawable createFromXml(@NonNull android.content.res.Resources, @NonNull org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
    method @NonNull public static android.graphics.drawable.Drawable createFromXml(@NonNull android.content.res.Resources, @NonNull org.xmlpull.v1.XmlPullParser, @Nullable android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
    method @NonNull public static android.graphics.drawable.Drawable createFromXmlInner(@NonNull android.content.res.Resources, @NonNull org.xmlpull.v1.XmlPullParser, @NonNull android.util.AttributeSet) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
@@ -15806,10 +15806,10 @@ package android.graphics.drawable {
    method public final boolean isVisible();
    method public void jumpToCurrentState();
    method @NonNull public android.graphics.drawable.Drawable mutate();
    method protected void onBoundsChange(android.graphics.Rect);
    method protected void onBoundsChange(@NonNull android.graphics.Rect);
    method public boolean onLayoutDirectionChanged(int);
    method protected boolean onLevelChange(int);
    method protected boolean onStateChange(int[]);
    method protected boolean onStateChange(@NonNull int[]);
    method public static int resolveOpacity(int, int);
    method public void scheduleSelf(@NonNull Runnable, long);
    method public abstract void setAlpha(@IntRange(from=0, to=255) int);
@@ -15970,27 +15970,27 @@ package android.graphics.drawable {
  }
  public final class Icon implements android.os.Parcelable {
    method public static android.graphics.drawable.Icon createWithAdaptiveBitmap(android.graphics.Bitmap);
    method @NonNull public static android.graphics.drawable.Icon createWithAdaptiveBitmap(android.graphics.Bitmap);
    method @NonNull public static android.graphics.drawable.Icon createWithAdaptiveBitmapContentUri(@NonNull String);
    method @NonNull public static android.graphics.drawable.Icon createWithAdaptiveBitmapContentUri(@NonNull android.net.Uri);
    method public static android.graphics.drawable.Icon createWithBitmap(android.graphics.Bitmap);
    method public static android.graphics.drawable.Icon createWithContentUri(String);
    method public static android.graphics.drawable.Icon createWithContentUri(android.net.Uri);
    method public static android.graphics.drawable.Icon createWithData(byte[], int, int);
    method public static android.graphics.drawable.Icon createWithFilePath(String);
    method public static android.graphics.drawable.Icon createWithResource(android.content.Context, @DrawableRes int);
    method public static android.graphics.drawable.Icon createWithResource(String, @DrawableRes int);
    method @NonNull public static android.graphics.drawable.Icon createWithBitmap(android.graphics.Bitmap);
    method @NonNull public static android.graphics.drawable.Icon createWithContentUri(String);
    method @NonNull public static android.graphics.drawable.Icon createWithContentUri(android.net.Uri);
    method @NonNull public static android.graphics.drawable.Icon createWithData(byte[], int, int);
    method @NonNull public static android.graphics.drawable.Icon createWithFilePath(String);
    method @NonNull public static android.graphics.drawable.Icon createWithResource(android.content.Context, @DrawableRes int);
    method @NonNull public static android.graphics.drawable.Icon createWithResource(String, @DrawableRes int);
    method public int describeContents();
    method @DrawableRes public int getResId();
    method @NonNull public String getResPackage();
    method public int getType();
    method @NonNull public android.net.Uri getUri();
    method public android.graphics.drawable.Drawable loadDrawable(android.content.Context);
    method public void loadDrawableAsync(android.content.Context, android.os.Message);
    method public void loadDrawableAsync(android.content.Context, android.graphics.drawable.Icon.OnDrawableLoadedListener, android.os.Handler);
    method public android.graphics.drawable.Icon setTint(@ColorInt int);
    method @Nullable public android.graphics.drawable.Drawable loadDrawable(android.content.Context);
    method public void loadDrawableAsync(@NonNull android.content.Context, @NonNull android.os.Message);
    method public void loadDrawableAsync(@NonNull android.content.Context, android.graphics.drawable.Icon.OnDrawableLoadedListener, android.os.Handler);
    method @NonNull public android.graphics.drawable.Icon setTint(@ColorInt int);
    method @NonNull public android.graphics.drawable.Icon setTintBlendMode(@NonNull android.graphics.BlendMode);
    method public android.graphics.drawable.Icon setTintList(android.content.res.ColorStateList);
    method @NonNull public android.graphics.drawable.Icon setTintList(android.content.res.ColorStateList);
    method @NonNull public android.graphics.drawable.Icon setTintMode(@NonNull android.graphics.PorterDuff.Mode);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.drawable.Icon> CREATOR;
+1 −1
Original line number Diff line number Diff line
@@ -985,7 +985,7 @@ package android.database.sqlite {
package android.graphics {

  public final class ImageDecoder implements java.lang.AutoCloseable {
    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(android.content.res.Resources, java.io.InputStream, int);
    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(android.content.res.Resources, @NonNull java.io.InputStream, int);
  }

  public final class Rect implements android.os.Parcelable {
+9 −8
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.animation;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.pm.ActivityInfo.Config;
@@ -535,7 +536,7 @@ public abstract class Animator implements Cloneable {
         * @param animation The started animation.
         * @param isReverse Whether the animation is playing in reverse.
         */
        default void onAnimationStart(Animator animation, boolean isReverse) {
        default void onAnimationStart(@NonNull Animator animation, boolean isReverse) {
            onAnimationStart(animation);
        }

@@ -551,7 +552,7 @@ public abstract class Animator implements Cloneable {
         * @param animation The animation which reached its end.
         * @param isReverse Whether the animation is playing in reverse.
         */
        default void onAnimationEnd(Animator animation, boolean isReverse) {
        default void onAnimationEnd(@NonNull Animator animation, boolean isReverse) {
            onAnimationEnd(animation);
        }

@@ -560,7 +561,7 @@ public abstract class Animator implements Cloneable {
         *
         * @param animation The started animation.
         */
        void onAnimationStart(Animator animation);
        void onAnimationStart(@NonNull Animator animation);

        /**
         * <p>Notifies the end of the animation. This callback is not invoked
@@ -568,7 +569,7 @@ public abstract class Animator implements Cloneable {
         *
         * @param animation The animation which reached its end.
         */
        void onAnimationEnd(Animator animation);
        void onAnimationEnd(@NonNull Animator animation);

        /**
         * <p>Notifies the cancellation of the animation. This callback is not invoked
@@ -576,14 +577,14 @@ public abstract class Animator implements Cloneable {
         *
         * @param animation The animation which was canceled.
         */
        void onAnimationCancel(Animator animation);
        void onAnimationCancel(@NonNull Animator animation);

        /**
         * <p>Notifies the repetition of the animation.</p>
         *
         * @param animation The animation which was repeated.
         */
        void onAnimationRepeat(Animator animation);
        void onAnimationRepeat(@NonNull Animator animation);
    }

    /**
@@ -599,7 +600,7 @@ public abstract class Animator implements Cloneable {
         * @param animation The animaton being paused.
         * @see #pause()
         */
        void onAnimationPause(Animator animation);
        void onAnimationPause(@NonNull Animator animation);

        /**
         * <p>Notifies that the animation was resumed, after being
@@ -608,7 +609,7 @@ public abstract class Animator implements Cloneable {
         * @param animation The animation being resumed.
         * @see #resume()
         */
        void onAnimationResume(Animator animation);
        void onAnimationResume(@NonNull Animator animation);
    }

    /**
+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.animation;

import android.annotation.CallSuper;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.compat.annotation.UnsupportedAppUsage;
@@ -1626,7 +1627,7 @@ public class ValueAnimator extends Animator implements AnimationHandler.Animatio
         *
         * @param animation The animation which was repeated.
         */
        void onAnimationUpdate(ValueAnimator animation);
        void onAnimationUpdate(@NonNull ValueAnimator animation);

    }

+3 −3
Original line number Diff line number Diff line
@@ -368,7 +368,7 @@ public final class ImageDecoder implements AutoCloseable {
     * Further, unlike other Sources, this one is not reusable.
     */
    private static class InputStreamSource extends Source {
        InputStreamSource(Resources res, InputStream is, int inputDensity) {
        InputStreamSource(Resources res, @NonNull InputStream is, int inputDensity) {
            if (is == null) {
                throw new IllegalArgumentException("The InputStream cannot be null");
            }
@@ -1020,7 +1020,7 @@ public final class ImageDecoder implements AutoCloseable {
     */
    @AnyThread
    @NonNull
    public static Source createSource(Resources res, InputStream is) {
    public static Source createSource(Resources res, @NonNull InputStream is) {
        return new InputStreamSource(res, is, Bitmap.getDefaultDensity());
    }

@@ -1034,7 +1034,7 @@ public final class ImageDecoder implements AutoCloseable {
    @AnyThread
    @TestApi
    @NonNull
    public static Source createSource(Resources res, InputStream is, int density) {
    public static Source createSource(Resources res, @NonNull InputStream is, int density) {
        return new InputStreamSource(res, is, density);
    }

Loading