4

I use RPi3 with Android Things 0.5.1. Although I have in my AndroidManifest.xml the permission:

<uses-permission android:name="com.google.android.things.permission.MANAGE_INPUT_DRIVERS" />

I get the exception:

java.lang.SecurityException: Caller lacks required permission com.google.android.things.permission.MANAGE_INPUT_DRIVERS

Anybody got working this permission on 0.5.1?

Alexander Tumanin
  • 1,638
  • 2
  • 23
  • 37

1 Answers1

18

That permission is currently marked as a dangerous permission, which would typically require granting at runtime by the user on standard Android. In Android Things, these permissions are granted automatically, but only on device boot. You need to do one of the following to give that permission to your app:

  1. Reboot the device after the first installation. This will grant the permission on restart.
  2. Install the APK manually using adb install -g <APK> the first time. This flag grants all requested permissions on install, so you can avoid the reboot.
  3. Upgrade to Android Studio 3.0, which will automatically grant these permissions on install for you so you don't need to do either #1 or #2.
devunwired
  • 62,780
  • 12
  • 127
  • 139
  • 4
    using Android Studio 3.0 doesn't avoid the restart. At least not in my case. – Michael Vescovo Jan 13 '18 at 04:59
  • 3
    @MichaelVescovo There is a bug (fixed in Studio 3.1) where this doesn't work if Instant Run is enabled (which is on by default). That's most likely what you are running into. – devunwired Jan 16 '18 at 23:07