permissions-dispatcher / PermissionsDispatcher

A declarative API to handle Android runtime permissions.
https://github.com/permissions-dispatcher/PermissionsDispatcher
Apache License 2.0
11.22k stars 1.44k forks source link

Miui 10 show the request dialog twice #533

Closed HarveyLee1228 closed 5 years ago

HarveyLee1228 commented 5 years ago

When I request one permission,MIUI will show me the request dialog twice .When I clicked the nagative button ,it will show more than twice ,I dont know how to avoid it .I am using version 3.3.1

hotchemi commented 5 years ago

If you're not using library you can avoid the problem?

HarveyLee1228 commented 5 years ago

If you're not using library you can avoid the problem?

Yes,I didn't get this problem before I changed my code to this library ,and I test another phone(Huawei),this library works fine .So this problem happens on Miui.

hotchemi commented 5 years ago

Can I get a correct code that works correctly? 🤔

Currently we have dedicated code for Xiaomi but other than that it's supposed to be ok.. 🤔

https://github.com/permissions-dispatcher/PermissionsDispatcher/blob/1564313f8b253685dc7189b0fbb31a42b2e86796/library/src/main/java/permissions/dispatcher/PermissionUtils.java#L94

HarveyLee1228 commented 5 years ago

Can I get a correct code that works correctly?

Currently we have dedicated code for Xiaomi but other than that it's supposed to be ok..

PermissionsDispatcher/library/src/main/java/permissions/dispatcher/PermissionUtils.java

Line 94 in 1564313

private static boolean hasSelfPermission(Context context, String permission) {

Can I get a correct code that works correctly?

Currently we have dedicated code for Xiaomi but other than that it's supposed to be ok..

PermissionsDispatcher/library/src/main/java/permissions/dispatcher/PermissionUtils.java

Line 94 in 1564313

private static boolean hasSelfPermission(Context context, String permission) {

actually version 2.2.1 works correctly on Miui 10,I found this solution in the closed issue history. I suggest not to use the dedicated code for Miui.

hotchemi commented 5 years ago

You mean "Xiaomi".equalsIgnoreCase(Build.MANUFACTURER) returns true in Miui device? 👀 Could you possibly test with PermissionUtils.java? 🙇

ludovicroland commented 5 years ago

@hotchemi : I guess it's normal that the "Xiaomi".equalsIgnoreCase(Build.MANUFACTURER) returns true on the Miui device. Miui is developed by Xiaomi. So I guess @HarveyLee1228 is working on a Xiaomi phone. Right ?

Spikoss commented 5 years ago

@HarveyLee1228
when I do not use this library,my xiaomi phone can also show a permission dialog while i don't check permission in code,just in AndroidManifest.xml , so i think that because MIUI System has enclosured it, just as it enclosures Toast .

hotchemi commented 5 years ago

so does nothing when running on MIUI 10 is the answer? Then I'd like to close the issue because it's out of the scope haha 😅

she246 commented 5 years ago

I meet the same question,how to resolve that? use version 2.2.1?

hotchemi commented 5 years ago

@she246 @HarveyLee1228 @ludovicroland @Spikoss https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/533#issuecomment-438642578 what do you think?

hotchemi commented 5 years ago

Let us know your opinion https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/544

hc1028 commented 5 years ago

Miui 10 show the request dialog twice because : AppOpsManagerCompat.noteOp(context, permissionToOp, Process.myUid(), context.getPackageName()) I modified the source code image

MIUI may have modified the Android source code

hotchemi commented 5 years ago

Oh thank you! so https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/544 would solve the problem may be?😅

hotchemi commented 5 years ago

Do you think https://github.com/permissions-dispatcher/PermissionsDispatcher/pull/548 would address the issue?

hotchemi commented 5 years ago

I suppose 4.1.0 solves the issue. Check it out. https://github.com/permissions-dispatcher/PermissionsDispatcher/releases/tag/4.1.0