mirror of
https://github.com/godotengine/godot
synced 2024-09-05 18:29:41 +00:00
Merge pull request #92709 from m4gr3d/fix_request_permissions_return_value
Fix invalid return value when multiple permission requests are dispatched
This commit is contained in:
commit
7118487f9d
|
@ -125,7 +125,7 @@ public final class PermissionsUtil {
|
|||
}
|
||||
|
||||
activity.requestPermissions(requestedPermissions.toArray(new String[0]), REQUEST_ALL_PERMISSION_REQ_CODE);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -281,8 +281,9 @@ public final class PermissionsUtil {
|
|||
public static boolean hasManifestPermission(Context context, String permission) {
|
||||
try {
|
||||
for (String p : getManifestPermissions(context)) {
|
||||
if (permission.equals(p))
|
||||
if (permission.equals(p)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException ignored) {
|
||||
}
|
||||
|
@ -299,8 +300,9 @@ public final class PermissionsUtil {
|
|||
public static ArrayList<String> getManifestPermissions(Context context) throws PackageManager.NameNotFoundException {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS);
|
||||
if (packageInfo.requestedPermissions == null)
|
||||
return new ArrayList<String>();
|
||||
if (packageInfo.requestedPermissions == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return new ArrayList<>(Arrays.asList(packageInfo.requestedPermissions));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue