1 package com.android.cts.permissiondeclareapp; 2 3 import android.content.ContentProvider; 4 import android.content.ContentValues; 5 import android.database.Cursor; 6 import android.net.Uri; 7 import android.os.ParcelFileDescriptor; 8 9 import java.io.File; 10 import java.io.FileNotFoundException; 11 12 /** 13 * Empty content provider, all permissions are enforced in manifest 14 */ 15 public class PermissionContentProviderPath extends ContentProvider { 16 17 @Override delete(Uri uri, String selection, String[] selectionArgs)18 public int delete(Uri uri, String selection, String[] selectionArgs) { 19 // do nothing 20 return 0; 21 } 22 23 @Override getType(Uri uri)24 public String getType(Uri uri) { 25 return "got/theMIME"; 26 } 27 28 @Override insert(Uri uri, ContentValues values)29 public Uri insert(Uri uri, ContentValues values) { 30 return null; 31 } 32 33 @Override onCreate()34 public boolean onCreate() { 35 return false; 36 } 37 38 @Override query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)39 public Cursor query(Uri uri, String[] projection, String selection, 40 String[] selectionArgs, String sortOrder) { 41 return null; 42 } 43 44 @Override update(Uri uri, ContentValues values, String selection, String[] selectionArgs)45 public int update(Uri uri, ContentValues values, String selection, 46 String[] selectionArgs) { 47 return 0; 48 } 49 50 @Override openFile(Uri uri, String mode)51 public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { 52 return ParcelFileDescriptor.open( 53 new File("/dev/null"), ParcelFileDescriptor.MODE_READ_ONLY); 54 } 55 } 56