bhaikyakarrahahaitu-android icon indicating copy to clipboard operation
bhaikyakarrahahaitu-android copied to clipboard

fixed #2 - Extra miui permissions Dialog (cancellable => false)

Open Anshul1507 opened this issue 2 years ago • 6 comments

Setting Dialog for Extra miui permissions cancellable false to not bypass the permission flow.

Anshul1507 avatar Mar 17 '22 18:03 Anshul1507

Hold on with this PR @oddlyspaced, there are other issues related to this.

I have tested this code in MIUI 8 (Android 11) and the outcomes are: On the current codebase (before this PR), On opening the app, we have the first non-cancellable dialog to enable accessible service, after giving that permission, we have a second cancellable dialog for the permission of Display popup windows while running in the background.

The issue is here, after allowing this permission when I get back to the app, it again shows me that cancellable second dialog, and the loop goes on if I follow up the flow (Clicking on Dialog to give permission > Allow permission > Back to app > Shows dialog). So, here the second dialog is cancellable as per that, Case 1: if user cancel that dialog without giving permission, the app does not work correctly Case 2: if the user cancels that dialog after giving the permission, the app works.

That infinite loop of second permission dialog is due to showing dialog if the device is MIUI in onResume() method, We can solve this issue by checking if this "display popup windows while running in the background" is given by the user in that else if case of onResume() method.

Anshul1507 avatar Mar 17 '22 21:03 Anshul1507

I have somewhat solved this problem, but I need confirmation of one permission. Are we only asking that permission "display popup windows while running in the background" only for MIUI devices? App is working fine in devices other than MIUI without this permission?

Anshul1507 avatar Mar 17 '22 21:03 Anshul1507

Can you possibly check on a device running MIUI 12?

Also I specifically made the MIUI Permission dialog not cancellable so that the user can just skip it once they enable the permission. I'm currently exploring a better way to implement it. If you have any ideas feel free to create a PR or share them.

oddlyspaced avatar Mar 18 '22 14:03 oddlyspaced

Ohh My bad @oddlyspaced, The device in which I was testing is MIUI 12.5.6

Anshul1507 avatar Mar 18 '22 14:03 Anshul1507

I have somewhat solved this problem, but I need confirmation of one permission. Are we only asking that permission "display popup windows while running in the background" only for MIUI devices? App is working fine in devices other than MIUI without this permission?

Are we using "display popup windows" permission for all kinds of devices?

Anshul1507 avatar Mar 18 '22 14:03 Anshul1507

That particular permission is only limited to miui devices afaik. And the service malfunctioning thing is also miui specific as far as my experience goes.

oddlyspaced avatar Mar 18 '22 19:03 oddlyspaced