1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.cts.ephemeralapp1; 18 19 import android.content.ContentProvider; 20 import android.content.ContentResolver; 21 import android.content.ContentValues; 22 import android.content.UriMatcher; 23 import android.database.CharArrayBuffer; 24 import android.database.ContentObserver; 25 import android.database.Cursor; 26 import android.database.DataSetObserver; 27 import android.database.MatrixCursor; 28 import android.net.Uri; 29 import android.os.Bundle; 30 31 public class EphemeralProvider extends ContentProvider { 32 private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); 33 static { 34 sUriMatcher.addURI("com.android.cts.ephemeralapp1.provider", "table", 1); 35 } 36 private static final String[] sColumnNames = { "_ID", "name" }; 37 private static final MatrixCursor sCursor = new MatrixCursor(sColumnNames, 1); 38 static { 39 sCursor.newRow().add(1).add("InstantAppProvider"); 40 } 41 42 @Override 43 public boolean onCreate() { 44 return true; 45 } 46 47 @Override 48 public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, 49 String sortOrder) { 50 return (sUriMatcher.match(uri) != 1) ? null : sCursor; 51 } 52 53 @Override 54 public String getType(Uri uri) { 55 return null; 56 } 57 58 @Override 59 public Uri insert(Uri uri, ContentValues values) { 60 return null; 61 } 62 63 @Override 64 public int delete(Uri uri, String selection, String[] selectionArgs) { 65 return 0; 66 } 67 68 @Override 69 public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { 70 return 0; 71 } 72 73 } 74