Merge "Renaming gesture"
This commit is contained in:
@@ -9585,10 +9585,10 @@
|
||||
<!-- Summary text for ambient display (device) [CHAR LIMIT=NONE]-->
|
||||
<string name="ambient_display_pickup_summary" product="device">To check time, notifications, and other info, pick up your device.</string>
|
||||
|
||||
<!-- Preference and settings suggestion title text for reach gesture [CHAR LIMIT=60]-->
|
||||
<string name="ambient_display_reach_title">Reach gesture</string>
|
||||
<!-- Preference and settings suggestion title text for gesture that shows the lock screen [CHAR LIMIT=60]-->
|
||||
<string name="ambient_display_wake_lock_screen_title">Wake lock screen gesture</string>
|
||||
<!-- Summary text for ambient display [CHAR LIMIT=NONE]-->
|
||||
<string name="ambient_display_reach_summary" product="default"></string>
|
||||
<string name="ambient_display_wake_lock_screen_summary" product="default"></string>
|
||||
|
||||
<!-- Title text for swiping downwards on fingerprint sensor for notifications [CHAR LIMIT=80]-->
|
||||
<string name="fingerprint_swipe_for_notifications_title">Swipe fingerprint for notifications</string>
|
||||
|
@@ -28,10 +28,10 @@
|
||||
settings:controller="com.android.settings.gestures.AssistGestureSettingsPreferenceController" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_reach_summary"
|
||||
android:title="@string/ambient_display_reach_title"
|
||||
android:fragment="com.android.settings.gestures.ReachGestureSettings"
|
||||
settings:controller="com.android.settings.gestures.ReachGesturePreferenceController" />
|
||||
android:key="gesture_wake_lock_screen_summary"
|
||||
android:title="@string/ambient_display_wake_lock_screen_title"
|
||||
android:fragment="com.android.settings.gestures.WakeLockScreenGestureSettings"
|
||||
settings:controller="com.android.settings.gestures.WakeLockScreenGesturePreferenceController" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_swipe_down_fingerprint_input_summary"
|
||||
|
@@ -18,20 +18,20 @@
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:key="gesture_reach_screen"
|
||||
android:title="@string/ambient_display_reach_title">
|
||||
android:key="gesture_wake_lock_screen_screen"
|
||||
android:title="@string/ambient_display_wake_lock_screen_title">
|
||||
|
||||
<com.android.settings.widget.VideoPreference
|
||||
android:key="gesture_reach_video"
|
||||
app:animation="@raw/gesture_ambient_reach"
|
||||
app:preview="@drawable/gesture_ambient_reach" />
|
||||
android:key="gesture_wake_lock_screen_video"
|
||||
app:animation="@raw/gesture_ambient_wake_lock_screen"
|
||||
app:preview="@drawable/gesture_ambient_wake_lock_screen" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="gesture_reach"
|
||||
android:title="@string/ambient_display_reach_title"
|
||||
android:summary="@string/ambient_display_reach_summary"
|
||||
android:key="gesture_wake_lock_screen"
|
||||
android:title="@string/ambient_display_wake_lock_screen_title"
|
||||
android:summary="@string/ambient_display_wake_lock_screen_summary"
|
||||
app:keywords="@string/keywords_gesture"
|
||||
app:controller="com.android.settings.gestures.ReachGesturePreferenceController"
|
||||
app:controller="com.android.settings.gestures.WakeLockScreenGesturePreferenceController"
|
||||
app:allowDividerAbove="true" />
|
||||
|
||||
</PreferenceScreen>
|
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.settings.gestures;
|
||||
|
||||
import static android.provider.Settings.Secure.DOZE_REACH_GESTURE;
|
||||
import static android.provider.Settings.Secure.DOZE_WAKE_LOCK_SCREEN_GESTURE;
|
||||
|
||||
import android.annotation.UserIdInt;
|
||||
import android.content.Context;
|
||||
@@ -26,33 +26,34 @@ import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||
|
||||
public class ReachGesturePreferenceController extends GesturePreferenceController {
|
||||
public class WakeLockScreenGesturePreferenceController extends GesturePreferenceController {
|
||||
|
||||
private static final int ON = 1;
|
||||
private static final int OFF = 0;
|
||||
|
||||
private static final String PREF_KEY_VIDEO = "gesture_reach_video";
|
||||
private final String mReachUpPrefKey;
|
||||
private static final String PREF_KEY_VIDEO = "gesture_wake_lock_screen_video";
|
||||
private final String mWakeLockScreenPrefKey;
|
||||
|
||||
private AmbientDisplayConfiguration mAmbientConfig;
|
||||
@UserIdInt
|
||||
private final int mUserId;
|
||||
|
||||
public ReachGesturePreferenceController(Context context, String key) {
|
||||
public WakeLockScreenGesturePreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
mUserId = UserHandle.myUserId();
|
||||
mReachUpPrefKey = key;
|
||||
mWakeLockScreenPrefKey = key;
|
||||
}
|
||||
|
||||
public ReachGesturePreferenceController setConfig(AmbientDisplayConfiguration config) {
|
||||
public WakeLockScreenGesturePreferenceController
|
||||
setConfig(AmbientDisplayConfiguration config) {
|
||||
mAmbientConfig = config;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
// No hardware support for Reach Gesture
|
||||
if (!getAmbientConfig().reachGestureAvailable()) {
|
||||
// No hardware support for this Gesture
|
||||
if (!getAmbientConfig().wakeLockScreenGestureAvailable()) {
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@@ -61,7 +62,7 @@ public class ReachGesturePreferenceController extends GesturePreferenceControlle
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "gesture_reach");
|
||||
return TextUtils.equals(getPreferenceKey(), "gesture_wake_lock_screen");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,17 +72,17 @@ public class ReachGesturePreferenceController extends GesturePreferenceControlle
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return getAmbientConfig().reachGestureEnabled(mUserId);
|
||||
return getAmbientConfig().wakeLockScreenGestureEnabled(mUserId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return mReachUpPrefKey;
|
||||
return mWakeLockScreenPrefKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setChecked(boolean isChecked) {
|
||||
return Settings.Secure.putInt(mContext.getContentResolver(), DOZE_REACH_GESTURE,
|
||||
return Settings.Secure.putInt(mContext.getContentResolver(), DOZE_WAKE_LOCK_SCREEN_GESTURE,
|
||||
isChecked ? ON : OFF);
|
||||
}
|
||||
|
@@ -33,12 +33,12 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@SearchIndexable
|
||||
public class ReachGestureSettings extends DashboardFragment {
|
||||
public class WakeLockScreenGestureSettings extends DashboardFragment {
|
||||
|
||||
private static final String TAG = "ReachGestureSettings";
|
||||
private static final String TAG = "WakeLockScreenGestureSettings";
|
||||
|
||||
public static final String PREF_KEY_SUGGESTION_COMPLETE =
|
||||
"pref_reach_gesture_suggestion_complete";
|
||||
"pref_wake_lock_screen_gesture_suggestion_complete";
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
@@ -48,13 +48,13 @@ public class ReachGestureSettings extends DashboardFragment {
|
||||
SharedPreferences prefs = suggestionFeatureProvider.getSharedPrefs(context);
|
||||
prefs.edit().putBoolean(PREF_KEY_SUGGESTION_COMPLETE, true).apply();
|
||||
|
||||
use(ReachGesturePreferenceController.class)
|
||||
use(WakeLockScreenGesturePreferenceController.class)
|
||||
.setConfig(new AmbientDisplayConfiguration(context));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.SETTINGS_GESTURE_REACH;
|
||||
return MetricsProto.MetricsEvent.SETTINGS_GESTURE_WAKE_LOCK_SCREEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,7 +64,7 @@ public class ReachGestureSettings extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.reach_gesture_settings;
|
||||
return R.xml.wake_lock_screen_gesture_settings;
|
||||
}
|
||||
|
||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
@@ -73,7 +73,7 @@ public class ReachGestureSettings extends DashboardFragment {
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||
Context context, boolean enabled) {
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.reach_gesture_settings;
|
||||
sir.xmlResId = R.xml.wake_lock_screen_gesture_settings;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
};
|
@@ -37,41 +37,41 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
public class ReachGesturePreferenceControllerTest {
|
||||
public class WakeLockScreenGesturePreferenceControllerTest {
|
||||
|
||||
private static final String KEY_REACH = "gesture_reach";
|
||||
private static final String KEY_WAKE_LOCK_SCREEN = "gesture_wake_lock_screen";
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private AmbientDisplayConfiguration mAmbientDisplayConfiguration;
|
||||
|
||||
private ReachGesturePreferenceController mController;
|
||||
private WakeLockScreenGesturePreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mController = new ReachGesturePreferenceController(mContext, KEY_REACH);
|
||||
mController = new WakeLockScreenGesturePreferenceController(mContext, KEY_WAKE_LOCK_SCREEN);
|
||||
mController.setConfig(mAmbientDisplayConfiguration);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsChecked_configIsSet_shouldReturnTrue() {
|
||||
// Set the setting to be enabled.
|
||||
when(mAmbientDisplayConfiguration.reachGestureEnabled(anyInt())).thenReturn(true);
|
||||
when(mAmbientDisplayConfiguration.wakeLockScreenGestureEnabled(anyInt())).thenReturn(true);
|
||||
assertThat(mController.isChecked()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsChecked_configIsNotSet_shouldReturnFalse() {
|
||||
// Set the setting to be disabled.
|
||||
when(mAmbientDisplayConfiguration.reachGestureEnabled(anyInt())).thenReturn(false);
|
||||
when(mAmbientDisplayConfiguration.wakeLockScreenGestureEnabled(anyInt())).thenReturn(false);
|
||||
assertThat(mController.isChecked()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_gestureNotSupported_UNSUPPORTED_ON_DEVICE() {
|
||||
when(mAmbientDisplayConfiguration.reachGestureAvailable()).thenReturn(false);
|
||||
when(mAmbientDisplayConfiguration.wakeLockScreenGestureAvailable()).thenReturn(false);
|
||||
final int availabilityStatus = mController.getAvailabilityStatus();
|
||||
|
||||
assertThat(availabilityStatus).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||
@@ -79,7 +79,7 @@ public class ReachGesturePreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_gestureSupported_AVAILABLE() {
|
||||
when(mAmbientDisplayConfiguration.reachGestureAvailable()).thenReturn(true);
|
||||
when(mAmbientDisplayConfiguration.wakeLockScreenGestureAvailable()).thenReturn(true);
|
||||
final int availabilityStatus = mController.getAvailabilityStatus();
|
||||
|
||||
assertThat(availabilityStatus).isEqualTo(AVAILABLE);
|
||||
@@ -87,15 +87,15 @@ public class ReachGesturePreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final ReachGesturePreferenceController controller =
|
||||
new ReachGesturePreferenceController(mContext, "gesture_reach");
|
||||
final WakeLockScreenGesturePreferenceController controller =
|
||||
new WakeLockScreenGesturePreferenceController(mContext, KEY_WAKE_LOCK_SCREEN);
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final ReachGesturePreferenceController controller =
|
||||
new ReachGesturePreferenceController(mContext, "bad_key");
|
||||
final WakeLockScreenGesturePreferenceController controller =
|
||||
new WakeLockScreenGesturePreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
@@ -30,19 +30,19 @@ import org.robolectric.RuntimeEnvironment;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
public class ReachGestureSettingsTest {
|
||||
public class WakeLockScreenGestureSettingsTest {
|
||||
|
||||
private ReachGestureSettings mSettings;
|
||||
private WakeLockScreenGestureSettings mSettings;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mSettings = new ReachGestureSettings();
|
||||
mSettings = new WakeLockScreenGestureSettings();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchIndexProvider_shouldIndexResource() {
|
||||
final List<SearchIndexableResource> indexRes =
|
||||
ReachGestureSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
|
||||
WakeLockScreenGestureSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
|
||||
RuntimeEnvironment.application, true /* enabled */);
|
||||
|
||||
assertThat(indexRes).isNotNull();
|
Reference in New Issue
Block a user