PermissionsDispatcher 2.3.0 - Hello Xiaomi

2016-12-14

We’re so honored to announce that PermissionsDispatcher ver 2.3.0 is out!
You can grab the change log from the following link.
In this release we added one significant change and did a few bug fixes.

https://github.com/hotchemi/PermissionsDispatcher/releases/tag/2.3.0

Xiaomi workaround

ref: https://github.com/hotchemi/PermissionsDispatcher/pull/235

We’ve received a feature request to support Xiaomi from some Chinese developers for a long time. And finally we did it!
Actually I don’t know the reason but Xiaomi requires developers to use different way to check a permission is granted or not…
So we eventually added the following method inside of checker class and delegate the work when running device is Xiaomi.

1
2
3
4
5
6
@TargetApi(Build.VERSION_CODES.M)
private static boolean hasSelfPermissionForXiaomi(Context context, String permission) {
AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
int checkOp = appOpsManager.checkOp(AppOpsManager.permissionToOp(permission), Process.myUid(), context.getPackageName());
return checkOp == AppOpsManager.MODE_ALLOWED && ActivityCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED;
}

The problem is…we maintainer team don’t have any Xiaomi device so we couldn’t test it.
So it would be pretty awesome to support test if you have Xiaomi device.
You can download dependencies by adding below statement to your build.gradle.

1
2
3
4
dependencies {
compile 'com.github.hotchemi:permissionsdispatcher:2.3.0'
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.3.0'
}

If you come up with any other bug or feature request, please open an issue to GitHub:D

https://github.com/hotchemi/PermissionsDispatcher/issues