Skip to content

Commit 9758034

Browse files
committed
allPermissionsGranted should return true fo permissions==null case.
1 parent a145035 commit 9758034

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

android/src/main/java/com/pauldemarco/flutter_blue/FlutterBluePlugin.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -646,11 +646,11 @@ public void onMethodCall(MethodCall call, Result result) {
646646
}
647647
}
648648

649-
void ensurePermissionBeforeAction(String permissionA12, String permission, OperationOnPermission operation) {
649+
private void ensurePermissionBeforeAction(String permissionA12, String permission, OperationOnPermission operation) {
650650
ensurePermissionsBeforeAction(new String[]{ permissionA12 }, permission, operation);
651651
}
652652

653-
void ensurePermissionsBeforeAction(String[] permissionsA12, String permission, OperationOnPermission operation) {
653+
private void ensurePermissionsBeforeAction(String[] permissionsA12, String permission, OperationOnPermission operation) {
654654
String[] permissions = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? permissionsA12 : permission != null ? new String[] { permission } : null;
655655
if (!allPermissionsGranted(permissions)) {
656656
operationsOnPermission.put(lastEventId, (granted, perm) -> {
@@ -667,8 +667,8 @@ void ensurePermissionsBeforeAction(String[] permissionsA12, String permission, O
667667
}
668668
}
669669

670-
boolean allPermissionsGranted(String[] permissions) {
671-
if (permissions == null) return false;
670+
private boolean allPermissionsGranted(String[] permissions) {
671+
if (permissions == null) return true;
672672
for (int i = 0; i < permissions.length; i++) {
673673
if (ContextCompat.checkSelfPermission(context, permissions[i]) != PackageManager.PERMISSION_GRANTED)
674674
return false;
@@ -1017,7 +1017,7 @@ public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) {
10171017
}
10181018
};
10191019

1020-
enum LogLevel
1020+
private enum LogLevel
10211021
{
10221022
EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG;
10231023
}
@@ -1041,7 +1041,7 @@ public void run() {
10411041

10421042
// BluetoothDeviceCache contains any other cached information not stored in Android Bluetooth API
10431043
// but still needed Dart side.
1044-
class BluetoothDeviceCache {
1044+
private class BluetoothDeviceCache {
10451045
final BluetoothGatt gatt;
10461046
int mtu;
10471047

0 commit comments

Comments
 (0)