summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/View.java
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-03-09 14:37:48 -0800
committerJeff Brown <jeffbrown@google.com>2012-03-09 14:41:50 -0800
commit43ea54bdc343a913f62885304796e4ab1bca4ef1 (patch)
tree4e33bb4e5c8a4b82c3589dc322641ff83bc4059c /core/java/android/view/View.java
parent8ac70c42507560bf6df7114e96f788c03a18bd6a (diff)
downloadframeworks_base-43ea54bdc343a913f62885304796e4ab1bca4ef1.zip
frameworks_base-43ea54bdc343a913f62885304796e4ab1bca4ef1.tar.gz
frameworks_base-43ea54bdc343a913f62885304796e4ab1bca4ef1.tar.bz2
Don't remove all animation callbacks if action/who was null.
Fixes a bug in View.removeCallbacks and View.unscheduleDrawable where it was possible for the caller to remove all animation callbacks if it happened to specify an action or who parameter of null. Also refactored the callback queueing code in Choreographer to make it more intent revealing although the behavior remains the same. Bug: 6144688 Change-Id: Iba29dcda6b3aaad73af664bb63feab65ae3483e5
Diffstat (limited to 'core/java/android/view/View.java')
-rw-r--r--core/java/android/view/View.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index a651362..61660b9 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -8852,13 +8852,15 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
* (for instance, if the Runnable was not in the queue already.)
*/
public boolean removeCallbacks(Runnable action) {
- final AttachInfo attachInfo = mAttachInfo;
- if (attachInfo != null) {
- attachInfo.mHandler.removeCallbacks(action);
- attachInfo.mViewRootImpl.mChoreographer.removeAnimationCallbacks(action, null);
- } else {
- // Assume that post will succeed later
- ViewRootImpl.getRunQueue().removeCallbacks(action);
+ if (action != null) {
+ final AttachInfo attachInfo = mAttachInfo;
+ if (attachInfo != null) {
+ attachInfo.mHandler.removeCallbacks(action);
+ attachInfo.mViewRootImpl.mChoreographer.removeAnimationCallbacks(action, null);
+ } else {
+ // Assume that post will succeed later
+ ViewRootImpl.getRunQueue().removeCallbacks(action);
+ }
}
return true;
}
@@ -11963,7 +11965,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
* @see #drawableStateChanged
*/
public void unscheduleDrawable(Drawable who) {
- if (mAttachInfo != null) {
+ if (mAttachInfo != null && who != null) {
mAttachInfo.mViewRootImpl.mChoreographer.removeAnimationCallbacks(null, who);
}
}