Always request Bluetooth permission for Improv if 1/2 is granted #4952
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4936. The issue is caused by the following combination:
It results in the user thinking everything is good, while the app doesn't continue and doesn't request additional permissions -> confusion why nothing is discovered.
This PR tries to fix it by checking when 1) not all permissions are granted and 2) the prompt was shown at least twice, if we need just one Bluetooth permission, and if so always requesting that permission. Because Improv needs two Bluetooth permissions that means something from the Nearby devices group was granted so when requesting it Android automatically grants it without asking the user.
For testing this you probably want to use some adb commands:
adb shell dumpsys package io.homeassistant.companion.android.debug | grep permission
to verify what exactly is grantedadb shell pm revoke io.homeassistant.companion.android.debug android.permission.BLUETOOTH_CONNECT
to revoke one but not the other Bluetooth permission (or thegrant
equivalent)Screenshots
n/a
Link to pull request in Documentation repository
n/a
Any other notes