Remove Legal Information duplicate from Settings search
Bug: 33701673 Test: make RunSettingsRoboTests Change-Id: Icee65b7a683ad80cd587e22a575b4abc4b009d8f
This commit is contained in:
@@ -15,7 +15,8 @@
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/legal_information">
|
||||
android:title="@string/legal_information"
|
||||
android:key="legal_screen">
|
||||
|
||||
<!-- Note: The titles given here probably won't be used. Instead, we programmatically
|
||||
fill the title with the label of the activity with the corresponding action.
|
||||
|
@@ -51,6 +51,8 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
|
||||
|
||||
private static final String LOG_TAG = "DeviceInfoSettings";
|
||||
|
||||
private static final String KEY_LEGAL_CONTAINER = "legal_container";
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.DEVICEINFO;
|
||||
@@ -151,5 +153,12 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
|
||||
return buildPreferenceControllers(context, null /*activity */,
|
||||
null /* fragment */, null /* lifecycle */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
keys.add(KEY_LEGAL_CONTAINER);
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -28,6 +28,8 @@ import android.os.UserManager;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.dashboard.SummaryLoader;
|
||||
import com.android.settings.testutils.XmlTestUtils;
|
||||
import com.android.settings.testutils.shadow.ShadowUtils;
|
||||
import com.android.settingslib.DeviceInfoUtils;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -36,8 +38,11 @@ import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public class DeviceInfoSettingsTest {
|
||||
@@ -75,4 +80,17 @@ public class DeviceInfoSettingsTest {
|
||||
|
||||
verify(mSummaryLoader).setSummary(mProvider, Build.MODEL + DeviceInfoUtils.getMsvSuffix());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = ShadowUtils.class)
|
||||
public void testNonIndexableKeys_existInXmlLayout() {
|
||||
final Context context = RuntimeEnvironment.application;
|
||||
final List<String> niks = DeviceInfoSettings.SEARCH_INDEX_DATA_PROVIDER
|
||||
.getNonIndexableKeys(context);
|
||||
final int xmlId = (new DeviceInfoSettings()).getPreferenceScreenResId();
|
||||
|
||||
final List<String> keys = XmlTestUtils.getKeysFromPreferenceXml(context, xmlId);
|
||||
|
||||
assertThat(keys).containsAllIn(niks);
|
||||
}
|
||||
}
|
||||
|
@@ -46,4 +46,9 @@ public class ShadowUtils {
|
||||
public static void reset() {
|
||||
sFingerprintManager = null;
|
||||
}
|
||||
|
||||
@Implementation
|
||||
public static boolean isWifiOnly(Context context) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user