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

Commit 3e79a16b authored by John Reck's avatar John Reck
Browse files

Add missing nullability annotations

It's never valid to draw to a null Canvas

Test: make
Change-Id: Iaad788cb9e5f1ff2965d2fac23f7ba7a00069b81
parent 1e028209
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -50112,7 +50112,7 @@ package android.view {
    method public void dispatchCreateViewTranslationRequest(@NonNull java.util.Map<android.view.autofill.AutofillId,long[]>, @NonNull int[], @NonNull android.view.translation.TranslationCapability, @NonNull java.util.List<android.view.translation.ViewTranslationRequest>);
    method public void dispatchDisplayHint(int);
    method public boolean dispatchDragEvent(android.view.DragEvent);
    method protected void dispatchDraw(android.graphics.Canvas);
    method protected void dispatchDraw(@NonNull android.graphics.Canvas);
    method public void dispatchDrawableHotspotChanged(float, float);
    method @CallSuper public void dispatchFinishTemporaryDetach();
    method protected boolean dispatchGenericFocusedEvent(android.view.MotionEvent);
@@ -50150,7 +50150,7 @@ package android.view {
    method @NonNull public android.view.WindowInsetsAnimation.Bounds dispatchWindowInsetsAnimationStart(@NonNull android.view.WindowInsetsAnimation, @NonNull android.view.WindowInsetsAnimation.Bounds);
    method @Deprecated public void dispatchWindowSystemUiVisiblityChanged(int);
    method public void dispatchWindowVisibilityChanged(int);
    method @CallSuper public void draw(android.graphics.Canvas);
    method @CallSuper public void draw(@NonNull android.graphics.Canvas);
    method @CallSuper public void drawableHotspotChanged(float, float);
    method @CallSuper protected void drawableStateChanged();
    method public android.view.View findFocus();
@@ -50443,9 +50443,9 @@ package android.view {
    method @CallSuper protected void onDetachedFromWindow();
    method protected void onDisplayHint(int);
    method public boolean onDragEvent(android.view.DragEvent);
    method protected void onDraw(android.graphics.Canvas);
    method public void onDrawForeground(android.graphics.Canvas);
    method protected final void onDrawScrollBars(android.graphics.Canvas);
    method protected void onDraw(@NonNull android.graphics.Canvas);
    method public void onDrawForeground(@NonNull android.graphics.Canvas);
    method protected final void onDrawScrollBars(@NonNull android.graphics.Canvas);
    method public boolean onFilterTouchEventForSecurity(android.view.MotionEvent);
    method @CallSuper protected void onFinishInflate();
    method public void onFinishTemporaryDetach();
@@ -50931,7 +50931,7 @@ package android.view {
    ctor public View.DragShadowBuilder(android.view.View);
    ctor public View.DragShadowBuilder();
    method public final android.view.View getView();
    method public void onDrawShadow(android.graphics.Canvas);
    method public void onDrawShadow(@NonNull android.graphics.Canvas);
    method public void onProvideShadowMetrics(android.graphics.Point, android.graphics.Point);
  }
@@ -51161,7 +51161,7 @@ package android.view {
    method public void dispatchSetActivated(boolean);
    method public void dispatchSetSelected(boolean);
    method protected void dispatchThawSelfOnly(android.util.SparseArray<android.os.Parcelable>);
    method protected boolean drawChild(android.graphics.Canvas, android.view.View, long);
    method protected boolean drawChild(@NonNull android.graphics.Canvas, android.view.View, long);
    method public void endViewTransition(android.view.View);
    method public android.view.View focusSearch(android.view.View, int);
    method public void focusableViewAvailable(android.view.View);
+14 −14
Original line number Diff line number Diff line
@@ -17434,7 +17434,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * (but after its own view has been drawn).
     * @param canvas the canvas on which to draw the view
     */
    protected void dispatchDraw(Canvas canvas) {
    protected void dispatchDraw(@NonNull Canvas canvas) {
    }
@@ -20719,7 +20719,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        out.bottom = mScrollY + mBottom - mTop;
    }
    private void onDrawScrollIndicators(Canvas c) {
    private void onDrawScrollIndicators(@NonNull Canvas c) {
        if ((mPrivateFlags3 & SCROLL_INDICATORS_PFLAG3_MASK) == 0) {
            // No scroll indicators enabled.
            return;
@@ -20903,7 +20903,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @see #awakenScrollBars(int)
     */
    protected final void onDrawScrollBars(Canvas canvas) {
    protected final void onDrawScrollBars(@NonNull Canvas canvas) {
        // scrollbars are drawn only when the animation is running
        final ScrollabilityCache cache = mScrollCache;
@@ -21015,7 +21015,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @hide
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    protected void onDrawHorizontalScrollBar(Canvas canvas, Drawable scrollBar,
    protected void onDrawHorizontalScrollBar(@NonNull Canvas canvas, Drawable scrollBar,
            int l, int t, int r, int b) {
        scrollBar.setBounds(l, t, r, b);
        scrollBar.draw(canvas);
@@ -21035,7 +21035,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @hide
     */
    @UnsupportedAppUsage
    protected void onDrawVerticalScrollBar(Canvas canvas, Drawable scrollBar,
    protected void onDrawVerticalScrollBar(@NonNull Canvas canvas, Drawable scrollBar,
            int l, int t, int r, int b) {
        scrollBar.setBounds(l, t, r, b);
        scrollBar.draw(canvas);
@@ -21046,7 +21046,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @param canvas the canvas on which the background will be drawn
     */
    protected void onDraw(Canvas canvas) {
    protected void onDraw(@NonNull Canvas canvas) {
    }
    /*
@@ -23161,7 +23161,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @hide
     */
    protected final boolean drawsWithRenderNode(Canvas canvas) {
    protected final boolean drawsWithRenderNode(@NonNull Canvas canvas) {
        return mAttachInfo != null
                && mAttachInfo.mHardwareAccelerated
                && canvas.isHardwareAccelerated();
@@ -23173,7 +23173,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * This is where the View specializes rendering behavior based on layer type,
     * and hardware acceleration.
     */
    boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {
    boolean draw(@NonNull Canvas canvas, ViewGroup parent, long drawingTime) {
        final boolean hardwareAcceleratedCanvas = canvas.isHardwareAccelerated();
@@ -23461,7 +23461,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        return (int) (dips * scale + 0.5f);
    }
    final private void debugDrawFocus(Canvas canvas) {
    private void debugDrawFocus(@NonNull Canvas canvas) {
        if (isFocused()) {
            final int cornerSquareSize = dipsToPixels(DEBUG_CORNERS_SIZE_DIP);
            final int l = mScrollX;
@@ -23496,7 +23496,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @param canvas The Canvas to which the View is rendered.
     */
    @CallSuper
    public void draw(Canvas canvas) {
    public void draw(@NonNull Canvas canvas) {
        final int privateFlags = mPrivateFlags;
        mPrivateFlags = (privateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN;
@@ -23731,7 +23731,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @param canvas Canvas on which to draw the background
     */
    @UnsupportedAppUsage
    private void drawBackground(Canvas canvas) {
    private void drawBackground(@NonNull Canvas canvas) {
        final Drawable background = mBackground;
        if (background == null) {
            return;
@@ -24631,7 +24631,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * Draw the default focus highlight onto the canvas if there is one and this view is focused.
     * @param canvas the canvas where we're drawing the highlight.
     */
    private void drawDefaultFocusHighlight(Canvas canvas) {
    private void drawDefaultFocusHighlight(@NonNull Canvas canvas) {
        if (mDefaultFocusHighlight != null && isFocused()) {
            if (mDefaultFocusHighlightSizeChanged) {
                mDefaultFocusHighlightSizeChanged = false;
@@ -25429,7 +25429,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @param canvas canvas to draw into
     */
    public void onDrawForeground(Canvas canvas) {
    public void onDrawForeground(@NonNull Canvas canvas) {
        onDrawScrollIndicators(canvas);
        onDrawScrollBars(canvas);
@@ -27487,7 +27487,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
         *
         * @param canvas A {@link android.graphics.Canvas} object in which to draw the shadow image.
         */
        public void onDrawShadow(Canvas canvas) {
        public void onDrawShadow(@NonNull Canvas canvas) {
            final View view = mView.get();
            if (view != null) {
                view.draw(canvas);
+6 −5
Original line number Diff line number Diff line
@@ -4166,7 +4166,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
    /**
     * @hide
     */
    protected void onDebugDrawMargins(Canvas canvas, Paint paint) {
    protected void onDebugDrawMargins(@NonNull Canvas canvas, Paint paint) {
        for (int i = 0; i < getChildCount(); i++) {
            View c = getChildAt(i);
            c.getLayoutParams().onDebugDraw(c, canvas, paint);
@@ -4176,7 +4176,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
    /**
     * @hide
     */
    protected void onDebugDraw(Canvas canvas) {
    protected void onDebugDraw(@NonNull Canvas canvas) {
        Paint paint = getDebugPaint();

        // Draw optical bounds
@@ -4224,7 +4224,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {
    protected void dispatchDraw(@NonNull Canvas canvas) {
        final int childrenCount = mChildrenCount;
        final View[] children = mChildren;
        int flags = mGroupFlags;
@@ -4533,7 +4533,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * @param drawingTime The time at which draw is occurring
     * @return True if an invalidate() was issued
     */
    protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
    protected boolean drawChild(@NonNull Canvas canvas, View child, long drawingTime) {
        return child.draw(canvas, this, drawingTime);
    }

@@ -9208,7 +9208,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        }
    }

    private static void drawRect(Canvas canvas, Paint paint, int x1, int y1, int x2, int y2) {
    private static void drawRect(@NonNull Canvas canvas, Paint paint, int x1, int y1,
                                 int x2, int y2) {
        if (sDebugLines== null) {
            // TODO: This won't work with multiple UI threads in a single process
            sDebugLines = new float[16];