The difference between the predefined and privileged level of protection

API 23 renamed the security level systemto privileged. He also introduced a level of protection preinstalled.

Does it privileged preinstalled? In other words, if an application has access to permissions privileged(that is, it is a system application), does it have access to permissions preinstalled, even if these permissions are not specified as privileged(only)?

+4
source share
2 answers

, privileged (.. ). preinstalled , () , . grantSignaturePermission():

if (!allowed && (bp.protectionLevel
        & PermissionInfo.PROTECTION_FLAG_PREINSTALLED) != 0
        && isSystemApp(pkg)) {
    // Any pre-installed system app is allowed to get this permission.
    allowed = true;
}

( API, ), . ActivityInfo:

/**
 * Value for {@link #flags}: if set, this application is installed in the
 * device system image.
 */
public static final int FLAG_SYSTEM = 1<<0;

// Many lines not shown

public boolean isSystemApp() {
    return (flags & ApplicationInfo.FLAG_SYSTEM) != 0;
}
+1

, , (, ). system privileged.

+2

Source: https://habr.com/ru/post/1614168/


All Articles