package no.finn.android.rx;

import static android.content.pm.PackageManager.PERMISSION_GRANTED;

public class PermissionResult {
    public final String[] permissions;
    public final int[] grantResults;
    public final boolean showRationale;
    public final boolean granted;

    public PermissionResult(String[] permissions, int[] grantResults, boolean showRationale) {
        this.permissions = permissions;
        this.grantResults = grantResults;
        this.showRationale = showRationale;
        boolean allPermissionsGranted = true;
        for (int i = 0; i < permissions.length; i++) {
            boolean permissionGranted = grantResults[i] == PERMISSION_GRANTED;
            allPermissionsGranted = allPermissionsGranted && permissionGranted;
        }
        this.granted = allPermissionsGranted;
    }
}

@@ -765,16 +765,120 @@
       %7D%0A
+        // If permissions.length == 0 it should be considered a cancellation according to documentation%0A
         
@@ -909,22 +909,48 @@
 sionsGranted
+ && permissions.length %3E 0
 ;%0A    %7D%0A%7D%0A

deal with permissionresults.length = 0 case