当前位置: 首页>>代码示例>>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;未经允许,请勿转载。