Skip to content

Support SYSTEM_ALERT_WINDOW through Settings.canDrawOverlays()#14

Open
Dima-369 wants to merge 2 commits into
anthonycr:masterfrom
Dima-369:master
Open

Support SYSTEM_ALERT_WINDOW through Settings.canDrawOverlays()#14
Dima-369 wants to merge 2 commits into
anthonycr:masterfrom
Dima-369:master

Conversation

@Dima-369

Copy link
Copy Markdown

getPermissionsListToRequest() uses ActivityCompat.checkSelfPermission() to check if the permission is granted.

SYSTEM_ALERT_WINDOW is a 'special' dangerous permission, requiring the grant process through a special Settings.ACTION_MANAGE_OVERLAY_PERMISSION intent. Apparently, even if granting the access through the new Activity, ActivityCompat.checkSelfPermission() will return PERMISSION_DENIED.

I propose this tiny fix with uses Settings.canDrawOverlays() for SYSTEM_ALERT_WINDOW instead. Before requestAllManifestPermissionsIfNecessary() always called onDenied() if you worked with the special permission despite granting all other permissions access!

Dmytro Butemann added 2 commits February 24, 2016 23:38
This prepares the method to call Settings.canDrawOverlay().
checkSelfPermission() always returns PERMISSION_DENIED for
SYSTEM_ALERT_WINDOW as it is supposedly a dangerous 'special'
permission which needs to be granted through an Intent.
@Dima-369

Copy link
Copy Markdown
Author

Hmm, maybe this isn't the correct way to handle this!

I guess it would be better if getManifestPermissions() simply does not return SYSTEM_ALERT_WINDOW as it is used very rarely anyway.

Then we should add a note to the README.md for this behavior!
Extending requestAllManifestPermissionsIfNecessary() with the new Intents would probably be quite unexpected as the Android Intent opens an entirely new Activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant