On a blank/wiped AVD (AAOS), I have list of permissions that I need to be accepted.
When I try this, currently only CAR_SPEED is granted (should I accept) and all others are rejected with no dialog box and no indication in settings that they were ever requested.
For example: android.car.permission.CAR_SPEED and android.car.permission.CAR_MILEAGE.
When I request these 2 using androidx.car.app.CarContext.requestPermisions, I get a dialog box asking for location access permission (android:permissionGroup="android.permission-group.LOCATION" for android.car.permission.CAR_SPEED). Speed is accepted but mileage is not. Note: mileage does not state itself to be in any group. The permissions are set up in the same way in
Only location permission request shows up in the app's settings. If I request these again, nothing is asked. It fails silently and the listener shows all of the other permissions (car mileage in this example) rejected.
Why is the behavior different and how can I ensure that all of the permissions are asked for instead of being instantly rejected?
Thank you!
In Android, different permissions have different protection levels. Here's a list of some of these. You can CTRL+F to find the permission you are looking for.
This can affect their behavior when they are requested at runtime.
For
android.car.permission.CAR_MILEAGE, the protection level issignature|privilegedPer Android Docs, the
signaturebase permission type is defined as follows:By definition, the protection level of this permission means it will never prompt or notify the user. Google states that this is because these permissions are best not handled by the user.
The
privilegedprotection level means that system apps are not subject to the above, and obtain it automatically.Assuming you don't want to/don't have the means to make it a system app (usually you do not), and it is silently failing as opposed to silently succeeding, ensure the following:
Hope this helps!