How can I programmatically simulate activity so the phone doesn't go to sleep due to inactivity?
<p>First, I know about <a href="http://stackoverflow.com/a/3723649/1287251">WakeLock</a> and <a href="http://stackoverflow.com/a/6553807/1287251">setKeepScreenOn</a>. My needs are just a bit different, and I'm not even sure if it's possible.</p>

<p>I'm generating touch events in one thread by calling <code>MotionEvent.obtain()</code> and then dispatching them to the top activity with <code>activity.dispatchTouchEvent()</code>. This is working fine, except the device can go to sleep because the generated touch events don't seem to be recognized as user activity, and the phone can go to sleep due to inactivity.</p>

<p>Is it possible, and if so how, to tell the activity (or application, or OS; whatever needs to be told) "Hey, there's been activity" so it doesn't auto sleep, but still allow the phone to auto sleep like normal if there hasn't been any activity for long enough (i.e. if my thread doesn't generate and send a touch event for a long enough time)? Basically, I want these generated touch events to keep the phone awake just like real touch events. The problem with <code>WakeLock</code> and <code>setKeepScreenOn()</code> is that they force the screen to stay on and don't allow it to sleep (or whatever the user's device's default behavior is) due to inactivity.</p>
