1 package org.robolectric.manifest; 2 3 import java.util.List; 4 import java.util.Map; 5 6 public class ContentProviderData extends PackageItemData { 7 private static final String READ_PERMISSION = "android:readPermission"; 8 private static final String WRITE_PERMISSION = "android:writePermission"; 9 private static final String GRANT_URI_PERMISSION = "android:grantUriPermissions"; 10 private static final String ENABLED = "android:enabled"; 11 12 private final String authority; 13 private final Map<String, String> attributes; 14 private final List<PathPermissionData> pathPermissionDatas; 15 ContentProviderData( String className, MetaData metaData, String authority, Map<String, String> attributes, List<PathPermissionData> pathPermissionDatas)16 public ContentProviderData( 17 String className, 18 MetaData metaData, 19 String authority, 20 Map<String, String> attributes, 21 List<PathPermissionData> pathPermissionDatas) { 22 super(className, metaData); 23 this.authority = authority; 24 this.attributes = attributes; 25 this.pathPermissionDatas = pathPermissionDatas; 26 } 27 getAuthorities()28 public String getAuthorities() { 29 return authority; 30 } 31 getReadPermission()32 public String getReadPermission() { 33 return attributes.get(READ_PERMISSION); 34 } 35 getWritePermission()36 public String getWritePermission() { 37 return attributes.get(WRITE_PERMISSION); 38 } 39 getPathPermissionDatas()40 public List<PathPermissionData> getPathPermissionDatas() { 41 return pathPermissionDatas; 42 } 43 getGrantUriPermissions()44 public boolean getGrantUriPermissions() { 45 return Boolean.parseBoolean(attributes.get(GRANT_URI_PERMISSION)); 46 } 47 isEnabled()48 public boolean isEnabled() { 49 return attributes.containsKey(ENABLED) ? Boolean.parseBoolean(attributes.get(ENABLED)) : true; 50 } 51 } 52