MuntashirAkon/AppManager · error · PermissionException
Unknown permission
Error message
Unknown permission ${permissionName} What it means
PermissionResolver.resolve looks up a permission's PermissionInfo through the platform. If the platform returns null for the requested permission name, the resolver cannot determine protection level or flags and throws PermissionException('Unknown permission ...').
Solutions
- Verify the permission name exists on this device (adb shell pm list permissions | grep <name>) before resolving
- Filter out permissions unknown to the current platform when importing rules from another device
- Catch PermissionException and skip that permission entry instead of aborting the whole batch
- Update the rules export to include only permissions declared by installed packages
Example fix
// before
Permission perm = resolver.resolve(packageInfo, "vendor.foo.CUSTOM_PERM", userId, false);
// after
try {
Permission perm = resolver.resolve(packageInfo, "vendor.foo.CUSTOM_PERM", userId, false);
} catch (PermissionException e) {
Log.w(TAG, "Skipping unknown permission", e);
} Defensive patterns
Strategy: try-catch
Validate before calling
Set<String> known = platform.getAllPermissions(); // or pm list permissions
if (!known.contains(permissionName)) {
Log.w(TAG, "Skipping unknown permission " + permissionName);
return;
} Type guard
boolean isKnownPermission(String name) {
try {
return platform.getPermissionInfo(name, null) != null;
} catch (Exception e) {
return false;
}
} Try / catch
try {
Permission p = resolver.resolve(packageInfo, name, userId, appOpAllowed);
} catch (PermissionException e) {
if (e.getMessage().startsWith("Unknown permission")) {
skippedPermissions.add(name);
} else throw e;
} Prevention
- Only import rules exported from the same device/ROM
- Filter rule files against the current device's permission list before resolving
- Treat per-permission failures as skippable, not fatal
When it happens
Trigger: Calling resolve() with a permissionName that the platform's getPermissionInfo() does not know: a typo, a permission declared only in an uninstalled app, or a vendor permission absent on this ROM.
Common situations: Applying permission rules exported from a different device/ROM where a vendor-defined permission existed; renamed permissions across Android versions; custom ROMs (e.g. LineageOS) lacking OEM permissions.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- An uninstallation was necessary but couldn't perform it.
- App Manager does not have the required permission
- Could not create directory
- Could not create directory named
- Could not create package staging directory
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/754e407353b0fe13.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/permission/PermissionResolver.java:33
/**
* Builds the permission model from current platform state.
*/
final class PermissionResolver {
private PermissionResolver() {
}
@NonNull
static Permission resolve(@NonNull PackageManagerPermissionPlatform platform,
@NonNull PackageInfo packageInfo,
@NonNull String permissionName,
@UserIdInt int userId,
boolean appOpAllowed) throws PermissionException {
try {
PermissionInfo permissionInfo = platform.getPermissionInfo(permissionName,
packageInfo.packageName);
if (permissionInfo == null) {
throw new PermissionException("Unknown permission " + permissionName);
}
boolean granted = platform.checkPermission(permissionName, packageInfo.packageName,
userId) == PERMISSION_GRANTED;
int flags = platform.getPermissionFlags(permissionName, packageInfo.packageName, userId);
int appOp = AppOpsManagerCompat.permissionToOpCode(permissionName);
int protection = PermissionInfoCompat.getProtection(permissionInfo);
int protectionFlags = PermissionInfoCompat.getProtectionFlags(permissionInfo);
if (protection == PermissionInfo.PROTECTION_DANGEROUS
&& PermUtils.systemSupportsRuntimePermissions()) {
return new RuntimePermission(permissionName, granted, appOp, appOpAllowed, flags);
}
if ((protectionFlags & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0) {
return new DevelopmentPermission(permissionName, granted, appOp, appOpAllowed,
flags);
}
return new ReadOnlyPermission(permissionName, granted, appOp, appOpAllowed, flags);
} catch (PermissionException e) {
throw e;View on GitHub (pinned to 0152f468fc)