I touch an activity, and without releasing my finger I start another activity. I expect that touch-events would go to the new activity, but they continue going to the old activity (until I release my finger and touch again). I could try to manually redirect them from the previous activity to the new one, intercepting them in onTouchEvent(MotionEvent event)
or dispatchTouchEvent(MotionEvent ev)
, but I don't get them even there. Instead, I receive these messages in the debug console:
W/ViewRootImpl[LauncherSettingsActivity]: Dropping event due to no window focus: MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=154.80649, y[0]=462.0374, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=598901019, downTime=598899893, deviceId=5, source=0x1002 }
W/ViewRootImpl[LauncherSettingsActivity]: Dropping event due to no window focus: MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=157.665, y[0]=464.89352, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=1, eventTime=598901037, downTime=598899893, deviceId=5, source=0x1002 }
W/ViewRootImpl[LauncherSettingsActivity]: Dropping event due to no window focus: MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=145.26581, y[0]=451.9532, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=1, eventTime=598900932, downTime=598899893, deviceId=5, source=0x1002 }
W/ViewRootImpl[LauncherSettingsActivity]: Dropping event due to no window focus: MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=146.27205, y[0]=455.41583, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=1, eventTime=598900950, downTime=598899893, deviceId=5, source=0x1002 }
W/ViewRootImpl[LauncherSettingsActivity]: Dropping event due to no window focus: MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=147.81523, y[0]=456.0499, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=598900966, downTime=598899893, deviceId=5, source=0x1002 }
W/ViewRootImpl[LauncherSettingsActivity]: Dropping event due to no window focus: MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=152.30963, y[0]=459.04367, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=1, eventTime=598900984, downTime=598899893, deviceId=5, source=0x1002 }
...
And when I release my finger:
W/ViewRootImpl[LauncherSettingsActivity]: Dropping event due to no window focus: MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=161.01006, y[0]=466.835, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=1, eventTime=598901054, downTime=598899893, deviceId=5, source=0x1002 }
W/ViewRootImpl[LauncherSettingsActivity]: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=161.01006, y[0]=466.835, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=598901066, downTime=598899893, deviceId=5, source=0x1002 }
W/ViewRootImpl[LauncherSettingsActivity]: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=161.01006, y[0]=466.835, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=598901066, downTime=598899893, deviceId=5, source=0x1002 }
Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL, actionButton=0, id[0]=0, x[0]=161.01006, y[0]=466.835, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=598901066, downTime=598899893, deviceId=5, source=0x1002 }
W/OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
As debug messages suggest, I need to focus some window, but .getWindow().getDecorView().requestFocus()
on new nor old activity doesn't help.
It is similar to this problem: Android tracking touch event after new activity starts, instead I can't get events even in previous activity, so I can't redirect them via EventBus to the new activity, as it was there suggested.
Please help me what should I try to do so that I could get these MotionEvents, at least on old activity?