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

Commit 70ad9bc0 authored by Alan Viverette's avatar Alan Viverette
Browse files

Fix null and bounds checks

BUG: 14271950
BUG: 14271753
BUG: 14270202
Change-Id: I8708107d3803b170a323f584a268ea6b096458ce
parent ceb5d17f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -314,7 +314,7 @@ public abstract class AbsSeekBar extends ProgressBar {
        final int right = left + thumbWidth;

        final Drawable background = getBackground();
        if (background.supportsHotspots()) {
        if (background != null && background.supportsHotspots()) {
            final Rect bounds = mThumb.getBounds();
            final int offsetX = mPaddingLeft - mThumbOffset;
            final int offsetY = mPaddingTop;
+1 −1
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ public abstract class CompoundButton extends Button implements Checkable {
            buttonDrawable.setBounds(left, top, right, bottom);

            final Drawable background = getBackground();
            if (background.supportsHotspots()) {
            if (background != null && background.supportsHotspots()) {
                background.setHotspotBounds(left, top, right, bottom);
            }
        }
+7 −1
Original line number Diff line number Diff line
@@ -25,12 +25,13 @@ import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Ripple.RippleAnimator;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.drawable.Ripple.RippleAnimator;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.SparseArray;

import com.android.internal.R;
@@ -45,6 +46,7 @@ import java.util.Arrays;
 * Documentation pending.
 */
public class TouchFeedbackDrawable extends LayerDrawable {
    private static final String LOG_TAG = TouchFeedbackDrawable.class.getSimpleName();
    private static final PorterDuffXfermode DST_IN = new PorterDuffXfermode(Mode.DST_IN);

    /** The maximum number of ripples supported. */
@@ -309,6 +311,10 @@ public class TouchFeedbackDrawable extends LayerDrawable {
            mActiveRipples = new Ripple[MAX_RIPPLES];
        }
        
        if (mActiveRipplesCount >= MAX_RIPPLES) {
            Log.e(LOG_TAG, "Max ripple count exceeded", new RuntimeException());
        }

        final Ripple ripple = mTouchedRipples.get(id);
        if (ripple == null) {
            final Rect padding = mPaddingRect;