當前位置: 首頁>>代碼示例>>Java>>正文


Java PermissionInfo.PROTECTION_FLAG_DEVELOPMENT屬性代碼示例

本文整理匯總了Java中android.content.pm.PermissionInfo.PROTECTION_FLAG_DEVELOPMENT屬性的典型用法代碼示例。如果您正苦於以下問題:Java PermissionInfo.PROTECTION_FLAG_DEVELOPMENT屬性的具體用法?Java PermissionInfo.PROTECTION_FLAG_DEVELOPMENT怎麽用?Java PermissionInfo.PROTECTION_FLAG_DEVELOPMENT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.content.pm.PermissionInfo的用法示例。


在下文中一共展示了PermissionInfo.PROTECTION_FLAG_DEVELOPMENT屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isDisplayablePermission

private boolean isDisplayablePermission(PermissionInfo pInfo, int existingReqFlags) {
    final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
    final boolean isNormal = base == PermissionInfo.PROTECTION_NORMAL;
    final boolean isDangerous = base == PermissionInfo.PROTECTION_DANGEROUS
            || ((pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_PRE23) != 0);

    // Dangerous and normal permissions are always shown to the user
    // this is matches the permission list in AppDetails2
    if (isNormal || isDangerous) {
        return true;
    }

    final boolean isDevelopment = (pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0;
    final boolean wasGranted = (existingReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0;

    // Development permissions are only shown to the user if they are already
    // granted to the app -- if we are installing an app and they are not
    // already granted, they will not be granted as part of the install.
    return isDevelopment && wasGranted;
}
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:20,代碼來源:AppSecurityPermissions.java

示例2: isDisplayablePermission

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private boolean isDisplayablePermission(PermissionInfo pInfo, int existingReqFlags) {
    final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
    final boolean isNormal = base == PermissionInfo.PROTECTION_NORMAL;
    final boolean isDangerous = base == PermissionInfo.PROTECTION_DANGEROUS;

    // Dangerous and normal permissions are always shown to the user
    if (isNormal || isDangerous) {
        return true;
    }

    final boolean isDevelopment = (pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0;
    final boolean wasGranted = (existingReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0;

    // Development permissions are only shown to the user if they are already
    // granted to the app -- if we are installing an app and they are not
    // already granted, they will not be granted as part of the install.
    return isDevelopment && wasGranted;
}
 
開發者ID:CmDnoEdition,項目名稱:fdroid,代碼行數:19,代碼來源:AppSecurityPermissions.java

示例3: isDisplayablePermission

private boolean isDisplayablePermission(PermissionInfo pInfo, int newReqFlags,
        int existingReqFlags) {
    final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
    final boolean isNormal = (base == PermissionInfo.PROTECTION_NORMAL);
    final boolean isDangerous = (base == PermissionInfo.PROTECTION_DANGEROUS);
    // TODO: recheck
    //final boolean isRequired =
    //        ((newReqFlags & PackageInfo.REQUESTED_PERMISSION_REQUIRED) != 0);
    final boolean isDevelopment =
            ((pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0);
    final boolean wasGranted =
            ((existingReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0);
    final boolean isGranted =
            ((newReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0);

    // Dangerous and normal permissions are always shown to the user if the permission
    // is required, or it was previously granted
    if ((isNormal || isDangerous) && (/*isRequired || */wasGranted || isGranted)) {
        return true;
    }

    // Development permissions are only shown to the user if they are already
    // granted to the app -- if we are installing an app and they are not
    // already granted, they will not be granted as part of the install.
    return isDevelopment && wasGranted;
}
 
開發者ID:amartinz,項目名稱:DeviceControl,代碼行數:26,代碼來源:AppSecurityPermissions.java

示例4: isDisplayablePermission

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private boolean isDisplayablePermission(PermissionInfo pInfo, int newReqFlags,
        int existingReqFlags) {
    final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
    final boolean isNormal = base == PermissionInfo.PROTECTION_NORMAL;
    final boolean isDangerous = base == PermissionInfo.PROTECTION_DANGEROUS;
    final boolean isRequired =
            (newReqFlags & PackageInfo.REQUESTED_PERMISSION_REQUIRED) != 0;
    final boolean wasGranted =
            (existingReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0;
    final boolean isGranted =
            (newReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0;

    // Dangerous and normal permissions are always shown to the user if the permission
    // is required, or it was previously granted
    if ((isNormal || isDangerous) && (isRequired || wasGranted || isGranted ||
            Build.VERSION.SDK_INT < 16)) {
        return true;
    }

    final boolean isDevelopment =
            (pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0;

    // Development permissions are only shown to the user if they are already
    // granted to the app -- if we are installing an app and they are not
    // already granted, they will not be granted as part of the install.
    return isDevelopment && wasGranted;
}
 
開發者ID:nutellarlz,項目名稱:AppHub,代碼行數:28,代碼來源:AppSecurityPermissions.java

示例5: getProtectionLevelString

public static String getProtectionLevelString(int level) {
    String protLevel = "????";
    switch (level & PermissionInfo.PROTECTION_MASK_BASE) {
        case PermissionInfo.PROTECTION_DANGEROUS:
            protLevel = "dangerous";
            break;
        case PermissionInfo.PROTECTION_NORMAL:
            protLevel = "normal";
            break;
        case PermissionInfo.PROTECTION_SIGNATURE:
            protLevel = "signature";
            break;
        case PermissionInfo.PROTECTION_SIGNATURE_OR_SYSTEM:
            protLevel = "signatureOrSystem";
            break;
    }
    if ((level & PermissionInfo.PROTECTION_FLAG_SYSTEM) != 0) {
        protLevel += "|system";
    }
    if ((level & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0) {
        protLevel += "|development";
    }
    if ((level & PermissionInfo.PROTECTION_FLAG_APPOP) != 0) {
        protLevel += "|appop";
    }
    return protLevel;
}
 
開發者ID:MajeurAndroid,項目名稱:Android-Applications-Info,代碼行數:27,代碼來源:Utils.java

示例6: checkProtectionLevelRaw

@SuppressLint("InlinedApi")
// TODO: drop this method once we migrate PermissionFetcher to MyPackageManager
static boolean checkProtectionLevelRaw(PermissionInfo permissionInfo, int protectionFilter) {
    // Skip test if all options are checked
    if ((protectionFilter & PROTECTION_ANY_LEVEL) == PROTECTION_ANY_LEVEL) {
        return true;
    }

    // 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;
}
 
開發者ID:michalbednarski,項目名稱:IntentsLab,代碼行數:30,代碼來源:ComponentFetcher.java

示例7: protectionLevelToString

@SuppressLint("InlinedApi")
private static String protectionLevelToString(int protectionLevel) {
    int base = protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
    int flags = protectionLevel & PermissionInfo.PROTECTION_MASK_FLAGS;

    // Base
    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();
}
 
開發者ID:michalbednarski,項目名稱:IntentsLab,代碼行數:33,代碼來源:PermissionInfoFragment.java

示例8: isDevelopment

@Override
public boolean isDevelopment() {
    return isSignature() && (mSystemPermissionInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0;
}
 
開發者ID:michalbednarski,項目名稱:IntentsLab,代碼行數:4,代碼來源:MyPermissionInfoImpl.java


注:本文中的android.content.pm.PermissionInfo.PROTECTION_FLAG_DEVELOPMENT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。