Remove Wallpaper duplicate from setting search
Bug: 33701673 Test: make -j40 RunSettingsRoboTests Change-Id: I520cbc74284d92ab05b733346ee1b3115ddd8e9f
This commit is contained in:
@@ -40,6 +40,7 @@ public class LegalSettings extends SettingsPreferenceFragment implements Indexab
|
|||||||
private static final String KEY_LICENSE = "license";
|
private static final String KEY_LICENSE = "license";
|
||||||
private static final String KEY_COPYRIGHT = "copyright";
|
private static final String KEY_COPYRIGHT = "copyright";
|
||||||
private static final String KEY_WEBVIEW_LICENSE = "webview_license";
|
private static final String KEY_WEBVIEW_LICENSE = "webview_license";
|
||||||
|
private static final String KEY_WALLPAPER_ATTRIBUTIONS = "wallpaper_attributions";
|
||||||
|
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
@@ -76,7 +77,7 @@ public class LegalSettings extends SettingsPreferenceFragment implements Indexab
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getNonIndexableKeys(Context context) {
|
public List<String> getNonIndexableKeys(Context context) {
|
||||||
final List<String> keys = new ArrayList<String>();
|
final List<String> keys = super.getNonIndexableKeys(context);
|
||||||
if (!checkIntentAction(context, "android.settings.TERMS")) {
|
if (!checkIntentAction(context, "android.settings.TERMS")) {
|
||||||
keys.add(KEY_TERMS);
|
keys.add(KEY_TERMS);
|
||||||
}
|
}
|
||||||
@@ -89,6 +90,7 @@ public class LegalSettings extends SettingsPreferenceFragment implements Indexab
|
|||||||
if (!checkIntentAction(context, "android.settings.WEBVIEW_LICENSE")) {
|
if (!checkIntentAction(context, "android.settings.WEBVIEW_LICENSE")) {
|
||||||
keys.add(KEY_WEBVIEW_LICENSE);
|
keys.add(KEY_WEBVIEW_LICENSE);
|
||||||
}
|
}
|
||||||
|
keys.add(KEY_WALLPAPER_ATTRIBUTIONS);
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -72,7 +72,7 @@ public class BaseSearchIndexProvider implements Indexable.SearchIndexProvider {
|
|||||||
}
|
}
|
||||||
return nonIndexableKeys;
|
return nonIndexableKeys;
|
||||||
} else {
|
} else {
|
||||||
return EMPTY_LIST;
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.android.settings;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.android.settings.testutils.XmlTestUtils;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.RuntimeEnvironment;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
import static org.mockito.Mockito.spy;
|
||||||
|
|
||||||
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
|
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||||
|
public class LegalSettingsTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNonIndexableKeys_existInXmlLayout() {
|
||||||
|
final Context context = RuntimeEnvironment.application;
|
||||||
|
final List<String> niks = LegalSettings.SEARCH_INDEX_DATA_PROVIDER
|
||||||
|
.getNonIndexableKeys(context);
|
||||||
|
|
||||||
|
final List<String> keys = XmlTestUtils.getKeysFromPreferenceXml(context,
|
||||||
|
R.xml.about_legal);
|
||||||
|
|
||||||
|
assertThat(keys).containsAllIn(niks);
|
||||||
|
}
|
||||||
|
}
|
@@ -671,9 +671,9 @@ public class DatabaseIndexingManagerTest {
|
|||||||
new HashMap<String, Set<String>>());
|
new HashMap<String, Set<String>>());
|
||||||
|
|
||||||
Cursor cursor = mDb.rawQuery("SELECT * FROM prefs_index WHERE enabled = 1", null);
|
Cursor cursor = mDb.rawQuery("SELECT * FROM prefs_index WHERE enabled = 1", null);
|
||||||
assertThat(cursor.getCount()).isEqualTo(2);
|
assertThat(cursor.getCount()).isEqualTo(1);
|
||||||
cursor = mDb.rawQuery("SELECT * FROM prefs_index WHERE enabled = 0", null);
|
cursor = mDb.rawQuery("SELECT * FROM prefs_index WHERE enabled = 0", null);
|
||||||
assertThat(cursor.getCount()).isEqualTo(4);
|
assertThat(cursor.getCount()).isEqualTo(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user