Add searchable index for Bluetooth and Nfc only if the feature exists
Test: make RunSettingsRoboTests Bug: 35657961 Change-Id: Ie2f4722b2b1599981c933f87f95016909ba92022 Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.android.settings.connecteddevice;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
@@ -85,5 +86,20 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
sir.xmlResId = R.xml.connected_devices;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
final List<String> keys = new ArrayList<String>();
|
||||
|
||||
if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC)) {
|
||||
keys.add(NfcPreferenceController.KEY_TOGGLE_NFC);
|
||||
keys.add(NfcPreferenceController.KEY_ANDROID_BEAM_SETTINGS);
|
||||
}
|
||||
if (!pm.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) {
|
||||
keys.add(BluetoothMasterSwitchPreferenceController.KEY_TOGGLE_BLUETOOTH);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user