Search in sources :

Example 1 with PathPermissionData

use of org.robolectric.manifest.PathPermissionData in project robolectric by robolectric.

the class DefaultPackageManager method createPathPermissions.

private PathPermission[] createPathPermissions(List<PathPermissionData> pathPermissionDatas) {
    PathPermission[] pathPermissions = new PathPermission[pathPermissionDatas.size()];
    for (int i = 0; i < pathPermissions.length; i++) {
        PathPermissionData data = pathPermissionDatas.get(i);
        final String path;
        final int type;
        if (data.pathPrefix != null) {
            path = data.pathPrefix;
            type = PathPermission.PATTERN_PREFIX;
        } else if (data.pathPattern != null) {
            path = data.pathPattern;
            type = PathPermission.PATTERN_SIMPLE_GLOB;
        } else {
            path = data.path;
            type = PathPermission.PATTERN_LITERAL;
        }
        pathPermissions[i] = new PathPermission(path, type, data.readPermission, data.writePermission);
    }
    return pathPermissions;
}
Also used : PathPermission(android.content.pm.PathPermission) PathPermissionData(org.robolectric.manifest.PathPermissionData)

Aggregations

PathPermission (android.content.pm.PathPermission)1 PathPermissionData (org.robolectric.manifest.PathPermissionData)1