List of usage examples for android.content.pm PermissionInfo PROTECTION_SIGNATURE_OR_SYSTEM
int PROTECTION_SIGNATURE_OR_SYSTEM
To view the source code for android.content.pm PermissionInfo PROTECTION_SIGNATURE_OR_SYSTEM.
Click Source Link
From source file:com.github.michalbednarski.intentslab.PermissionInfoFragment.java
@SuppressLint("InlinedApi") private static String protectionLevelToString(int protectionLevel) { int base = protectionLevel & PermissionInfo.PROTECTION_MASK_BASE; int flags = protectionLevel & PermissionInfo.PROTECTION_MASK_FLAGS; // Base/*from ww w . j a va2 s .c o m*/ StringBuilder builder = new StringBuilder(base == PermissionInfo.PROTECTION_NORMAL ? "normal" : base == PermissionInfo.PROTECTION_DANGEROUS ? "dangerous" : base == PermissionInfo.PROTECTION_SIGNATURE ? "signature" : base == PermissionInfo.PROTECTION_SIGNATURE_OR_SYSTEM ? "signatureOrSystem" : String.valueOf(base) // If none matched ); // Flags if ((flags & PermissionInfo.PROTECTION_FLAG_SYSTEM) != 0) { builder.append("|system"); } if ((flags & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0) { builder.append("|development"); } // Unrecognized flags int unknownFlags = flags & ~(PermissionInfo.PROTECTION_FLAG_SYSTEM | PermissionInfo.PROTECTION_FLAG_DEVELOPMENT); if (unknownFlags != 0) { builder.append("|"); builder.append(unknownFlags); } return builder.toString(); }
From source file:com.github.michalbednarski.intentslab.browser.ComponentFetcher.java
@SuppressLint("InlinedApi") static boolean checkProtectionLevel(PermissionInfo permissionInfo, int protectionFilter) { // Skip test if all options are checked if ((protectionFilter & PROTECTION_ANY_LEVEL) == PROTECTION_ANY_LEVEL) { return true; }//w w w. j a va 2 s . c o m // Test protectionLevel int protectionLevel = permissionInfo.protectionLevel; if (protectionLevel == PermissionInfo.PROTECTION_SIGNATURE_OR_SYSTEM) { protectionLevel = PermissionInfo.PROTECTION_SIGNATURE | PermissionInfo.PROTECTION_FLAG_SYSTEM; } int protectionLevelBase = protectionLevel & PermissionInfo.PROTECTION_MASK_BASE; int protectionLevelFlags = protectionLevel & PermissionInfo.PROTECTION_MASK_FLAGS; // Match against our flags return ((protectionLevel == PermissionInfo.PROTECTION_NORMAL ? PROTECTION_NORMAL : protectionLevel == PermissionInfo.PROTECTION_DANGEROUS ? PROTECTION_DANGEROUS : (((protectionLevelBase == PermissionInfo.PROTECTION_SIGNATURE) ? PROTECTION_SIGNATURE : 0) | (((protectionLevelFlags & PermissionInfo.PROTECTION_FLAG_SYSTEM) != 0) ? PROTECTION_SYSTEM : 0) | (((protectionLevelFlags & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0) ? PROTECTION_DEVELOPMENT : 0))) & protectionFilter) != 0; }