static final String TAG = "AdvancedAppSettings";
+ private static final String KEY_ASSIST_VOICE_INPUT = "assist_and_voice_input";
+
@Override
protected String getLogTag() {
return TAG;
sir.xmlResId = R.xml.app_default_settings;
return Arrays.asList(sir);
}
+
+ @Override
+ public List<String> getNonIndexableKeys(Context context) {
+ List<String> keys = super.getNonIndexableKeys(context);
+ keys.add(KEY_ASSIST_VOICE_INPUT);
+ // TODO (b/38230148) Remove these keys when we can differentiate work results
+ keys.add((new DefaultWorkPhonePreferenceController(context))
+ .getPreferenceKey());
+ keys.add((new DefaultWorkBrowserPreferenceController(context))
+ .getPreferenceKey());
+ return keys;
+ }
};
static class SummaryProvider implements SummaryLoader.SummaryProvider {
import com.android.settings.applications.defaultapps.DefaultPhonePreferenceController;
import com.android.settings.applications.defaultapps.DefaultSmsPreferenceController;
import com.android.settings.dashboard.SummaryLoader;
+import com.android.settings.testutils.XmlTestUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
+import java.util.List;
+
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
}
+
+ @Test
+ public void testNonIndexableKeys_existInXmlLayout() {
+ final Context context = spy(RuntimeEnvironment.application);
+ final List<String> niks = AdvancedAppSettings.SEARCH_INDEX_DATA_PROVIDER
+ .getNonIndexableKeys(context);
+ final int xmlId = (new AdvancedAppSettings()).getPreferenceScreenResId();
+
+ final List<String> keys = XmlTestUtils.getKeysFromPreferenceXml(context, xmlId);
+
+ assertThat(keys).containsAllIn(niks);
+ }
}