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

Commit 915f0cea authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove Legal Information duplicate from Settings search" into oc-dev

parents 0c55014b 2e89758b
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -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.
+9 −0
Original line number Original line 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 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;
                }
            };
            };
}
}
+18 −0
Original line number Original line Diff line number Diff line
@@ -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);
    }
}
}
+5 −0
Original line number Original line Diff line number Diff line
@@ -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;
    }
}
}