bindal
bindal

Reputation: 141

Android Keyevent injection requires system permissions

hi i am using key event injection using window manager but when i tested this application it gives me error

  04-12 18:19:35.794: WARN/WindowManager(58): Permission denied: injecting key event        
  from pid 6290 uid 10039 to window Window{45034880  
   com.android.launcher/com.android.launcher2.Launcher paused=false} owned by uid 10020

   04-12 18:19:35.794: WARN/System.err(6290): java.lang.SecurityException: Injecting to 
    another application requires INJECT_EVENTS permission

 04-12 18:19:35.854: DEBUG/PhoneData(6290):

  04-12 18:19:36.048: WARN/System.err(6290):     at  
 android.os.Parcel.readException(Parcel.java:1247)

  04-12 18:19:36.048: WARN/System.err(6290):     at 
  android.os.Parcel.readException(Parcel.java:1235)

I also give the inject event permission is there any way to give a application system permissions.

Upvotes: 1

Views: 5867

Answers (2)

Phil Lello
Phil Lello

Reputation: 8639

Normally, you can't do this, for obvious security reasons. However, if this is for test purposes, you might find the Activity Testing documentation useful.

Hope this helps.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006984

Only applications that are part of the firmware (i.e., signed by the firmware signing key) can hold the INJECT_EVENTS permission. If you are making your own device or firmware, this will be relevant. If you are creating an ordinary SDK application, you cannot inject events.

Upvotes: 4

Related Questions