1 /* 2 * Copyright (C) 2021 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.gestures; 18 19 import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON_OVERLAY; 20 import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY; 21 22 import android.app.settings.SettingsEnums; 23 import android.content.Context; 24 25 import com.android.settings.R; 26 import com.android.settings.dashboard.DashboardFragment; 27 import com.android.settings.search.BaseSearchIndexProvider; 28 import com.android.settingslib.search.SearchIndexable; 29 30 /** 31 * A fragment that includes settings for 2- and 3-button navigation modes. 32 */ 33 @SearchIndexable(forTarget = SearchIndexable.MOBILE) 34 public class ButtonNavigationSettingsFragment extends DashboardFragment { 35 36 private static final String TAG = "ButtonNavigationSettingsFragment"; 37 38 public static final String BUTTON_NAVIGATION_SETTINGS = 39 "com.android.settings.BUTTON_NAVIGATION_SETTINGS"; 40 41 42 @Override getMetricsCategory()43 public int getMetricsCategory() { 44 return SettingsEnums.SETTINGS_BUTTON_NAV_DLG; 45 } 46 47 @Override getPreferenceScreenResId()48 protected int getPreferenceScreenResId() { 49 return R.xml.button_navigation_settings; 50 } 51 52 @Override getLogTag()53 protected String getLogTag() { 54 return TAG; 55 } 56 57 public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = 58 new BaseSearchIndexProvider(R.xml.button_navigation_settings) { 59 60 @Override 61 protected boolean isPageSearchEnabled(Context context) { 62 return SystemNavigationPreferenceController.isOverlayPackageAvailable(context, 63 NAV_BAR_MODE_2BUTTON_OVERLAY) 64 || SystemNavigationPreferenceController.isOverlayPackageAvailable( 65 context, 66 NAV_BAR_MODE_3BUTTON_OVERLAY); 67 } 68 }; 69 } 70