Use searchable="false" to suppress nonIndexables.
When possible, remove or simplify getNonIndexable() logic in fragments, and use searchable="false" in xml to suppress index. Change-Id: I5bdf5bc7d5494a64cdd9e230a51321a4b210af69 Fixes: 112608186 Test: robotest and manual search
This commit is contained in:
@@ -13,10 +13,12 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="magnification_preference_screen_title"
|
||||
android:title="@string/accessibility_screen_magnification_title">
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="magnification_preference_screen_title"
|
||||
android:title="@string/accessibility_screen_magnification_title"
|
||||
settings:searchable="false">
|
||||
<Preference
|
||||
android:fragment="com.android.settings.accessibility.ToggleScreenMagnificationPreferenceFragment"
|
||||
android:key="screen_magnification_gestures_preference_screen"
|
||||
|
@@ -38,7 +38,8 @@
|
||||
<Preference
|
||||
android:key="tts_settings_preference"
|
||||
android:fragment="com.android.settings.tts.TextToSpeechSettings"
|
||||
android:title="@string/tts_settings_title"/>
|
||||
android:title="@string/tts_settings_title"
|
||||
settings:searchable="false"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
@@ -48,12 +49,14 @@
|
||||
<Preference
|
||||
android:fragment="com.android.settings.accessibility.ToggleFontSizePreferenceFragment"
|
||||
android:key="font_size_preference_screen"
|
||||
android:title="@string/title_font_size" />
|
||||
android:title="@string/title_font_size"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<com.android.settings.display.ScreenZoomPreference
|
||||
android:key="accessibility_settings_screen_zoom"
|
||||
android:fragment="com.android.settings.display.ScreenZoomSettings"
|
||||
android:title="@string/screen_zoom_title" />
|
||||
android:title="@string/screen_zoom_title"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<Preference
|
||||
android:fragment="com.android.settings.accessibility.MagnificationPreferenceFragment"
|
||||
@@ -77,7 +80,8 @@
|
||||
<Preference
|
||||
android:fragment="com.android.settings.accessibility.ToggleAutoclickPreferenceFragment"
|
||||
android:key="autoclick_preference"
|
||||
android:title="@string/accessibility_autoclick_preference_title"/>
|
||||
android:title="@string/accessibility_autoclick_preference_title"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="toggle_power_button_ends_call_preference"
|
||||
@@ -136,7 +140,8 @@
|
||||
android:fragment="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment"
|
||||
android:key="daltonizer_preference"
|
||||
android:title="@string/accessibility_display_daltonizer_preference_title"
|
||||
android:icon="@drawable/ic_daltonizer"/>
|
||||
android:icon="@drawable/ic_daltonizer"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="toggle_inversion_preference"
|
||||
|
@@ -23,7 +23,8 @@
|
||||
<com.android.settings.RestrictedListPreference
|
||||
android:key="lock_screen_notifications"
|
||||
android:title="@string/lock_screen_notifications_title"
|
||||
android:summary="@string/summary_placeholder"/>
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<!-- Notification badging -->
|
||||
<SwitchPreference
|
||||
@@ -35,7 +36,7 @@
|
||||
<SwitchPreference
|
||||
android:key="notification_pulse"
|
||||
android:title="@string/notification_pulse_title"
|
||||
settings:controller="com.android.settings.notification.PulseNotificationPreferenceController" />
|
||||
settings:controller="com.android.settings.notification.PulseNotificationPreferenceController"/>
|
||||
|
||||
<!-- Default notification ringtone -->
|
||||
<com.android.settings.DefaultRingtonePreference
|
||||
@@ -43,13 +44,13 @@
|
||||
android:title="@string/notification_ringtone_title"
|
||||
android:dialogTitle="@string/notification_ringtone_title"
|
||||
android:summary="@string/summary_placeholder"
|
||||
android:ringtoneType="notification" />
|
||||
android:ringtoneType="notification"/>
|
||||
|
||||
<Preference
|
||||
android:key="gesture_swipe_down_fingerprint_notifications"
|
||||
android:title="@string/fingerprint_swipe_for_notifications_title"
|
||||
android:fragment="com.android.settings.gestures.SwipeToNotificationSettings"
|
||||
settings:controller="com.android.settings.gestures.SwipeToNotificationPreferenceController" />
|
||||
settings:controller="com.android.settings.gestures.SwipeToNotificationPreferenceController"/>
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="zen_mode_notifications"
|
||||
@@ -57,7 +58,7 @@
|
||||
settings:useAdminDisabledSummary="true"
|
||||
android:fragment="com.android.settings.notification.ZenModeSettings"
|
||||
settings:controller="com.android.settings.notification.ZenModePreferenceController"
|
||||
settings:allowDividerAbove="false" />
|
||||
settings:allowDividerAbove="false"/>
|
||||
|
||||
<!-- Empty category to draw divider -->
|
||||
<PreferenceCategory
|
||||
@@ -79,7 +80,7 @@
|
||||
android:order="22">
|
||||
<extra
|
||||
android:name="classname"
|
||||
android:value="com.android.settings.Settings$NotificationAppListActivity" />
|
||||
android:value="com.android.settings.Settings$NotificationAppListActivity"/>
|
||||
</Preference>
|
||||
</PreferenceCategory>
|
||||
|
||||
@@ -88,13 +89,15 @@
|
||||
<PreferenceCategory
|
||||
android:key="lock_screen_notifications_profile_header"
|
||||
android:title="@string/profile_section_header"
|
||||
android:order="23">
|
||||
android:order="23"
|
||||
settings:searchable="false">
|
||||
|
||||
<com.android.settings.RestrictedListPreference
|
||||
android:key="lock_screen_notifications_profile"
|
||||
android:title="@string/locked_work_profile_notification_title"
|
||||
android:summary="@string/summary_placeholder"
|
||||
android:order="24"/>
|
||||
android:order="24"
|
||||
settings:searchable="false"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
@@ -25,7 +25,8 @@
|
||||
android:key="bluetooth_settings"
|
||||
android:title="@string/bluetooth_settings_title"
|
||||
android:icon="@drawable/ic_settings_bluetooth"
|
||||
android:order="-9"/>
|
||||
android:order="-9"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="toggle_nfc"
|
||||
@@ -57,7 +58,8 @@
|
||||
android:summary="@string/summary_placeholder"
|
||||
android:icon="@drawable/ic_settings_print"
|
||||
android:fragment="com.android.settings.print.PrintSettingsFragment"
|
||||
android:order="-3"/>
|
||||
android:order="-3"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<Preference
|
||||
android:key="bt_received_files"
|
||||
|
@@ -37,20 +37,22 @@
|
||||
android:fragment="com.android.settings.display.NightDisplaySettings"
|
||||
android:widgetLayout="@null"
|
||||
settings:widgetLayout="@null"
|
||||
settings:keywords="@string/keywords_display_night_display" />
|
||||
settings:searchable="false" />
|
||||
|
||||
<Preference
|
||||
android:key="auto_brightness_entry"
|
||||
android:title="@string/auto_brightness_title"
|
||||
android:summary="@string/summary_placeholder"
|
||||
android:fragment="com.android.settings.display.AutoBrightnessSettings"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.display.AutoBrightnessPreferenceController" />
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="wallpaper"
|
||||
android:title="@string/wallpaper_settings_title"
|
||||
settings:keywords="@string/keywords_display_wallpaper"
|
||||
settings:useAdminDisabledSummary="true">
|
||||
settings:useAdminDisabledSummary="true"
|
||||
settings:searchable="false">
|
||||
<intent
|
||||
android:targetPackage="@string/config_wallpaper_picker_package"
|
||||
android:targetClass="@string/config_wallpaper_picker_class" />
|
||||
@@ -88,7 +90,7 @@
|
||||
android:key="display_settings_screen_zoom"
|
||||
android:title="@string/screen_zoom_title"
|
||||
android:fragment="com.android.settings.display.ScreenZoomSettings"
|
||||
settings:keywords="@string/screen_zoom_keywords" />
|
||||
settings:searchable="false"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="show_operator_name"
|
||||
@@ -99,7 +101,7 @@
|
||||
android:key="screensaver"
|
||||
android:title="@string/screensaver_settings_title"
|
||||
android:fragment="com.android.settings.dream.DreamSettings"
|
||||
settings:controller="com.android.settings.dream.DreamEntryPreferenceController" />
|
||||
settings:searchable="false" />
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="lockscreen_from_display_settings"
|
||||
|
@@ -39,7 +39,8 @@
|
||||
android:key="physical_keyboard_pref"
|
||||
android:title="@string/physical_keyboard_title"
|
||||
android:summary="@string/summary_placeholder"
|
||||
android:fragment="com.android.settings.inputmethod.PhysicalKeyboardFragment" />
|
||||
android:fragment="com.android.settings.inputmethod.PhysicalKeyboardFragment"
|
||||
settings:searchable="false"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
@@ -80,7 +81,8 @@
|
||||
<Preference
|
||||
android:key="tts_settings_summary"
|
||||
android:title="@string/tts_settings_title"
|
||||
android:fragment="com.android.settings.tts.TextToSpeechSettings" />
|
||||
android:fragment="com.android.settings.tts.TextToSpeechSettings"
|
||||
settings:searchable="false"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
@@ -29,7 +29,8 @@
|
||||
android:title="@string/location_recent_location_requests_see_all"
|
||||
android:icon="@drawable/ic_chevron_right_24dp"
|
||||
android:selectable="true"
|
||||
android:fragment="com.android.settings.location.RecentLocationRequestSeeAllFragment"/>
|
||||
android:fragment="com.android.settings.location.RecentLocationRequestSeeAllFragment"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="location_advanced_settings"
|
||||
|
@@ -61,7 +61,8 @@
|
||||
android:order="5"
|
||||
android:title="@string/legal_information"
|
||||
android:fragment="com.android.settings.LegalSettings"
|
||||
settings:allowDividerAbove="true"/>
|
||||
settings:allowDividerAbove="true"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<!-- Regulatory labels -->
|
||||
<Preference
|
||||
|
@@ -17,8 +17,10 @@
|
||||
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="security_settings_password_sub_screen"
|
||||
android:title="@string/unlock_set_unlock_launch_picker_title">
|
||||
android:title="@string/unlock_set_unlock_launch_picker_title"
|
||||
settings:searchable="false">
|
||||
|
||||
<!-- available in pattern -->
|
||||
<SwitchPreference
|
||||
|
@@ -83,12 +83,14 @@
|
||||
<PreferenceCategory
|
||||
android:key="security_setting_lock_screen_notif_work_header"
|
||||
android:title="@string/profile_section_header"
|
||||
android:order="1001">
|
||||
android:order="1001"
|
||||
settings:searchable="false">
|
||||
|
||||
<com.android.settings.RestrictedListPreference
|
||||
android:key="security_setting_lock_screen_notif_work"
|
||||
android:title="@string/locked_work_profile_notification_title"
|
||||
android:summary="@string/summary_placeholder" />
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:searchable="false"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="tts_settings_screen"
|
||||
android:title="@string/tts_settings_title">
|
||||
|
||||
@@ -24,7 +25,8 @@
|
||||
<com.android.settings.widget.GearPreference
|
||||
android:key="tts_engine_preference"
|
||||
android:title="@string/tts_engine_preference_title"
|
||||
android:fragment="com.android.settings.tts.TtsEnginePreferenceFragment"/>
|
||||
android:fragment="com.android.settings.tts.TtsEnginePreferenceFragment"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<ListPreference
|
||||
android:key="tts_default_lang"
|
||||
|
@@ -15,11 +15,13 @@
|
||||
-->
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="virtual_keyboard_category"
|
||||
android:title="@string/virtual_keyboard_category">
|
||||
<!-- Enabled input method list will be populated programmatically here. -->
|
||||
<Preference
|
||||
android:key="add_virtual_keyboard_screen"
|
||||
android:title="@string/add_virtual_keyboard"
|
||||
android:fragment="com.android.settings.inputmethod.AvailableVirtualKeyboardFragment" />
|
||||
android:fragment="com.android.settings.inputmethod.AvailableVirtualKeyboardFragment"
|
||||
settings:searchable="false"/>
|
||||
</PreferenceScreen>
|
||||
|
@@ -20,31 +20,32 @@
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="wifi_tether_settings_screen"
|
||||
android:title="@string/wifi_hotspot_checkbox_text"
|
||||
settings:searchable="false"
|
||||
settings:initialExpandedChildrenCount="3">
|
||||
|
||||
<com.android.settings.widget.ValidatedEditTextPreference
|
||||
android:key="wifi_tether_network_name"
|
||||
android:title="@string/wifi_hotspot_name_title"
|
||||
android:summary="@string/summary_placeholder" />
|
||||
android:summary="@string/summary_placeholder"/>
|
||||
|
||||
<ListPreference
|
||||
android:key="wifi_tether_security"
|
||||
android:title="@string/wifi_security"
|
||||
android:summary="@string/summary_placeholder"
|
||||
android:entries="@array/wifi_tether_security"
|
||||
android:entryValues="@array/wifi_tether_security_values" />
|
||||
android:entryValues="@array/wifi_tether_security_values"/>
|
||||
|
||||
<com.android.settings.widget.ValidatedEditTextPreference
|
||||
android:key="wifi_tether_network_password"
|
||||
android:persistent="false"
|
||||
android:title="@string/wifi_hotspot_password_title" />
|
||||
android:title="@string/wifi_hotspot_password_title"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="wifi_tether_auto_turn_off"
|
||||
android:title="@string/wifi_hotspot_auto_off_title"
|
||||
android:summary="@string/wifi_hotspot_auto_off_summary" />
|
||||
android:summary="@string/wifi_hotspot_auto_off_summary"/>
|
||||
|
||||
<ListPreference
|
||||
android:key="wifi_tether_network_ap_band"
|
||||
android:title="@string/wifi_hotspot_ap_band_title" />
|
||||
android:title="@string/wifi_hotspot_ap_band_title"/>
|
||||
</PreferenceScreen>
|
||||
|
@@ -46,11 +46,7 @@ import java.util.List;
|
||||
public class DisplaySettings extends DashboardFragment {
|
||||
private static final String TAG = "DisplaySettings";
|
||||
|
||||
public static final String KEY_DISPLAY_SIZE = "display_settings_screen_zoom";
|
||||
|
||||
private static final String KEY_SCREEN_TIMEOUT = "screen_timeout";
|
||||
private static final String KEY_AUTO_BRIGHTNESS = "auto_brightness_entry";
|
||||
private static final String KEY_NIGHT_DISPLAY = "night_display";
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
@@ -108,16 +104,6 @@ public class DisplaySettings extends DashboardFragment {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
keys.add(KEY_DISPLAY_SIZE);
|
||||
keys.add(WallpaperPreferenceController.KEY_WALLPAPER);
|
||||
keys.add(KEY_NIGHT_DISPLAY);
|
||||
keys.add(KEY_AUTO_BRIGHTNESS);
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
||||
Context context) {
|
||||
|
@@ -118,8 +118,6 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
||||
"magnification_preference_screen";
|
||||
private static final String FONT_SIZE_PREFERENCE_SCREEN =
|
||||
"font_size_preference_screen";
|
||||
private static final String TTS_SETTINGS_PREFERENCE =
|
||||
"tts_settings_preference";
|
||||
private static final String AUTOCLICK_PREFERENCE_SCREEN =
|
||||
"autoclick_preference";
|
||||
private static final String VIBRATION_PREFERENCE_SCREEN =
|
||||
@@ -887,8 +885,6 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
|
||||
public static final String KEY_DISPLAY_SIZE = "accessibility_settings_screen_zoom";
|
||||
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
|
||||
boolean enabled) {
|
||||
@@ -898,21 +894,5 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
|
||||
indexables.add(indexable);
|
||||
return indexables;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
// Duplicates in Display
|
||||
keys.add(FONT_SIZE_PREFERENCE_SCREEN);
|
||||
keys.add(KEY_DISPLAY_SIZE);
|
||||
|
||||
// Duplicates in Language & Input
|
||||
keys.add(TTS_SETTINGS_PREFERENCE);
|
||||
|
||||
// Duplicates in child page
|
||||
keys.add(DISPLAY_DALTONIZER_PREFERENCE_SCREEN);
|
||||
keys.add(AUTOCLICK_PREFERENCE_SCREEN);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -27,6 +27,9 @@ import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
@@ -39,9 +42,6 @@ import com.android.settingslib.search.SearchIndexable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
@SearchIndexable
|
||||
public final class MagnificationPreferenceFragment extends DashboardFragment {
|
||||
@VisibleForTesting
|
||||
@@ -172,12 +172,5 @@ public final class MagnificationPreferenceFragment extends DashboardFragment {
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return isApplicable(context.getResources());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
keys.add(PREFERENCE_TITLE_KEY);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -26,13 +26,12 @@ import com.android.settings.core.BasePreferenceController;
|
||||
public class BackupSettingsActivityPreferenceController extends BasePreferenceController {
|
||||
private static final String TAG = "BackupSettingActivityPC";
|
||||
|
||||
private static final String KEY_BACKUP_SETTINGS = "backup_settings";
|
||||
|
||||
private final UserManager mUm;
|
||||
private final BackupManager mBackupManager;
|
||||
|
||||
public BackupSettingsActivityPreferenceController(Context context) {
|
||||
super(context, KEY_BACKUP_SETTINGS);
|
||||
public BackupSettingsActivityPreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
mUm = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||
mBackupManager = new BackupManager(context);
|
||||
}
|
||||
|
@@ -108,9 +108,6 @@ public class AdvancedConnectedDeviceDashboardFragment extends DashboardFragment
|
||||
keys.add(AndroidBeamPreferenceController.KEY_ANDROID_BEAM_SETTINGS);
|
||||
}
|
||||
|
||||
// Parent duplicate
|
||||
keys.add(KEY_BLUETOOTH);
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
@@ -95,7 +95,7 @@ public class AvailableMediaDeviceGroupController extends BasePreferenceControlle
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)
|
||||
? AVAILABLE
|
||||
? AVAILABLE_UNSEARCHABLE
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
|
@@ -19,6 +19,8 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
@@ -32,8 +34,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
|
||||
public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
|
||||
@@ -139,14 +139,5 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
context) {
|
||||
return buildPreferenceControllers(context, null /* lifecycle */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
// Disable because they show dynamic data
|
||||
keys.add(KEY_AVAILABLE_DEVICES);
|
||||
keys.add(KEY_CONNECTED_DEVICES);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -89,7 +89,7 @@ public class ConnectedDeviceGroupController extends BasePreferenceController
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)
|
||||
? AVAILABLE
|
||||
? AVAILABLE_UNSEARCHABLE
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
|
@@ -113,11 +113,6 @@ public class UsbDetailsFragment extends DashboardFragment {
|
||||
return Lists.newArrayList(res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
return super.getNonIndexableKeys(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
||||
Context context) {
|
||||
|
@@ -65,7 +65,6 @@ public class MyDeviceInfoFragment extends DashboardFragment
|
||||
|
||||
private static final String LOG_TAG = "MyDeviceInfoFragment";
|
||||
private static final String KEY_MY_DEVICE_INFO_HEADER = "my_device_info_header";
|
||||
private static final String KEY_LEGAL_CONTAINER = "legal_container";
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
@@ -223,13 +222,5 @@ public class MyDeviceInfoFragment extends DashboardFragment
|
||||
return buildPreferenceControllers(context, null /*activity */,
|
||||
null /* fragment */, null /* lifecycle */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
// The legal container is duplicated, so we ignore it here.
|
||||
keys.add(KEY_LEGAL_CONTAINER);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ public class AutoBrightnessPreferenceController extends TogglePreferenceControll
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_automatic_brightness_available)
|
||||
? AVAILABLE
|
||||
? AVAILABLE_UNSEARCHABLE
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.dream;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
|
||||
public class DreamEntryPreferenceController extends BasePreferenceController {
|
||||
|
||||
public DreamEntryPreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE_UNSEARCHABLE;
|
||||
}
|
||||
}
|
@@ -49,7 +49,7 @@ public class BatterySaverController extends BasePreferenceController
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE;
|
||||
return AVAILABLE_UNSEARCHABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -68,7 +68,6 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
private static final String KEY_BATTERY_HEADER = "battery_header";
|
||||
private static final String KEY_BATTERY_TIP = "battery_tip";
|
||||
|
||||
private static final String KEY_SCREEN_USAGE = "screen_usage";
|
||||
private static final String KEY_TIME_SINCE_LAST_FULL_CHARGE = "last_full_charge";
|
||||
@@ -429,13 +428,6 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
|
||||
sir.xmlResId = R.xml.power_usage_summary;
|
||||
return Collections.singletonList(sir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> niks = super.getNonIndexableKeys(context);
|
||||
niks.add(KEY_BATTERY_SAVER_SUMMARY);
|
||||
return niks;
|
||||
}
|
||||
};
|
||||
|
||||
public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY
|
||||
|
@@ -22,13 +22,13 @@ import static android.provider.Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENA
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
|
||||
public class AssistGestureSettingsPreferenceController extends GesturePreferenceController {
|
||||
|
||||
private static final String PREF_KEY_VIDEO = "gesture_assist_video";
|
||||
@@ -38,7 +38,6 @@ public class AssistGestureSettingsPreferenceController extends GesturePreference
|
||||
private static final int ON = 1;
|
||||
private static final int OFF = 0;
|
||||
|
||||
private final String mAssistGesturePrefKey;
|
||||
private final AssistGestureFeatureProvider mFeatureProvider;
|
||||
private boolean mWasAvailable;
|
||||
|
||||
@@ -48,12 +47,10 @@ public class AssistGestureSettingsPreferenceController extends GesturePreference
|
||||
@VisibleForTesting
|
||||
boolean mAssistOnly;
|
||||
|
||||
public AssistGestureSettingsPreferenceController(Context context,
|
||||
String key) {
|
||||
public AssistGestureSettingsPreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
mFeatureProvider = FeatureFactory.getFactory(context).getAssistGestureFeatureProvider();
|
||||
mWasAvailable = isAvailable();
|
||||
mAssistGesturePrefKey = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -27,6 +27,8 @@ import android.provider.SearchIndexableResource;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.settings.R;
|
||||
@@ -42,8 +44,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
@SearchIndexable
|
||||
public final class VirtualKeyboardFragment extends SettingsPreferenceFragment implements Indexable {
|
||||
|
||||
@@ -130,12 +130,5 @@ public final class VirtualKeyboardFragment extends SettingsPreferenceFragment im
|
||||
sir.xmlResId = R.xml.virtual_keyboard_settings;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
keys.add("add_virtual_keyboard_screen");
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -23,12 +23,13 @@ import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.SearchIndexableResource;
|
||||
import android.provider.Settings;
|
||||
import android.speech.tts.TtsEngines;
|
||||
import android.text.TextUtils;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
@@ -41,6 +42,7 @@ import com.android.settings.widget.PreferenceCategoryController;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -53,7 +55,6 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
||||
private static final String KEY_KEYBOARDS_CATEGORY = "keyboards_category";
|
||||
private static final String KEY_TEXT_TO_SPEECH = "tts_settings_summary";
|
||||
private static final String KEY_POINTER_AND_TTS_CATEGORY = "pointer_and_tts_category";
|
||||
private static final String KEY_PHYSICAL_KEYBOARD = "physical_keyboard_pref";
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
@@ -175,13 +176,5 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
||||
Context context) {
|
||||
return buildPreferenceControllers(context, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
// Duplicates in summary and details pages.
|
||||
keys.add(KEY_PHYSICAL_KEYBOARD);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -22,6 +22,9 @@ import android.location.SettingInjectorService;
|
||||
import android.os.Bundle;
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
@@ -41,9 +44,6 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
|
||||
/**
|
||||
* System location settings (Settings > Location). The screen has three parts:
|
||||
* <ul>
|
||||
@@ -180,12 +180,5 @@ public class LocationSettings extends DashboardFragment {
|
||||
return buildPreferenceControllers(context, null /* fragment */,
|
||||
null /* lifecycle */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> niks = super.getNonIndexableKeys(context);
|
||||
niks.add("recent_location_requests_see_all_button"); // 'See all' button
|
||||
return niks;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -218,9 +218,6 @@ public class ConfigureNotificationSettings extends DashboardFragment implements
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
keys.add(KEY_SWIPE_DOWN);
|
||||
keys.add(KEY_LOCKSCREEN);
|
||||
keys.add(KEY_LOCKSCREEN_WORK_PROFILE);
|
||||
keys.add(KEY_LOCKSCREEN_WORK_PROFILE_HEADER);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
|
@@ -108,12 +108,6 @@ public class ZenModeBlockedEffectsSettings extends ZenModeSettingsBase implement
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
return buildPreferenceControllers(context, null);
|
||||
|
@@ -82,14 +82,9 @@ public class ZenModeCallsSettings extends ZenModeSettingsBase implements Indexab
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
return keys;
|
||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
||||
Context context) {
|
||||
return buildPreferenceControllers(context, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
return buildPreferenceControllers(context, null);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -80,12 +80,6 @@ public class ZenModeMsgEventReminderSettings extends ZenModeSettingsBase impleme
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
return buildPreferenceControllers(context, null);
|
||||
|
@@ -90,12 +90,6 @@ public class ZenModeRestrictNotificationsSettings extends ZenModeSettingsBase im
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||
return buildPreferenceControllers(context, null);
|
||||
|
@@ -154,8 +154,6 @@ public class LockscreenDashboardFragment extends DashboardFragment
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> niks = super.getNonIndexableKeys(context);
|
||||
niks.add(KEY_ADD_USER_FROM_LOCK_SCREEN);
|
||||
niks.add(KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE);
|
||||
niks.add(KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE_HEADER);
|
||||
return niks;
|
||||
}
|
||||
|
||||
|
@@ -20,6 +20,8 @@ import android.content.Context;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settings.R;
|
||||
@@ -34,16 +36,12 @@ import com.android.settingslib.search.SearchIndexable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
@SearchIndexable
|
||||
public class ScreenLockSettings extends DashboardFragment
|
||||
implements OwnerInfoPreferenceController.OwnerInfoCallback {
|
||||
|
||||
private static final String TAG = "ScreenLockSettings";
|
||||
|
||||
private static final String KEY_LOCK_SCREEN_TITLE = "security_settings_password_sub_screen";
|
||||
|
||||
private static final int MY_USER_ID = UserHandle.myUserId();
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
|
||||
@@ -107,12 +105,5 @@ public class ScreenLockSettings extends DashboardFragment
|
||||
return buildPreferenceControllers(context, null /* parent */,
|
||||
null /* lifecycle */, new LockPatternUtils(context));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
keys.add(KEY_LOCK_SCREEN_TITLE);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ public class ResetPreferenceController extends BasePreferenceController {
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getResources().getBoolean(R.bool.config_show_reset_dashboard)
|
||||
? AVAILABLE
|
||||
? AVAILABLE_UNSEARCHABLE
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
}
|
||||
|
@@ -19,9 +19,12 @@ import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.backup.BackupSettingsActivityPreferenceController;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.search.Indexable;
|
||||
@@ -30,10 +33,6 @@ import com.android.settingslib.search.SearchIndexable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
@SearchIndexable
|
||||
public class SystemDashboardFragment extends DashboardFragment {
|
||||
|
||||
@@ -97,12 +96,5 @@ public class SystemDashboardFragment extends DashboardFragment {
|
||||
sir.xmlResId = R.xml.system_dashboard_fragment;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
keys.add(KEY_RESET);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
@@ -34,6 +34,10 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
@@ -56,10 +60,6 @@ import java.util.MissingResourceException;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
@SearchIndexable
|
||||
public class TextToSpeechSettings extends SettingsPreferenceFragment
|
||||
implements Preference.OnPreferenceChangeListener,
|
||||
@@ -790,13 +790,6 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
|
||||
sir.xmlResId = R.xml.tts_settings;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
keys.add("tts_engine_preference");
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.backup;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -25,6 +26,8 @@ import android.app.backup.BackupManager;
|
||||
import android.content.Context;
|
||||
import android.os.UserManager;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
|
||||
@@ -38,8 +41,6 @@ import org.robolectric.annotation.Config;
|
||||
import org.robolectric.annotation.Implementation;
|
||||
import org.robolectric.annotation.Implements;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(shadows = BackupSettingsActivityPreferenceControllerTest.ShadowBackupManager.class)
|
||||
public class BackupSettingsActivityPreferenceControllerTest {
|
||||
@@ -63,7 +64,7 @@ public class BackupSettingsActivityPreferenceControllerTest {
|
||||
mContext = spy(RuntimeEnvironment.application.getApplicationContext());
|
||||
when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
|
||||
|
||||
mController = new BackupSettingsActivityPreferenceController(mContext);
|
||||
mController = new BackupSettingsActivityPreferenceController(mContext, KEY_BACKUP_SETTINGS);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -15,9 +15,11 @@
|
||||
*/
|
||||
package com.android.settings.connecteddevice;
|
||||
|
||||
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
|
||||
import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
|
||||
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
@@ -29,6 +31,11 @@ import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.media.AudioManager;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.bluetooth.AvailableMediaBluetoothDeviceUpdater;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
@@ -48,11 +55,6 @@ import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(shadows = {
|
||||
ShadowAudioManager.class,
|
||||
@@ -177,7 +179,7 @@ public class AvailableMediaDeviceGroupControllerTest {
|
||||
doReturn(true).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
|
||||
|
||||
assertThat(mAvailableMediaDeviceGroupController.getAvailabilityStatus()).isEqualTo(
|
||||
AVAILABLE);
|
||||
AVAILABLE_UNSEARCHABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -15,9 +15,11 @@
|
||||
*/
|
||||
package com.android.settings.connecteddevice;
|
||||
|
||||
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
|
||||
import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
|
||||
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
@@ -27,6 +29,11 @@ import static org.mockito.Mockito.when;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.bluetooth.ConnectedBluetoothDeviceUpdater;
|
||||
import com.android.settings.connecteddevice.dock.DockUpdater;
|
||||
import com.android.settings.connecteddevice.usb.ConnectedUsbDeviceUpdater;
|
||||
@@ -44,11 +51,6 @@ import org.robolectric.Shadows;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowApplicationPackageManager;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceGroup;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(shadows = ShadowApplicationPackageManager.class)
|
||||
public class ConnectedDeviceGroupControllerTest {
|
||||
@@ -94,7 +96,7 @@ public class ConnectedDeviceGroupControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnDeviceAdded_firstAdd_becomeVisibleAndPreferenceAdded() {
|
||||
public void onDeviceAdded_firstAdd_becomeVisibleAndPreferenceAdded() {
|
||||
mConnectedDeviceGroupController.onDeviceAdded(mPreference);
|
||||
|
||||
assertThat(mPreferenceGroup.isVisible()).isTrue();
|
||||
@@ -102,7 +104,7 @@ public class ConnectedDeviceGroupControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnDeviceRemoved_lastRemove_becomeInvisibleAndPreferenceRemoved() {
|
||||
public void onDeviceRemoved_lastRemove_becomeInvisibleAndPreferenceRemoved() {
|
||||
mPreferenceGroup.addPreference(mPreference);
|
||||
|
||||
mConnectedDeviceGroupController.onDeviceRemoved(mPreference);
|
||||
@@ -112,7 +114,7 @@ public class ConnectedDeviceGroupControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnDeviceRemoved_notLastRemove_stillVisible() {
|
||||
public void onDeviceRemoved_notLastRemove_stillVisible() {
|
||||
mPreferenceGroup.setVisible(true);
|
||||
mPreferenceGroup.addPreference(mPreference);
|
||||
mPreferenceGroup.addPreference(new Preference(mContext));
|
||||
@@ -123,7 +125,7 @@ public class ConnectedDeviceGroupControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisplayPreference_becomeInvisible() {
|
||||
public void displayPreference_becomeInvisible() {
|
||||
doReturn(mPreferenceGroup).when(mPreferenceScreen).findPreference(anyString());
|
||||
|
||||
mConnectedDeviceGroupController.displayPreference(mPreferenceScreen);
|
||||
@@ -132,7 +134,7 @@ public class ConnectedDeviceGroupControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegister() {
|
||||
public void onStart_shouldRegisterUpdaters() {
|
||||
// register the callback in onStart()
|
||||
mConnectedDeviceGroupController.onStart();
|
||||
verify(mConnectedBluetoothDeviceUpdater).registerCallback();
|
||||
@@ -141,7 +143,7 @@ public class ConnectedDeviceGroupControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnregister() {
|
||||
public void onStop_shouldUnregisterUpdaters() {
|
||||
// unregister the callback in onStop()
|
||||
mConnectedDeviceGroupController.onStop();
|
||||
verify(mConnectedBluetoothDeviceUpdater).unregisterCallback();
|
||||
@@ -150,7 +152,7 @@ public class ConnectedDeviceGroupControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAvailabilityStatus_noBluetoothFeature_returnUnSupported() {
|
||||
public void getAvailabilityStatus_noBluetoothFeature_returnUnSupported() {
|
||||
mPackageManager.setSystemFeature(PackageManager.FEATURE_BLUETOOTH, false);
|
||||
|
||||
assertThat(mConnectedDeviceGroupController.getAvailabilityStatus()).isEqualTo(
|
||||
@@ -158,10 +160,10 @@ public class ConnectedDeviceGroupControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAvailabilityStatus_BluetoothFeature_returnSupported() {
|
||||
public void getAvailabilityStatus_BluetoothFeature_returnSupported() {
|
||||
mPackageManager.setSystemFeature(PackageManager.FEATURE_BLUETOOTH, true);
|
||||
|
||||
assertThat(mConnectedDeviceGroupController.getAvailabilityStatus()).isEqualTo(
|
||||
AVAILABLE);
|
||||
AVAILABLE_UNSEARCHABLE);
|
||||
}
|
||||
}
|
||||
|
@@ -263,9 +263,10 @@ public class PreferenceXmlParserUtilsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(qualifiers = "mcc998")
|
||||
public void extractMetadata_requestSearchable_shouldDefaultToTrue() throws Exception {
|
||||
final List<Bundle> metadata = PreferenceXmlParserUtils.extractMetadata(mContext,
|
||||
R.xml.display_settings, MetadataFlag.FLAG_NEED_SEARCHABLE);
|
||||
R.xml.location_settings, MetadataFlag.FLAG_NEED_SEARCHABLE);
|
||||
for (Bundle bundle : metadata) {
|
||||
assertThat(bundle.getBoolean(METADATA_SEARCHABLE)).isTrue();
|
||||
}
|
||||
|
Reference in New Issue
Block a user