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.settings.backup; 18 19 import android.content.ContentProvider; 20 import android.content.ContentValues; 21 import android.content.UriMatcher; 22 import android.database.Cursor; 23 import android.net.Uri; 24 import android.os.Bundle; 25 26 import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY; 27 28 /** Provider stores and manages user interaction feedback for homepage contextual cards. */ 29 public class BackupSettingsContentProvider extends ContentProvider { 30 private static final String AUTHORITY = 31 "com.android.settings.backup.BackupSettingsContentProvider"; 32 private static final String SUMMARY = "summary"; 33 private static final UriMatcher URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH); 34 static { URI_MATCHER.addURI(AUTHORITY, SUMMARY, 1)35 URI_MATCHER.addURI(AUTHORITY, SUMMARY, 1); 36 } 37 38 @Override call(String method, String uri, Bundle extras)39 public Bundle call(String method, String uri, Bundle extras) { 40 if (!SUMMARY.equals(method)) { 41 return null; 42 } 43 Bundle bundle = new Bundle(); 44 bundle.putString(META_DATA_PREFERENCE_SUMMARY, 45 new BackupSettingsHelper(getContext()).getSummary()); 46 return bundle; 47 } 48 49 @Override onCreate()50 public boolean onCreate() { 51 return true; 52 } 53 54 @Override query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)55 public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { 56 throw new UnsupportedOperationException(); 57 } 58 59 @Override getType(Uri uri)60 public String getType(Uri uri) { 61 throw new UnsupportedOperationException(); 62 } 63 64 @Override insert(Uri uri, ContentValues values)65 public Uri insert(Uri uri, ContentValues values) { 66 throw new UnsupportedOperationException(); 67 } 68 69 @Override delete(Uri uri, String selection, String[] selectionArgs)70 public int delete(Uri uri, String selection, String[] selectionArgs) { 71 throw new UnsupportedOperationException(); 72 } 73 74 @Override update(Uri uri, ContentValues values, String selection, String[] selectionArgs)75 public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { 76 throw new UnsupportedOperationException(); 77 } 78 } 79