Merge "MediaController does not check for cancelled motions in onTouchEvent, causing nested invocations of WindowManagerGlobal.addView. Sample stack trace below."

This commit is contained in:
Robert Shih
2013-12-16 22:35:28 +00:00
committed by Android (Google) Code Review

View File

@@ -442,7 +442,19 @@ public class MediaController extends FrameLayout {
@Override
public boolean onTouchEvent(MotionEvent event) {
show(sDefaultTimeout);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
show(0); // show until hide is called
break;
case MotionEvent.ACTION_UP:
show(sDefaultTimeout); // start timeout
break;
case MotionEvent.ACTION_CANCEL:
hide();
break;
default:
break;
}
return true;
}