Merge "Remove Legal Information duplicate from Settings search" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
915f0cea5b
@@ -15,7 +15,8 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<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
|
<!-- 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.
|
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 LOG_TAG = "DeviceInfoSettings";
|
||||||
|
|
||||||
|
private static final String KEY_LEGAL_CONTAINER = "legal_container";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return MetricsEvent.DEVICEINFO;
|
return MetricsEvent.DEVICEINFO;
|
||||||
@@ -151,5 +153,12 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
|
|||||||
return buildPreferenceControllers(context, null /*activity */,
|
return buildPreferenceControllers(context, null /*activity */,
|
||||||
null /* fragment */, null /* lifecycle */);
|
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 android.support.v7.preference.PreferenceScreen;
|
||||||
|
|
||||||
import com.android.settings.dashboard.SummaryLoader;
|
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 com.android.settingslib.DeviceInfoUtils;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -36,8 +38,11 @@ import org.junit.runner.RunWith;
|
|||||||
import org.mockito.Answers;
|
import org.mockito.Answers;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
import org.robolectric.RuntimeEnvironment;
|
||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RunWith(SettingsRobolectricTestRunner.class)
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||||
public class DeviceInfoSettingsTest {
|
public class DeviceInfoSettingsTest {
|
||||||
@@ -75,4 +80,17 @@ public class DeviceInfoSettingsTest {
|
|||||||
|
|
||||||
verify(mSummaryLoader).setSummary(mProvider, Build.MODEL + DeviceInfoUtils.getMsvSuffix());
|
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() {
|
public static void reset() {
|
||||||
sFingerprintManager = null;
|
sFingerprintManager = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Implementation
|
||||||
|
public static boolean isWifiOnly(Context context) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user