1380058bb18437475db82fd1632932795a4349f8cNick Kralevich/*
2380058bb18437475db82fd1632932795a4349f8cNick Kralevich * Copyright (C) 2012 The Android Open Source Project
3380058bb18437475db82fd1632932795a4349f8cNick Kralevich *
4380058bb18437475db82fd1632932795a4349f8cNick Kralevich * Licensed under the Apache License, Version 2.0 (the "License");
5380058bb18437475db82fd1632932795a4349f8cNick Kralevich * you may not use this file except in compliance with the License.
6380058bb18437475db82fd1632932795a4349f8cNick Kralevich * You may obtain a copy of the License at
7380058bb18437475db82fd1632932795a4349f8cNick Kralevich *
8380058bb18437475db82fd1632932795a4349f8cNick Kralevich *      http://www.apache.org/licenses/LICENSE-2.0
9380058bb18437475db82fd1632932795a4349f8cNick Kralevich *
10380058bb18437475db82fd1632932795a4349f8cNick Kralevich * Unless required by applicable law or agreed to in writing, software
11380058bb18437475db82fd1632932795a4349f8cNick Kralevich * distributed under the License is distributed on an "AS IS" BASIS,
12380058bb18437475db82fd1632932795a4349f8cNick Kralevich * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13380058bb18437475db82fd1632932795a4349f8cNick Kralevich * See the License for the specific language governing permissions and
14380058bb18437475db82fd1632932795a4349f8cNick Kralevich * limitations under the License.
15380058bb18437475db82fd1632932795a4349f8cNick Kralevich */
16380058bb18437475db82fd1632932795a4349f8cNick Kralevich
17380058bb18437475db82fd1632932795a4349f8cNick Kralevichpackage com.android.cts.permissiondeclareappcompat;
18380058bb18437475db82fd1632932795a4349f8cNick Kralevich
19380058bb18437475db82fd1632932795a4349f8cNick Kralevichimport android.content.ContentProvider;
20380058bb18437475db82fd1632932795a4349f8cNick Kralevichimport android.content.ContentValues;
21380058bb18437475db82fd1632932795a4349f8cNick Kralevichimport android.database.Cursor;
22380058bb18437475db82fd1632932795a4349f8cNick Kralevichimport android.net.Uri;
232994c16f06d6b19c17b3340b51fa4605f8e6f74dJeff Sharkeyimport android.os.ParcelFileDescriptor;
242994c16f06d6b19c17b3340b51fa4605f8e6f74dJeff Sharkey
252994c16f06d6b19c17b3340b51fa4605f8e6f74dJeff Sharkeyimport java.io.File;
262994c16f06d6b19c17b3340b51fa4605f8e6f74dJeff Sharkeyimport java.io.FileNotFoundException;
27380058bb18437475db82fd1632932795a4349f8cNick Kralevich
28380058bb18437475db82fd1632932795a4349f8cNick Kralevich/**
29380058bb18437475db82fd1632932795a4349f8cNick Kralevich * Empty content provider, all permissions are enforced in manifest
30380058bb18437475db82fd1632932795a4349f8cNick Kralevich */
31380058bb18437475db82fd1632932795a4349f8cNick Kralevichpublic class AmbiguousContentProvider extends ContentProvider {
32380058bb18437475db82fd1632932795a4349f8cNick Kralevich
33380058bb18437475db82fd1632932795a4349f8cNick Kralevich    @Override
34380058bb18437475db82fd1632932795a4349f8cNick Kralevich    public int delete(Uri uri, String selection, String[] selectionArgs) {
35380058bb18437475db82fd1632932795a4349f8cNick Kralevich        // do nothing
36380058bb18437475db82fd1632932795a4349f8cNick Kralevich        return 0;
37380058bb18437475db82fd1632932795a4349f8cNick Kralevich    }
38380058bb18437475db82fd1632932795a4349f8cNick Kralevich
39380058bb18437475db82fd1632932795a4349f8cNick Kralevich    @Override
40380058bb18437475db82fd1632932795a4349f8cNick Kralevich    public String getType(Uri uri) {
41380058bb18437475db82fd1632932795a4349f8cNick Kralevich        return "got/theUnspecifiedMIME";
42380058bb18437475db82fd1632932795a4349f8cNick Kralevich    }
43380058bb18437475db82fd1632932795a4349f8cNick Kralevich
44380058bb18437475db82fd1632932795a4349f8cNick Kralevich    @Override
45380058bb18437475db82fd1632932795a4349f8cNick Kralevich    public Uri insert(Uri uri, ContentValues values) {
46380058bb18437475db82fd1632932795a4349f8cNick Kralevich        return null;
47380058bb18437475db82fd1632932795a4349f8cNick Kralevich    }
48380058bb18437475db82fd1632932795a4349f8cNick Kralevich
49380058bb18437475db82fd1632932795a4349f8cNick Kralevich    @Override
50380058bb18437475db82fd1632932795a4349f8cNick Kralevich    public boolean onCreate() {
51380058bb18437475db82fd1632932795a4349f8cNick Kralevich        return false;
52380058bb18437475db82fd1632932795a4349f8cNick Kralevich    }
53380058bb18437475db82fd1632932795a4349f8cNick Kralevich
54380058bb18437475db82fd1632932795a4349f8cNick Kralevich    @Override
55380058bb18437475db82fd1632932795a4349f8cNick Kralevich    public Cursor query(Uri uri, String[] projection, String selection,
56380058bb18437475db82fd1632932795a4349f8cNick Kralevich            String[] selectionArgs, String sortOrder) {
57380058bb18437475db82fd1632932795a4349f8cNick Kralevich        return null;
58380058bb18437475db82fd1632932795a4349f8cNick Kralevich    }
59380058bb18437475db82fd1632932795a4349f8cNick Kralevich
60380058bb18437475db82fd1632932795a4349f8cNick Kralevich    @Override
61380058bb18437475db82fd1632932795a4349f8cNick Kralevich    public int update(Uri uri, ContentValues values, String selection,
62380058bb18437475db82fd1632932795a4349f8cNick Kralevich            String[] selectionArgs) {
63380058bb18437475db82fd1632932795a4349f8cNick Kralevich        return 0;
64380058bb18437475db82fd1632932795a4349f8cNick Kralevich    }
652994c16f06d6b19c17b3340b51fa4605f8e6f74dJeff Sharkey
662994c16f06d6b19c17b3340b51fa4605f8e6f74dJeff Sharkey    @Override
672994c16f06d6b19c17b3340b51fa4605f8e6f74dJeff Sharkey    public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
682994c16f06d6b19c17b3340b51fa4605f8e6f74dJeff Sharkey        return ParcelFileDescriptor.open(
692994c16f06d6b19c17b3340b51fa4605f8e6f74dJeff Sharkey                new File("/dev/null"), ParcelFileDescriptor.MODE_READ_ONLY);
702994c16f06d6b19c17b3340b51fa4605f8e6f74dJeff Sharkey    }
71380058bb18437475db82fd1632932795a4349f8cNick Kralevich}
72