I am looking to test Android permissions that marked as 'signature' in and AVD within Android Studio.
I have set up the key store & key and attempted to use/request signature permissions in my Android app. I declare it AndroidManifest.xml
<uses-permission android:name="android.car.permission.CAR_MILEAGE" android:protectionLevel="signature"/>
and request the permission in onGetTemplate or on a button press
context.requestPermissions(listOf("android.car.permission.CAR_MILEAGE")) { granted, rejected ->
println("$granted $rejected")
}
I expect a permission request to grant the permission but it rejects instead. This setup works fine for a 'dangerous' permission for example, which expectedly asks for a permission. The 'signature' permission fails silently.
I have also tried making a signed APK and using adb to send that to the AVD which also did nothing.
There is a possibility that the debug/release versions are getting confused but I have signed them both to be sure.
Documentation seems to just refer to uploading the the Play Store.
signaturepermissions are notdangerouspermissions. Onlydangerouspermissions get requested at runtime.It would have to be signed by the same signing key as signed whatever is being defended by the
signaturepermission. In the case of a platform permission, that means your APK would have to be signed by the same signing key that signed the firmware that your AVD is running.