1

Is it possible to simulate touch events in Android from one app to another app? Perhaps use a service or an invisible activity with SYSTEM_ALERT property to receive the input touches then simulate them to another activity of another application which is directly below the transparent activity of your application. Is this possible?

[UPDATE]

Taking FoamyGuy's answer into account, is it possible to have an invisible SYSTEM_ALERT activity to filter out certain touch events? I know you can revoke input for the activity. Is it possible to revoke selective input? Or do I still have to create a custom ROM?

Karthik Balakrishnan
  • 4,353
  • 6
  • 37
  • 69

2 Answers2

1

It is not possible. This would be cause for major security concern. You can use the Instrumentation APIs to inject events into your own Activities, but you cannot inject events into any Activities that are not your own.

The ability to do so would make it trivial to circumvent the necessity for user interaction to do certain things (i.e. install/uninstall apps).

If you want to be able to do it you'll have to modify the system on your own device to enable it.

FoamyGuy
  • 46,603
  • 18
  • 125
  • 156
1

Yes it is, if your app is signed with the platform certificate you may use the INJECT_EVENTS permission and inject events on any application:

http://developer.android.com/reference/android/Manifest.permission.html#INJECT_EVENTS

thiagolr
  • 6,909
  • 6
  • 44
  • 64
  • Is this permission allowed in applications which are going to published on the PlayStore? – Karthik Balakrishnan May 24 '13 at 14:17
  • I don't know, but even if it allowed, it wouldn't work on the majority of devices because the APK signature must match the device's system/platform signature. So if your objective is to publish an app on Play Store, you will not be able to do that. But if you are creating an app for a specific device, then this will work. – thiagolr May 24 '13 at 14:36