Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f81f1024 authored by Matthew Fritze's avatar Matthew Fritze Committed by android-build-merger
Browse files

Merge "Remove Legal Information duplicate from Settings search" into oc-dev am: 915f0cea

am: 70db53a8

Change-Id: I03de10d23f3d9a74ee08fdb6a711400e3e0468cf
parents dffaa57c 70db53a8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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.
+9 −0
Original line number Diff line number Diff line
@@ -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;
                }
            };
}
+18 −0
Original line number Diff line number Diff line
@@ -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);
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -46,4 +46,9 @@ public class ShadowUtils {
    public static void reset() {
        sFingerprintManager = null;
    }

    @Implementation
    public static boolean isWifiOnly(Context context) {
        return true;
    }
}