Warning when canceling ActionBar Overflow menu on Android 4.1.x Warning when canceling ActionBar Overflow menu on Android 4.1.x android android

Warning when canceling ActionBar Overflow menu on Android 4.1.x


This is not related with your work.

Overflow menu is implemented by PopupWindow. When user touch to close PopupWindow, ACTION_DOWN event queued to app's Message queue. Then it is delivered to View through ViewPostImeInputStage class and finally ViewPostImeInputStage send this input event to PopupWindow's onTouchEvent listener.

    @Override    public boolean onTouchEvent(MotionEvent event) {        final int x = (int) event.getX();        final int y = (int) event.getY();        if ((event.getAction() == MotionEvent.ACTION_DOWN)                && ((x < 0) || (x >= getWidth()) || (y < 0) || (y >= getHeight()))) {            dismiss();            return true;        } else if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {            dismiss();            return true;        } else {            return super.onTouchEvent(event);        }    }

dissmiss() try to close PopupWindow and PopupWindow::onDetachedWindow call WindowInputEventReceiver::dispose() first.

And then ViewPostImeInputStage call WindowInputEventReceiver::finishInputEvent to finish that ACTION_DOWN event. However WindowInputEventReceiver instance is already disposed so it throw warning messages.

You can debug it by breakpoint. open InputEventReceiver.java(need android source code at framework/base/) and set breakpoint at dispose method.