Debian Codegraph @

apct-tests/perftests/core/src/android/os/SomeProvider.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * 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, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16
17 package android.os;
18
19 import android.content.ContentProvider;
20 import android.content.ContentValues;
21 import android.content.Intent;
22 import android.database.Cursor;
23 import android.database.MatrixCursor;
24 import android.net.Uri;
25
26 import java.util.Arrays;
27
28 public class SomeProvider extends ContentProvider {
29 private Cursor mCursor;
30
31 @Override
32 public boolean onCreate() {
33 return true;
34 }
35
36 @Override
37 public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
38 String sortOrder) {
39 return mCursor;
40 }
41
42 @Override
43 public String getType(Uri uri) {
44 throw new UnsupportedOperationException();
45 }
46
47 @Override
48 public Uri insert(Uri uri, ContentValues values) {
49 throw new UnsupportedOperationException();
50 }
51
52 @Override
53 public int delete(Uri uri, String selection, String[] selectionArgs) {
54 throw new UnsupportedOperationException();
55 }
56
57 @Override
58 public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
59 final char[] valueRaw = new char[512];
60 Arrays.fill(valueRaw, '!');
61 final String value = new String(valueRaw);
62
63 final int count = values.getAsInteger(Intent.EXTRA_INDEX);
64 final MatrixCursor cursor = new MatrixCursor(new String[] { "_id", "value" });
65 for (int i = 0; i < count; i++) {
66 MatrixCursor.RowBuilder row = cursor.newRow();
67 row.add(0, i);
68 row.add(1, value);
69 }
70 mCursor = cursor;
71 return 1;
72 }
73 }