From 1a830f0d80433747399e72a98b3b6bfad4f321c3 Mon Sep 17 00:00:00 2001 From: John Spurlock Date: Tue, 30 Jun 2015 15:14:27 -0400 Subject: Volume: Defend against monkeys pulling tags too early. Bug: 22197117 Change-Id: I0f944fbc7fd6dd5176300c4fd0fd7b79234efe2d --- .../src/com/android/systemui/volume/VolumeDialogMotion.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogMotion.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogMotion.java index fdf1840..2f104bd 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogMotion.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogMotion.java @@ -126,6 +126,11 @@ public class VolumeDialogMotion { return mChevron.getHeight() / 6; } + private int chevronPosY() { + final Object tag = mChevron == null ? null : mChevron.getTag(); + return tag == null ? 0 : (Integer) tag; + } + private void startShowAnimation() { if (D.BUG) Log.d(TAG, "startShowAnimation"); mDialogView.animate() @@ -139,7 +144,7 @@ public class VolumeDialogMotion { if (mChevronPositionAnimator == null) return; // reposition chevron final float v = (Float) mChevronPositionAnimator.getAnimatedValue(); - final int posY = (Integer) mChevron.getTag(); + final int posY = chevronPosY(); mChevron.setTranslationY(posY + v + -mDialogView.getTranslationY()); }}) .start(); @@ -212,7 +217,7 @@ public class VolumeDialogMotion { @Override public void onAnimationUpdate(ValueAnimator animation) { mContents.setTranslationY(-mDialogView.getTranslationY()); - int posY = (Integer) mChevron.getTag(); + final int posY = chevronPosY(); mChevron.setTranslationY(posY + -mDialogView.getTranslationY()); } }) -- cgit v1.1