Misc fixes to search and UI.
- Use prefContext to create preference. - rename "Gestures" to "Gesture shortcuts" - Add search keyword to individual gesture settings so when search "gesture" they also show up. - call super() for all getNonIndexableKeys() in search provider Fix: 38327387 Fix: 36621897 Fix: 36685646 Test: make RunSettingsRoboTests Change-Id: Ia5ddfeae08cb27c278dfb8d2376594e21d8f283c
This commit is contained in:
@@ -6364,6 +6364,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>
|
||||
@@ -8412,7 +8413,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>
|
||||
|
@@ -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"
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
||||
|
||||
|
@@ -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>
|
@@ -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>
|
@@ -253,7 +253,7 @@ public class EncryptionAndCredential extends SettingsPreferenceFragment implemen
|
||||
|
||||
@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);
|
||||
|
||||
|
@@ -110,7 +110,7 @@ public class BackupSettingsActivity extends Activity implements Indexable {
|
||||
|
||||
@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
|
||||
|
@@ -131,9 +131,8 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment {
|
||||
|
||||
@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);
|
||||
|
@@ -226,7 +226,7 @@ public class DataUsageMeteredSettings extends SettingsPreferenceFragment impleme
|
||||
|
||||
@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");
|
||||
}
|
||||
|
@@ -870,7 +870,7 @@ public class PowerUsageSummary extends PowerUsageBase implements
|
||||
|
||||
@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);
|
||||
|
@@ -207,7 +207,7 @@ public class NetworkDashboardFragment extends DashboardFragment implements
|
||||
|
||||
@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;
|
||||
|
@@ -33,14 +33,13 @@ import android.view.ViewGroup;
|
||||
|
||||
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,9 +161,11 @@ public class PaymentSettings extends SettingsPreferenceFragment implements Index
|
||||
|
||||
@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;
|
||||
}
|
||||
|
@@ -198,7 +198,7 @@ public class WifiP2pSettings extends DashboardFragment
|
||||
|
||||
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 @@ public class WifiP2pSettings extends DashboardFragment
|
||||
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);
|
||||
|
@@ -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 org.robolectric.annotation.Config;
|
||||
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 @@ public class PaymentSettingsTest {
|
||||
when(mManager.hasSystemFeature(PackageManager.FEATURE_NFC)).thenReturn(true);
|
||||
|
||||
List<String> niks = mFragment.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
|
||||
assertThat(niks).isNull();
|
||||
assertThat(niks).isEmpty();
|
||||
}
|
||||
}
|
@@ -369,6 +369,7 @@ public class DatabaseIndexingManagerTest {
|
||||
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 @@ public class DatabaseIndexingManagerTest {
|
||||
// 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));
|
||||
|
@@ -19,9 +19,9 @@ package com.android.settings.search;
|
||||
|
||||
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 {
|
||||
@@ -38,7 +38,7 @@ public class FakeIndexProvider implements Indexable {
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
ArrayList<String> result = new ArrayList<>();
|
||||
List<String> result = super.getNonIndexableKeys(context);
|
||||
result.add(KEY);
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user