1 /* 2 * Copyright (C) 2019 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.launcher3.testing; 18 19 import android.content.ContentProvider; 20 import android.content.ContentValues; 21 import android.database.Cursor; 22 import android.net.Uri; 23 import android.os.Bundle; 24 25 import com.android.launcher3.Utilities; 26 27 public class TestInformationProvider extends ContentProvider { 28 @Override onCreate()29 public boolean onCreate() { 30 return true; 31 } 32 33 @Override update(Uri uri, ContentValues contentValues, String s, String[] strings)34 public int update(Uri uri, ContentValues contentValues, String s, String[] strings) { 35 return 0; 36 } 37 38 @Override delete(Uri uri, String s, String[] strings)39 public int delete(Uri uri, String s, String[] strings) { 40 return 0; 41 } 42 43 @Override insert(Uri uri, ContentValues contentValues)44 public Uri insert(Uri uri, ContentValues contentValues) { 45 return null; 46 } 47 48 @Override getType(Uri uri)49 public String getType(Uri uri) { 50 return null; 51 } 52 53 @Override query(Uri uri, String[] strings, String s, String[] strings1, String s1)54 public Cursor query(Uri uri, String[] strings, String s, String[] strings1, String s1) { 55 return null; 56 } 57 58 @Override call(String method, String arg, Bundle extras)59 public Bundle call(String method, String arg, Bundle extras) { 60 if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { 61 TestInformationHandler handler = TestInformationHandler.newInstance(getContext()); 62 handler.init(getContext()); 63 return handler.call(method); 64 } 65 return null; 66 } 67 } 68