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.settings.backup; 18 19 import android.content.Context; 20 import android.os.Bundle; 21 22 import com.android.internal.logging.nano.MetricsProto.MetricsEvent; 23 import com.android.settings.R; 24 import com.android.settings.core.PreferenceController; 25 import com.android.settings.dashboard.DashboardFragment; 26 import com.android.settings.search.BaseSearchIndexProvider; 27 import com.android.settings.search.Indexable; 28 29 import java.util.ArrayList; 30 import java.util.List; 31 32 /** 33 * Fragment showing the items to launch different backup settings screens. 34 */ 35 public class BackupSettingsFragment extends DashboardFragment { 36 private static final String TAG = "BackupSettings"; 37 38 @Override onCreate(Bundle savedInstanceState)39 public void onCreate(Bundle savedInstanceState) { 40 super.onCreate(savedInstanceState); 41 } 42 43 /** 44 * Get the tag string for logging. 45 */ 46 @Override getLogTag()47 protected String getLogTag() { 48 return TAG; 49 } 50 51 /** 52 * Get the res id for static preference xml for this fragment. 53 */ 54 @Override getPreferenceScreenResId()55 protected int getPreferenceScreenResId() { 56 return R.xml.backup_settings; 57 } 58 59 /** 60 * Get a list of {@link PreferenceController} for this fragment. 61 */ 62 @Override getPreferenceControllers(Context context)63 protected List<PreferenceController> getPreferenceControllers(Context context) { 64 final List<PreferenceController> controllers = new ArrayList<>(); 65 controllers.add(new BackupSettingsPreferenceController(context)); 66 return controllers; 67 } 68 69 // The intention is to index {@link BackupSettingsActivity} instead of the fragments, 70 // therefore leaving this index provider empty. 71 public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = 72 new BaseSearchIndexProvider() { 73 }; 74 75 @Override getMetricsCategory()76 public int getMetricsCategory() { 77 return MetricsEvent.BACKUP_SETTINGS; 78 } 79 } 80