Remove "Hotspot" key from settings search if not needed

- Remove "Hotspot" search key from TetherSettings

- Disable page search from WifiTetherSettings

Bug: 243876722
Test: manual test
make RunSettingsRoboTests ROBOTEST_FILTER=TetherSettingsTest
make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherSettingsTest

Change-Id: Ie04027600663321b35d8309c59084f630103e959
This commit is contained in:
Weng Su
2022-10-28 14:22:00 +08:00
parent f5a9766041
commit 105937d90f
4 changed files with 39 additions and 2 deletions

View File

@@ -20,6 +20,8 @@ import static android.content.Intent.ACTION_MEDIA_SHARED;
import static android.content.Intent.ACTION_MEDIA_UNSHARED;
import static android.hardware.usb.UsbManager.ACTION_USB_STATE;
import static com.android.settings.wifi.WifiUtils.setCanShowWifiHotspotCached;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
@@ -93,6 +95,7 @@ public class TetherSettingsTest {
any(String.class), anyInt(), any(UserHandle.class));
setupIsTetherAvailable(true);
setCanShowWifiHotspotCached(true);
when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(new String[0]);
when(mTetheringManager.getTetherableBluetoothRegexs()).thenReturn(new String[0]);
@@ -123,6 +126,16 @@ public class TetherSettingsTest {
assertThat(niks).contains(TetherSettings.KEY_WIFI_TETHER);
}
@Test
public void getNonIndexableKeys_canNotShowWifiHotspot_containsWifiTether() {
setCanShowWifiHotspotCached(false);
setupIsTetherAvailable(true);
List<String> keys = TetherSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
assertThat(keys).contains(TetherSettings.KEY_WIFI_TETHER);
}
@Test
public void testTetherNonIndexableKeys_usbNotAvailable_usbKeyReturned() {
when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(new String[0]);