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.display; 18 19 import android.app.settings.SettingsEnums; 20 import android.content.Context; 21 import android.os.Bundle; 22 import android.provider.SearchIndexableResource; 23 24 import com.android.settings.R; 25 import com.android.settings.dashboard.DashboardFragment; 26 import com.android.settings.search.BaseSearchIndexProvider; 27 import com.android.settingslib.search.SearchIndexable; 28 import com.android.settingslib.widget.FooterPreference; 29 30 import java.util.Arrays; 31 import java.util.List; 32 33 @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC) 34 public class AdaptiveSleepSettings extends DashboardFragment { 35 36 private static final String TAG = "AdaptiveSleepSettings"; 37 38 @Override onCreate(Bundle icicle)39 public void onCreate(Bundle icicle) { 40 super.onCreate(icicle); 41 final FooterPreference footerPreference = 42 mFooterPreferenceMixin.createFooterPreference(); 43 footerPreference.setIcon(R.drawable.ic_privacy_shield_24dp); 44 footerPreference.setTitle(R.string.adaptive_sleep_privacy); 45 } 46 47 @Override getPreferenceScreenResId()48 protected int getPreferenceScreenResId() { 49 return R.xml.adaptive_sleep_detail; 50 } 51 52 @Override getLogTag()53 protected String getLogTag() { 54 return TAG; 55 } 56 57 @Override getMetricsCategory()58 public int getMetricsCategory() { 59 return SettingsEnums.SETTINGS_ADAPTIVE_SLEEP; 60 } 61 62 @Override getHelpResource()63 public int getHelpResource() { 64 return R.string.help_url_adaptive_sleep; 65 } 66 67 public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = 68 new BaseSearchIndexProvider() { 69 @Override 70 public List<SearchIndexableResource> getXmlResourcesToIndex( 71 Context context, boolean enabled) { 72 final SearchIndexableResource sir = new SearchIndexableResource(context); 73 sir.xmlResId = R.xml.adaptive_sleep_detail; 74 return Arrays.asList(sir); 75 } 76 }; 77 } 78