1 /* 2 * Copyright 2018 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 androidx.work.impl; 18 19 import android.content.ContentProvider; 20 import android.content.ContentValues; 21 import android.database.Cursor; 22 import android.net.Uri; 23 import android.support.annotation.NonNull; 24 import android.support.annotation.Nullable; 25 import android.support.annotation.RestrictTo; 26 27 import androidx.work.Configuration; 28 import androidx.work.WorkManager; 29 30 /** 31 * The {@link ContentProvider} responsible for initializing {@link WorkManagerImpl}. 32 * 33 * @hide 34 */ 35 @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) 36 public class WorkManagerInitializer extends ContentProvider { 37 @Override 38 public boolean onCreate() { 39 // Initialize WorkManager with the default configuration. 40 WorkManager.initialize(getContext(), new Configuration.Builder().build()); 41 return true; 42 } 43 44 @Nullable 45 @Override 46 public Cursor query(@NonNull Uri uri, 47 @Nullable String[] projection, 48 @Nullable String selection, 49 @Nullable String[] selectionArgs, 50 @Nullable String sortOrder) { 51 return null; 52 } 53 54 @Nullable 55 @Override 56 public String getType(@NonNull Uri uri) { 57 return null; 58 } 59 60 @Nullable 61 @Override 62 public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) { 63 return null; 64 } 65 66 @Override 67 public int delete(@NonNull Uri uri, 68 @Nullable String selection, 69 @Nullable String[] selectionArgs) { 70 return 0; 71 } 72 73 @Override 74 public int update(@NonNull Uri uri, 75 @Nullable ContentValues values, 76 @Nullable String selection, 77 @Nullable String[] selectionArgs) { 78 return 0; 79 } 80 } 81