Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +34 −12 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.phone; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Iterator; import android.animation.ObjectAnimator; Loading @@ -30,7 +29,6 @@ import android.content.res.Resources; import android.util.AttributeSet; import android.util.Slog; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; import android.widget.FrameLayout; Loading @@ -39,6 +37,9 @@ import com.android.systemui.R; public class PanelView extends FrameLayout { public static final boolean DEBUG = PanelBar.DEBUG; public static final String TAG = PanelView.class.getSimpleName(); public static final boolean DEBUG_NAN = true; // http://b/7686690 public final void LOG(String fmt, Object... args) { if (!DEBUG) return; Slog.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args)); Loading Loading @@ -141,8 +142,17 @@ public class PanelView extends FrameLayout { last = event; i++; } if (totalweight > 0) { mVX /= totalweight; mVY /= totalweight; } else { if (DEBUG_NAN) { Slog.v("FlingTracker", "computeCurrentVelocity warning: totalweight=0", new Throwable()); } // so as not to contaminate the velocities with NaN mVX = mVY = 0; } if (FlingTracker.DEBUG) { Slog.v("FlingTracker", "computed: vx=" + mVX + " vy=" + mVY); Loading @@ -150,15 +160,19 @@ public class PanelView extends FrameLayout { } public float getXVelocity() { if (Float.isNaN(mVX)) { if (DEBUG_NAN) { Slog.v("FlingTracker", "warning: vx=NaN"); // XXX: should return 0 } mVX = 0; } return mVX; } public float getYVelocity() { if (Float.isNaN(mVY)) { if (DEBUG_NAN) { Slog.v("FlingTracker", "warning: vx=NaN"); // XXX: should return 0 } mVY = 0; } return mVY; } Loading Loading @@ -531,8 +545,12 @@ public class PanelView extends FrameLayout { public void setExpandedHeightInternal(float h) { if (Float.isNaN(h)) { Slog.v(TAG, "setExpandedHeightInternal: warning: h=NaN"); // XXX: should set h to 0 // If a NaN gets in here, it will freeze the Animators. if (DEBUG_NAN) { Slog.v(TAG, "setExpandedHeightInternal: warning: h=NaN, using 0 instead", new Throwable()); } h = 0; } float fh = getFullHeight(); Loading Loading @@ -566,8 +584,12 @@ public class PanelView extends FrameLayout { public void setExpandedFraction(float frac) { if (Float.isNaN(frac)) { Slog.v(TAG, "setExpandedFraction: frac=NaN"); // XXX: set frac to 0 to defend // If a NaN gets in here, it will freeze the Animators. if (DEBUG_NAN) { Slog.v(TAG, "setExpandedFraction: frac=NaN, using 0 instead", new Throwable()); } frac = 0; } setExpandedHeight(getFullHeight() * frac); } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +34 −12 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.phone; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Iterator; import android.animation.ObjectAnimator; Loading @@ -30,7 +29,6 @@ import android.content.res.Resources; import android.util.AttributeSet; import android.util.Slog; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; import android.widget.FrameLayout; Loading @@ -39,6 +37,9 @@ import com.android.systemui.R; public class PanelView extends FrameLayout { public static final boolean DEBUG = PanelBar.DEBUG; public static final String TAG = PanelView.class.getSimpleName(); public static final boolean DEBUG_NAN = true; // http://b/7686690 public final void LOG(String fmt, Object... args) { if (!DEBUG) return; Slog.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args)); Loading Loading @@ -141,8 +142,17 @@ public class PanelView extends FrameLayout { last = event; i++; } if (totalweight > 0) { mVX /= totalweight; mVY /= totalweight; } else { if (DEBUG_NAN) { Slog.v("FlingTracker", "computeCurrentVelocity warning: totalweight=0", new Throwable()); } // so as not to contaminate the velocities with NaN mVX = mVY = 0; } if (FlingTracker.DEBUG) { Slog.v("FlingTracker", "computed: vx=" + mVX + " vy=" + mVY); Loading @@ -150,15 +160,19 @@ public class PanelView extends FrameLayout { } public float getXVelocity() { if (Float.isNaN(mVX)) { if (DEBUG_NAN) { Slog.v("FlingTracker", "warning: vx=NaN"); // XXX: should return 0 } mVX = 0; } return mVX; } public float getYVelocity() { if (Float.isNaN(mVY)) { if (DEBUG_NAN) { Slog.v("FlingTracker", "warning: vx=NaN"); // XXX: should return 0 } mVY = 0; } return mVY; } Loading Loading @@ -531,8 +545,12 @@ public class PanelView extends FrameLayout { public void setExpandedHeightInternal(float h) { if (Float.isNaN(h)) { Slog.v(TAG, "setExpandedHeightInternal: warning: h=NaN"); // XXX: should set h to 0 // If a NaN gets in here, it will freeze the Animators. if (DEBUG_NAN) { Slog.v(TAG, "setExpandedHeightInternal: warning: h=NaN, using 0 instead", new Throwable()); } h = 0; } float fh = getFullHeight(); Loading Loading @@ -566,8 +584,12 @@ public class PanelView extends FrameLayout { public void setExpandedFraction(float frac) { if (Float.isNaN(frac)) { Slog.v(TAG, "setExpandedFraction: frac=NaN"); // XXX: set frac to 0 to defend // If a NaN gets in here, it will freeze the Animators. if (DEBUG_NAN) { Slog.v(TAG, "setExpandedFraction: frac=NaN, using 0 instead", new Throwable()); } frac = 0; } setExpandedHeight(getFullHeight() * frac); } Loading