Fixed
Status Update
Comments
ar...@google.com <ar...@google.com> #2
Thank you for reporting this issue. We have shared this with our engineering team and will update this issue with more information as it becomes available.
lb...@gmail.com <lb...@gmail.com> #3
@2 This bug occurs even if the check is inside onActivityResult, yet I've tested it on Android 7.1.2 and below, and it doesn't occur there.
I've also noticed that the check works fine if I change the orientation after returning from the settings screen (meaning the activity was re-created)
I've also noticed that the check works fine if I change the orientation after returning from the settings screen (meaning the activity was re-created)
ar...@google.com <ar...@google.com> #4
For resolving "draw-on-top feature cannot be toggled", you need to add "android.permission.SYSTEM_ALERT_WINDOW" permission in Android Manifest file.
lb...@gmail.com <lb...@gmail.com> #5
@4 Then the bug is different for this case: why open this screen, if this permission isn't even available for this app... It should do something else. Maybe throw an exception that tells that the permission is missing from the manifest.
Also, the main isssue does exist: the check of the permission always returns false in the case I've shown.
Also, the main isssue does exist: the check of the permission always returns false in the case I've shown.
lb...@gmail.com <lb...@gmail.com> #6
@4 Bug exists on DP3 too (OPP3.170518.006)
ma...@marcardar.com <ma...@marcardar.com> #7
I can confirm the Settings.canDrawOverlays() always returns false when called from within Activity.onActivityResult() (latest Android O Emulator x86). And no such problems on earlier versions of Android.
However, in onActivityResult(), if instead I post a Runnable to the main thread handler, and call canDrawOverlays() in that, then it returns true. So I guess onActivityResult() is being called a little too early.
However, in onActivityResult(), if instead I post a Runnable to the main thread handler, and call canDrawOverlays() in that, then it returns true. So I guess onActivityResult() is being called a little too early.
ma...@marcardar.com <ma...@marcardar.com> #8
On further inspection, you need to wait about a second (in my few tests, between 900ms and 1300ms running the Android O DP3 emulator on a Late 2013 MBP) before canDrawOverlays() begins to return true.
lb...@gmail.com <lb...@gmail.com> #9
@8 Even if it was 1ms, it's still a bug. The check should return the immediate, correct answer: the app got the permission.
Not even that, but after going back from the draw-on-top screen on the second time, it should get the new value, because it hasn't changed since.
Not even that, but after going back from the draw-on-top screen on the second time, it should get the new value, because it hasn't changed since.
de...@mllr.one <de...@mllr.one> #10
Please compare:
=1=
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE);
--> then Settings.canDrawOverlays returns false;
=2=
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION));
startActivityForResult(intent, ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE);
--> then Settings.canDrawOverlays returns false;
In case of =2= there is additional step for selecting my app from the list of apps with manage overlay permissions.
=1=
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE);
--> then Settings.canDrawOverlays returns false;
=2=
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION));
startActivityForResult(intent, ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE);
--> then Settings.canDrawOverlays returns false;
In case of =2= there is additional step for selecting my app from the list of apps with manage overlay permissions.
de...@mllr.one <de...@mllr.one> #11
Sorry, for #10, in case of =2= Settings.canDrawOverlays returns true, not false.
il...@twitter.com <il...@twitter.com> #12
I have also stumbled upon this bug.
In my case, I have to wait until the transition back from Settings.ACTION_MANAGE_OVERLAY_PERMISSION to my app is finished. If I request the canDrawOverlays before then, I always get false. It seems like it needs to be performed when the activity is completely in focus.
In my case, I have to wait until the transition back from Settings.ACTION_MANAGE_OVERLAY_PERMISSION to my app is finished. If I request the canDrawOverlays before then, I always get false. It seems like it needs to be performed when the activity is completely in focus.
[Deleted User] <[Deleted User]> #13
This is also happening for me on a Pixel running Android O DP4.
I have attached a sample that should easily show what we are all talking about. It uses what was mentioned in #7. In onActivityResult(), I call Settings.canDrawOverlays() immediately, and I schedule a Runnable to get exectued after a second that will do the same thing. First time, the method returns false, and the second time it returns true.
1. Run the app
2. Click on "Ask for Permission"
3. Click on the "Allow display over other apps" toggle
4. Press back
Result: First, the text "Cannot display overlays" appears, and after a while, the text "Can display overlays" appears instead.
Expected: We should get "Can display overlays" immediately upon coming back to our Activity (after step 4).
I have attached a sample that should easily show what we are all talking about. It uses what was mentioned in #7. In onActivityResult(), I call Settings.canDrawOverlays() immediately, and I schedule a Runnable to get exectued after a second that will do the same thing. First time, the method returns false, and the second time it returns true.
1. Run the app
2. Click on "Ask for Permission"
3. Click on the "Allow display over other apps" toggle
4. Press back
Result: First, the text "Cannot display overlays" appears, and after a while, the text "Can display overlays" appears instead.
Expected: We should get "Can display overlays" immediately upon coming back to our Activity (after step 4).
lb...@gmail.com <lb...@gmail.com> #14
@4 Bug still exist even on official final version of Android O (OPR6.170623.013) .
Decided to make a new post for it, because here it's for preview version:
https://issuetracker.google.com/issues/64919285
Decided to make a new post for it, because here it's for preview version:
ar...@google.com <ar...@google.com> #15
Our engineering team has fixed this issue. It will be available in a future Android release.
lb...@gmail.com <lb...@gmail.com> #16
@15 which version?
si...@gmail.com <si...@gmail.com> #17
Could you tell me this issue was adapted release version? I am using nexus 5x.
si...@gmail.com <si...@gmail.com> #18
I am using Nexus5X.
Today I updated Android security patch.
but Bug still exist this version of Android O (OPR4.17.0623.009).
Can you tell me which version will be fixed?
Today I updated Android security patch.
but Bug still exist this version of Android O (OPR4.17.0623.009).
Can you tell me which version will be fixed?
lb...@gmail.com <lb...@gmail.com> #19
@18 I think he meant Android 8.1
si...@gmail.com <si...@gmail.com> #20
Today I updated Android 8.1 preview.
but it is still happening.
but it is still happening.
lb...@gmail.com <lb...@gmail.com> #21
Why is it marked as fixed then?
Should we create a new thread?
Should we create a new thread?
de...@gmail.com <de...@gmail.com> #22
Why is there a need to mark this as a duplicate if this issue has been going for over a year?
lb...@gmail.com <lb...@gmail.com> #23
@22 I don't see it marked as duplicate.
But I do see it marked as fixed for some reason.
To me it seems to be fixed only on Android P.
I don't get what should be done for previous versions.
Attached newest sample project.
But I do see it marked as fixed for some reason.
To me it seems to be fixed only on Android P.
I don't get what should be done for previous versions.
Attached newest sample project.
lb...@gmail.com <lb...@gmail.com> #24
Anyway, I've written a request to have an API that should always work, for all Android versions, here:
https://issuetracker.google.com/issues/76127554
Description
DP2 : OPP2.170420.019
* What device are you using? (for example, Nexus 6P)
Nexus 5x , but also on emulator. On emulator, in some weird cases, it can't even be toggled.
* What are the steps to reproduce the problem? (Please provide the minimal reproducible test case.)
1. prepare an app (attached sample project) that requests from the user to enable draw-on-top permission, using code as such:
final String packageName = getPackageName() ;
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + packageName));
startActivityForResult(intent, requestCode)
And when resuming the activity, check if the permission is given or not, using:
Settings.canDrawOverlays(this)
2. run it, grant the app the draw-on-top permission, and see on the app, if it can detect that the permission is actually granted.
The bug:
It will always return false.
* Issue Category e.g. Framework (platform), NDK (platform), Hardware (CPU, GPU, Sensor, Camera), ART (platform), Runtime Permissions etc
Runtime Permissions
* What was the expected result?
Return true in this case.
* What was the actual result?
Returns false
* Optional: Link to any screenshot(s) that demonstrate the issue (shared privately in Drive.)
Attached video showing the issue on emulator. The video shows the 2 sample projects (which are very identical). On one, it doesn't even allow to toggle the feature, and on another, it's the same as on Nexus 5x.