Merge "Misc fixes to search and UI."
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7b9f77c..08d1b7c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6366,6 +6366,7 @@
<string name="keywords_lockscreen">slide to unlock, password, pattern, PIN</string>
<string name="keywords_profile_challenge">work challenge, work, profile</string>
<string name="keywords_unification">work profile, managed profile, unify, unification, work, profile</string>
+ <!-- Search keyword for gesture settings -->
<string name="keywords_gesture">gesture</string>
<string name="keywords_payment_settings">pay, tap, payments</string>
<string name="keywords_backup">backup, back up</string>
@@ -8414,7 +8415,7 @@
<string name="deletion_helper_preference_title">Free up space now</string>
<!-- Preference title for gesture settings [CHAR LIMIT=25]-->
- <string name="gesture_preference_title">Gestures</string>
+ <string name="gesture_preference_title">Gesture shortcuts</string>
<!-- Preference summary for gesture settings (phone) [CHAR LIMIT=NONE]-->
<string name="gesture_preference_summary" product="default">Quick gestures to control your phone</string>
diff --git a/res/xml/assist_gesture_settings.xml b/res/xml/assist_gesture_settings.xml
index 0dbf9c7..e79d886 100644
--- a/res/xml/assist_gesture_settings.xml
+++ b/res/xml/assist_gesture_settings.xml
@@ -27,7 +27,8 @@
<SwitchPreference
android:key="gesture_assist"
android:title="@string/assist_gesture_title"
- android:summary="@string/assist_gesture_summary" />
+ android:summary="@string/assist_gesture_summary"
+ app:keywords="@string/keywords_gesture"/>
<com.android.settings.widget.SeekBarPreference
android:key="gesture_assist_sensitivity"
diff --git a/res/xml/camera_lift_trigger_settings.xml b/res/xml/camera_lift_trigger_settings.xml
index fe8991a..d9de14f 100644
--- a/res/xml/camera_lift_trigger_settings.xml
+++ b/res/xml/camera_lift_trigger_settings.xml
@@ -27,6 +27,7 @@
<SwitchPreference
android:key="gesture_camera_lift_trigger"
android:title="@string/camera_lift_trigger_title"
- android:summary="@string/camera_lift_trigger_summary"/>
+ android:summary="@string/camera_lift_trigger_summary"
+ app:keywords="@string/keywords_gesture"/>
</PreferenceScreen>
diff --git a/res/xml/double_tap_power_settings.xml b/res/xml/double_tap_power_settings.xml
index 54854a8..4d89de6 100644
--- a/res/xml/double_tap_power_settings.xml
+++ b/res/xml/double_tap_power_settings.xml
@@ -22,11 +22,12 @@
<com.android.settings.widget.VideoPreference
android:key="gesture_double_tap_power_video"
app:animation="@raw/gesture_double_tap"
- app:preview="@drawable/gesture_double_tap"/>
+ app:preview="@drawable/gesture_double_tap" />
<SwitchPreference
android:key="gesture_double_tap_power"
android:title="@string/double_tap_power_for_camera_title"
- android:summary="@string/double_tap_power_for_camera_summary"/>
+ android:summary="@string/double_tap_power_for_camera_summary"
+ app:keywords="@string/keywords_gesture" />
</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/double_tap_screen_settings.xml b/res/xml/double_tap_screen_settings.xml
index f7fe853..1601aae 100644
--- a/res/xml/double_tap_screen_settings.xml
+++ b/res/xml/double_tap_screen_settings.xml
@@ -27,6 +27,7 @@
<SwitchPreference
android:key="gesture_double_tap_screen"
android:title="@string/ambient_display_title"
- android:summary="@string/ambient_display_summary"/>
+ android:summary="@string/ambient_display_summary"
+ app:keywords="@string/keywords_gesture"/>
</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/double_twist_gesture_settings.xml b/res/xml/double_twist_gesture_settings.xml
index f77d778..94d9782 100644
--- a/res/xml/double_twist_gesture_settings.xml
+++ b/res/xml/double_twist_gesture_settings.xml
@@ -27,6 +27,7 @@
<SwitchPreference
android:key="gesture_double_twist"
android:title="@string/double_twist_for_camera_mode_title"
- android:summary="@string/double_twist_for_camera_mode_summary"/>
+ android:summary="@string/double_twist_for_camera_mode_summary"
+ app:keywords="@string/keywords_gesture"/>
</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/language_and_input.xml b/res/xml/language_and_input.xml
index 8c83767..d88cd11 100644
--- a/res/xml/language_and_input.xml
+++ b/res/xml/language_and_input.xml
@@ -63,42 +63,43 @@
<PreferenceCategory
android:key="gesture_settings_category"
- android:title="@string/gesture_preference_title">
+ android:title="@string/gesture_preference_title"
+ settings:keywords="@string/keywords_gesture">
<Preference
android:key="gesture_assist_input_summary"
android:title="@string/assist_gesture_title"
- android:fragment="com.android.settings.gestures.AssistGestureSettings"/>
+ android:fragment="com.android.settings.gestures.AssistGestureSettings" />
<Preference
android:key="gesture_swipe_down_fingerprint_input_summary"
android:title="@string/fingerprint_swipe_for_notifications_title"
- android:fragment="com.android.settings.gestures.SwipeToNotificationSettings"/>
+ android:fragment="com.android.settings.gestures.SwipeToNotificationSettings" />
<Preference
android:key="gesture_double_tap_screen_input_summary"
android:title="@string/ambient_display_title"
- android:fragment="com.android.settings.gestures.DoubleTapScreenSettings"/>
+ android:fragment="com.android.settings.gestures.DoubleTapScreenSettings" />
<Preference
android:key="gesture_pick_up_input_summary"
android:title="@string/ambient_display_pickup_title"
- android:fragment="com.android.settings.gestures.PickupGestureSettings"/>
+ android:fragment="com.android.settings.gestures.PickupGestureSettings" />
<Preference
android:key="gesture_camera_lift_trigger_summary"
android:title="@string/camera_lift_trigger_title"
- android:fragment="com.android.settings.gestures.CameraLiftTriggerSettings"/>
+ android:fragment="com.android.settings.gestures.CameraLiftTriggerSettings" />
<Preference
android:key="gesture_double_tap_power_input_summary"
android:title="@string/double_tap_power_for_camera_title"
- android:fragment="com.android.settings.gestures.DoubleTapPowerSettings"/>
+ android:fragment="com.android.settings.gestures.DoubleTapPowerSettings" />
<Preference
android:key="gesture_double_twist_input_summary"
android:title="@string/double_twist_for_camera_mode_title"
- android:fragment="com.android.settings.gestures.DoubleTwistGestureSettings"/>
+ android:fragment="com.android.settings.gestures.DoubleTwistGestureSettings" />
</PreferenceCategory>
diff --git a/res/xml/pick_up_gesture_settings.xml b/res/xml/pick_up_gesture_settings.xml
index 78122aa..0b4a1de 100644
--- a/res/xml/pick_up_gesture_settings.xml
+++ b/res/xml/pick_up_gesture_settings.xml
@@ -23,11 +23,12 @@
<com.android.settings.widget.VideoPreference
android:key="gesture_pick_up_video"
app:animation="@raw/gesture_ambient_lift"
- app:preview="@drawable/gesture_ambient_lift"/>
+ app:preview="@drawable/gesture_ambient_lift" />
<SwitchPreference
android:key="gesture_pick_up"
android:title="@string/ambient_display_pickup_title"
- android:summary="@string/ambient_display_pickup_summary"/>
+ android:summary="@string/ambient_display_pickup_summary"
+ app:keywords="@string/keywords_gesture" />
</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/swipe_to_notification_settings.xml b/res/xml/swipe_to_notification_settings.xml
index b26af38..6269bdc 100644
--- a/res/xml/swipe_to_notification_settings.xml
+++ b/res/xml/swipe_to_notification_settings.xml
@@ -27,6 +27,7 @@
<SwitchPreference
android:key="gesture_swipe_down_fingerprint"
android:title="@string/fingerprint_swipe_for_notifications_title"
- android:summary="@string/fingerprint_swipe_for_notifications_summary"/>
+ android:summary="@string/fingerprint_swipe_for_notifications_summary"
+ app:keywords="@string/keywords_gesture"/>
</PreferenceScreen>
\ No newline at end of file
diff --git a/src/com/android/settings/EncryptionAndCredential.java b/src/com/android/settings/EncryptionAndCredential.java
index 1750e75..f6f17cf 100644
--- a/src/com/android/settings/EncryptionAndCredential.java
+++ b/src/com/android/settings/EncryptionAndCredential.java
@@ -253,7 +253,7 @@
@Override
public List<String> getNonIndexableKeys(Context context) {
- final List<String> keys = new ArrayList<String>();
+ final List<String> keys = super.getNonIndexableKeys(context);
final UserManager um = UserManager.get(context);
diff --git a/src/com/android/settings/backup/BackupSettingsActivity.java b/src/com/android/settings/backup/BackupSettingsActivity.java
index f8bab3d..3fe740e 100644
--- a/src/com/android/settings/backup/BackupSettingsActivity.java
+++ b/src/com/android/settings/backup/BackupSettingsActivity.java
@@ -110,7 +110,7 @@
@Override
public List<String> getNonIndexableKeys(Context context) {
- final List<String> keys = new ArrayList<String>();
+ final List<String> keys = super.getNonIndexableKeys(context);
// For non-primary user, no backup is available, so don't show it in search
// TODO: http://b/22388012
diff --git a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
index 27492ce..254d5e2 100644
--- a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
+++ b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
@@ -131,9 +131,8 @@
@Override
public List<String> getNonIndexableKeys(Context context) {
+ final List<String> keys = super.getNonIndexableKeys(context);
PackageManager pm = context.getPackageManager();
- final List<String> keys = new ArrayList<String>();
-
if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC)) {
keys.add(NfcPreferenceController.KEY_TOGGLE_NFC);
keys.add(NfcPreferenceController.KEY_ANDROID_BEAM_SETTINGS);
diff --git a/src/com/android/settings/datausage/DataUsageMeteredSettings.java b/src/com/android/settings/datausage/DataUsageMeteredSettings.java
index ce2bc8d..c2a18e9 100644
--- a/src/com/android/settings/datausage/DataUsageMeteredSettings.java
+++ b/src/com/android/settings/datausage/DataUsageMeteredSettings.java
@@ -226,7 +226,7 @@
@Override
public List<String> getNonIndexableKeys(Context context) {
- final ArrayList<String> result = new ArrayList<String>();
+ final List<String> result = super.getNonIndexableKeys(context);
if (!SHOW_MOBILE_CATEGORY || !hasReadyMobileRadio(context)) {
result.add("mobile");
}
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index cac4e90..de80d3b 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -848,7 +848,7 @@
@Override
public List<String> getNonIndexableKeys(Context context) {
- List<String> niks = new ArrayList<>();
+ List<String> niks = super.getNonIndexableKeys(context);
// Duplicates in display
niks.add(KEY_AUTO_BRIGHTNESS);
niks.add(KEY_SCREEN_TIMEOUT);
diff --git a/src/com/android/settings/network/NetworkDashboardFragment.java b/src/com/android/settings/network/NetworkDashboardFragment.java
index 869cef9..a393056 100644
--- a/src/com/android/settings/network/NetworkDashboardFragment.java
+++ b/src/com/android/settings/network/NetworkDashboardFragment.java
@@ -207,7 +207,7 @@
@Override
public List<String> getNonIndexableKeys(Context context) {
- List<String> keys = new ArrayList<>();
+ List<String> keys = super.getNonIndexableKeys(context);
// Remove master switch as a result
keys.add(WifiMasterSwitchPreferenceController.KEY_TOGGLE_WIFI);
return keys;
diff --git a/src/com/android/settings/nfc/PaymentSettings.java b/src/com/android/settings/nfc/PaymentSettings.java
index 47de1a5..64161d1 100644
--- a/src/com/android/settings/nfc/PaymentSettings.java
+++ b/src/com/android/settings/nfc/PaymentSettings.java
@@ -33,14 +33,13 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settings.search.Indexable;
-import com.android.settings.search.SearchIndexableRaw;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.nfc.PaymentBackend.PaymentAppInfo;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
+import com.android.settings.search.SearchIndexableRaw;
-import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
@@ -162,11 +161,13 @@
@Override
public List<String> getNonIndexableKeys(Context context) {
+ final List<String> nonVisibleKeys = super.getNonIndexableKeys(context);
final PackageManager pm = context.getPackageManager();
- if (pm.hasSystemFeature(PackageManager.FEATURE_NFC)) return null;
- final List<String> nonVisibleKeys = new ArrayList<String>();
+ if (pm.hasSystemFeature(PackageManager.FEATURE_NFC)) {
+ return nonVisibleKeys;
+ }
nonVisibleKeys.add(PAYMENT_KEY);
return nonVisibleKeys;
}
- };
+ };
}
diff --git a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
index 232666a..cd328d9 100644
--- a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
+++ b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
@@ -198,7 +198,7 @@
if (savedInstanceState != null && savedInstanceState.containsKey(SAVE_DIALOG_PEER)) {
WifiP2pDevice device = savedInstanceState.getParcelable(SAVE_DIALOG_PEER);
- mSelectedWifiPeer = new WifiP2pPeer(getActivity(), device);
+ mSelectedWifiPeer = new WifiP2pPeer(getPrefContext(), device);
}
if (savedInstanceState != null && savedInstanceState.containsKey(SAVE_DEVICE_NAME)) {
mSavedDeviceName = savedInstanceState.getString(SAVE_DEVICE_NAME);
@@ -533,7 +533,7 @@
if (DBG) Log.d(TAG, "List of available peers");
for (WifiP2pDevice peer: mPeers.getDeviceList()) {
if (DBG) Log.d(TAG, "-> " + peer);
- mPeerCategoryController.addChild(new WifiP2pPeer(getActivity(), peer));
+ mPeerCategoryController.addChild(new WifiP2pPeer(getPrefContext(), peer));
if (peer.status == WifiP2pDevice.CONNECTED) mConnectedDevices++;
}
if (DBG) Log.d(TAG, " mConnectedDevices " + mConnectedDevices);
diff --git a/tests/robotests/src/com/android/settings/nfc/PaymentSettingsTest.java b/tests/robotests/src/com/android/settings/nfc/PaymentSettingsTest.java
index 7e898fb..b54125e 100644
--- a/tests/robotests/src/com/android/settings/nfc/PaymentSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/nfc/PaymentSettingsTest.java
@@ -18,11 +18,11 @@
package com.android.settings.nfc;
import android.content.Context;
-
import android.content.pm.PackageManager;
-import android.content.pm.PackageParser;
+
import com.android.settings.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -33,7 +33,6 @@
import java.util.List;
import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
@@ -67,6 +66,6 @@
when(mManager.hasSystemFeature(PackageManager.FEATURE_NFC)).thenReturn(true);
List<String> niks = mFragment.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
- assertThat(niks).isNull();
+ assertThat(niks).isEmpty();
}
}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/search/DatabaseIndexingManagerTest.java b/tests/robotests/src/com/android/settings/search/DatabaseIndexingManagerTest.java
index 85ad495..ab8891b 100644
--- a/tests/robotests/src/com/android/settings/search/DatabaseIndexingManagerTest.java
+++ b/tests/robotests/src/com/android/settings/search/DatabaseIndexingManagerTest.java
@@ -369,6 +369,7 @@
mContext.getString(R.string.fingerprint_swipe_for_notifications_title);
final String prefSummary =
mContext.getString(R.string.fingerprint_swipe_for_notifications_summary);
+ final String keywords = mContext.getString(R.string.keywords_gesture);
Cursor cursor = mDb.rawQuery(
"SELECT * FROM prefs_index where data_title='" + prefTitle + "'", null);
cursor.moveToFirst();
@@ -392,7 +393,7 @@
// Entries - only on for list preferences
assertThat(cursor.getString(8)).isNull();
// Keywords
- assertThat(cursor.getString(9)).isEmpty();
+ assertThat(cursor.getString(9)).isEqualTo(keywords);
// Screen Title
assertThat(cursor.getString(10)).isEqualTo(
mContext.getString(R.string.fingerprint_swipe_for_notifications_title));
diff --git a/tests/robotests/src/com/android/settings/search/FakeIndexProvider.java b/tests/robotests/src/com/android/settings/search/FakeIndexProvider.java
index 35486ef..69c2589 100644
--- a/tests/robotests/src/com/android/settings/search/FakeIndexProvider.java
+++ b/tests/robotests/src/com/android/settings/search/FakeIndexProvider.java
@@ -19,12 +19,12 @@
import android.content.Context;
import android.provider.SearchIndexableResource;
+
import com.android.settings.core.PreferenceController;
-import java.util.ArrayList;
import java.util.List;
-public class FakeIndexProvider implements Indexable {
+public class FakeIndexProvider implements Indexable {
public static final String KEY = "TestKey";
@@ -38,7 +38,7 @@
@Override
public List<String> getNonIndexableKeys(Context context) {
- ArrayList<String> result = new ArrayList<>();
+ List<String> result = super.getNonIndexableKeys(context);
result.add(KEY);
return result;
}