Skip to content

Commit

Permalink
fix: remove nested try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed Dec 22, 2024
1 parent 0d74de9 commit 9f5960c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ public static void PermissionManager_grantRuntimePermission(String packageName,
else if (Build.VERSION.SDK_INT == 34) {
try {
PERMISSION_MANAGER.getOrThrow().grantRuntimePermission(packageName, permissionName, 0, userId);
return;
}
catch (NoSuchMethodError e) {
PERMISSION_MANAGER.getOrThrow().grantRuntimePermission(packageName, permissionName, userId);
}
catch (NoSuchMethodError ignored) {}
// Retry with old method
PERMISSION_MANAGER.getOrThrow().grantRuntimePermission(packageName, permissionName, userId);
} else {
PERMISSION_MANAGER.getOrThrow().grantRuntimePermission(packageName, permissionName, userId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ void grantRuntimePermission(String packageName, String permissionName, int devic
void grantRuntimePermission(String packageName, String permissionName, String deviceId, int userId)
throws RemoteException;

void revokeRuntimePermission(String packageName, String permissionName, int userId,
String reason) throws RemoteException;

void revokeRuntimePermission(String packageName, String permissionName, int deviceId, int userId, String reason)
throws RemoteException;

abstract class Stub extends Binder implements IPermissionManager {

public static IPermissionManager asInterface(IBinder obj) {
Expand Down

0 comments on commit 9f5960c

Please sign in to comment.