GesturesSettingPreferenceController to Toggle
Convert GesturesSettingPreferenceController to TogglePreferenceController, All of its children need follow the change, add setter and robotest for them: AssistGestureSettingsPreferenceController DoubleTapPowerPreferenceController DoubleTapScreenPreferenceController DoubleTwistPreferenceController PickupGesturePreferenceController SwipeToNotificationPreferenceController Change-Id: I792b2d370eea828bf345fb2b1cc3eac260eb66f4 Merged-In: I792b2d370eea828bf345fb2b1cc3eac260eb66f4 Fixes: 74913806 Fixes: 67998110 Fixes: 67998098 Fixes: 67998048 Fixes: 67998069 Fixes: 67997452 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -35,12 +35,14 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:key="ambient_display_double_tap"
|
android:key="ambient_display_double_tap"
|
||||||
android:title="@string/ambient_display_title"
|
android:title="@string/ambient_display_title"
|
||||||
android:fragment="com.android.settings.gestures.DoubleTapScreenSettings" />
|
android:fragment="com.android.settings.gestures.DoubleTapScreenSettings"
|
||||||
|
settings:controller="com.android.settings.gestures.DoubleTapScreenPreferenceController" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="ambient_display_pick_up"
|
android:key="ambient_display_pick_up"
|
||||||
android:title="@string/ambient_display_pickup_title"
|
android:title="@string/ambient_display_pickup_title"
|
||||||
android:fragment="com.android.settings.gestures.PickupGestureSettings" />
|
android:fragment="com.android.settings.gestures.PickupGestureSettings"
|
||||||
|
settings:controller="com.android.settings.gestures.PickupGesturePreferenceController" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
@@ -52,7 +54,7 @@
|
|||||||
android:key="ambient_display_notification"
|
android:key="ambient_display_notification"
|
||||||
android:title="@string/doze_title"
|
android:title="@string/doze_title"
|
||||||
android:summary="@string/doze_summary"
|
android:summary="@string/doze_summary"
|
||||||
settings:controller="com.android.settings.display.AmbientDisplayNotificationsPreferenceController"/>
|
settings:controller="com.android.settings.display.AmbientDisplayNotificationsPreferenceController" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="gesture_assist"
|
android:key="gesture_assist"
|
||||||
android:title="@string/assist_gesture_title"
|
android:title="@string/assist_gesture_title"
|
||||||
app:keywords="@string/keywords_assist_gesture_launch" />
|
app:keywords="@string/keywords_assist_gesture_launch"
|
||||||
|
app:controller="com.android.settings.gestures.AssistGestureSettingsPreferenceController" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -46,7 +46,8 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:key="gesture_swipe_down_fingerprint_notifications"
|
android:key="gesture_swipe_down_fingerprint_notifications"
|
||||||
android:title="@string/fingerprint_swipe_for_notifications_title"
|
android:title="@string/fingerprint_swipe_for_notifications_title"
|
||||||
android:fragment="com.android.settings.gestures.SwipeToNotificationSettings" />
|
android:fragment="com.android.settings.gestures.SwipeToNotificationSettings"
|
||||||
|
settings:controller="com.android.settings.gestures.SwipeToNotificationPreferenceController" />
|
||||||
|
|
||||||
<com.android.settingslib.RestrictedPreference
|
<com.android.settingslib.RestrictedPreference
|
||||||
android:key="zen_mode_notifications"
|
android:key="zen_mode_notifications"
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
android:key="gesture_double_tap_power"
|
android:key="gesture_double_tap_power"
|
||||||
android:title="@string/double_tap_power_for_camera_title"
|
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" />
|
app:keywords="@string/keywords_gesture"
|
||||||
|
app:controller="com.android.settings.gestures.DoubleTapPowerPreferenceController" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@@ -30,6 +30,7 @@
|
|||||||
android:key="gesture_double_tap_screen"
|
android:key="gesture_double_tap_screen"
|
||||||
android:title="@string/ambient_display_title"
|
android:title="@string/ambient_display_title"
|
||||||
android:summary="@string/ambient_display_summary"
|
android:summary="@string/ambient_display_summary"
|
||||||
app:keywords="@string/keywords_gesture" />
|
app:keywords="@string/keywords_gesture"
|
||||||
|
app:controller="com.android.settings.gestures.DoubleTapScreenPreferenceController" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@@ -30,6 +30,7 @@
|
|||||||
android:key="gesture_double_twist"
|
android:key="gesture_double_twist"
|
||||||
android:title="@string/double_twist_for_camera_mode_title"
|
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" />
|
app:keywords="@string/keywords_gesture"
|
||||||
|
app:controller="com.android.settings.gestures.DoubleTwistPreferenceController" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@@ -17,38 +17,45 @@
|
|||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
android:key="gesture_settings_screen"
|
android:key="gesture_settings_screen"
|
||||||
android:title="@string/gesture_preference_title" >
|
android:title="@string/gesture_preference_title">
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="gesture_assist_input_summary"
|
android:key="gesture_assist_input_summary"
|
||||||
android:title="@string/assist_gesture_title"
|
android:title="@string/assist_gesture_title"
|
||||||
android:fragment="com.android.settings.gestures.AssistGestureSettings" />
|
android:fragment="com.android.settings.gestures.AssistGestureSettings"
|
||||||
|
settings:controller="com.android.settings.gestures.AssistGestureSettingsPreferenceController" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="gesture_swipe_down_fingerprint_input_summary"
|
android:key="gesture_swipe_down_fingerprint_input_summary"
|
||||||
android:title="@string/fingerprint_swipe_for_notifications_title"
|
android:title="@string/fingerprint_swipe_for_notifications_title"
|
||||||
android:fragment="com.android.settings.gestures.SwipeToNotificationSettings" />
|
android:fragment="com.android.settings.gestures.SwipeToNotificationSettings"
|
||||||
|
settings:controller="com.android.settings.gestures.SwipeToNotificationPreferenceController" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="gesture_double_tap_power_input_summary"
|
android:key="gesture_double_tap_power_input_summary"
|
||||||
android:title="@string/double_tap_power_for_camera_title"
|
android:title="@string/double_tap_power_for_camera_title"
|
||||||
android:fragment="com.android.settings.gestures.DoubleTapPowerSettings" />
|
android:fragment="com.android.settings.gestures.DoubleTapPowerSettings"
|
||||||
|
settings:controller="com.android.settings.gestures.DoubleTapPowerPreferenceController" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="gesture_double_twist_input_summary"
|
android:key="gesture_double_twist_input_summary"
|
||||||
android:title="@string/double_twist_for_camera_mode_title"
|
android:title="@string/double_twist_for_camera_mode_title"
|
||||||
android:fragment="com.android.settings.gestures.DoubleTwistGestureSettings" />
|
android:fragment="com.android.settings.gestures.DoubleTwistGestureSettings"
|
||||||
|
settings:controller="com.android.settings.gestures.DoubleTwistPreferenceController" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="gesture_double_tap_screen_input_summary"
|
android:key="gesture_double_tap_screen_input_summary"
|
||||||
android:title="@string/ambient_display_title"
|
android:title="@string/ambient_display_title"
|
||||||
android:fragment="com.android.settings.gestures.DoubleTapScreenSettings" />
|
android:fragment="com.android.settings.gestures.DoubleTapScreenSettings"
|
||||||
|
settings:controller="com.android.settings.gestures.DoubleTapScreenPreferenceController" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="gesture_pick_up_input_summary"
|
android:key="gesture_pick_up_input_summary"
|
||||||
android:title="@string/ambient_display_pickup_title"
|
android:title="@string/ambient_display_pickup_title"
|
||||||
android:fragment="com.android.settings.gestures.PickupGestureSettings" />
|
android:fragment="com.android.settings.gestures.PickupGestureSettings"
|
||||||
|
settings:controller="com.android.settings.gestures.PickupGesturePreferenceController" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="gesture_prevent_ringing_summary"
|
android:key="gesture_prevent_ringing_summary"
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
android:key="manage_assist_screen"
|
android:key="manage_assist_screen"
|
||||||
android:title="@string/assist_and_voice_input_title">
|
android:title="@string/assist_and_voice_input_title">
|
||||||
|
|
||||||
@@ -24,31 +25,32 @@
|
|||||||
android:key="default_assist"
|
android:key="default_assist"
|
||||||
android:title="@string/default_assist_title"
|
android:title="@string/default_assist_title"
|
||||||
android:summary="@string/summary_placeholder"
|
android:summary="@string/summary_placeholder"
|
||||||
android:fragment="com.android.settings.applications.assist.DefaultAssistPicker"/>
|
android:fragment="com.android.settings.applications.assist.DefaultAssistPicker" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="gesture_assist_application"
|
android:key="gesture_assist_application"
|
||||||
android:title="@string/assist_gesture_title"
|
android:title="@string/assist_gesture_title"
|
||||||
android:fragment="com.android.settings.gestures.AssistGestureSettings"/>
|
android:fragment="com.android.settings.gestures.AssistGestureSettings"
|
||||||
|
settings:controller="com.android.settings.gestures.AssistGestureSettingsPreferenceController" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="context"
|
android:key="context"
|
||||||
android:title="@string/assist_access_context_title"
|
android:title="@string/assist_access_context_title"
|
||||||
android:summary="@string/assist_access_context_summary"/>
|
android:summary="@string/assist_access_context_summary" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="screenshot"
|
android:key="screenshot"
|
||||||
android:title="@string/assist_access_screenshot_title"
|
android:title="@string/assist_access_screenshot_title"
|
||||||
android:summary="@string/assist_access_screenshot_summary"/>
|
android:summary="@string/assist_access_screenshot_summary" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="flash"
|
android:key="flash"
|
||||||
android:title="@string/assist_flash_title"
|
android:title="@string/assist_flash_title"
|
||||||
android:summary="@string/assist_flash_summary"/>
|
android:summary="@string/assist_flash_summary" />
|
||||||
|
|
||||||
<com.android.settings.widget.GearPreference
|
<com.android.settings.widget.GearPreference
|
||||||
android:key="voice_input_settings"
|
android:key="voice_input_settings"
|
||||||
android:title="@string/voice_input_settings_title"
|
android:title="@string/voice_input_settings_title"
|
||||||
android:fragment="com.android.settings.applications.assist.DefaultVoiceInputPicker"/>
|
android:fragment="com.android.settings.applications.assist.DefaultVoiceInputPicker" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
android:key="gesture_pick_up"
|
android:key="gesture_pick_up"
|
||||||
android:title="@string/ambient_display_pickup_title"
|
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" />
|
app:keywords="@string/keywords_gesture"
|
||||||
|
app:controller="com.android.settings.gestures.PickupGesturePreferenceController" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@@ -23,12 +23,13 @@
|
|||||||
<com.android.settings.widget.VideoPreference
|
<com.android.settings.widget.VideoPreference
|
||||||
android:key="gesture_swipe_down_fingerprint_video"
|
android:key="gesture_swipe_down_fingerprint_video"
|
||||||
app:animation="@raw/gesture_fingerprint_swipe"
|
app:animation="@raw/gesture_fingerprint_swipe"
|
||||||
app:preview="@drawable/gesture_fingerprint_swipe"/>
|
app:preview="@drawable/gesture_fingerprint_swipe" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="gesture_swipe_down_fingerprint"
|
android:key="gesture_swipe_down_fingerprint"
|
||||||
android:title="@string/fingerprint_swipe_for_notifications_title"
|
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"/>
|
app:keywords="@string/keywords_gesture"
|
||||||
|
app:controller="com.android.settings.gestures.SwipeToNotificationPreferenceController" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@@ -60,6 +60,12 @@ public class ManageAssist extends DashboardFragment {
|
|||||||
return MetricsEvent.APPLICATIONS_MANAGE_ASSIST;
|
return MetricsEvent.APPLICATIONS_MANAGE_ASSIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
use(AssistGestureSettingsPreferenceController.class).setAssistOnly(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
@@ -73,8 +79,6 @@ public class ManageAssist extends DashboardFragment {
|
|||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||||
controllers.add(new DefaultAssistPreferenceController(context, "default_assist",
|
controllers.add(new DefaultAssistPreferenceController(context, "default_assist",
|
||||||
true /* showSetting */));
|
true /* showSetting */));
|
||||||
controllers.add(new AssistGestureSettingsPreferenceController(context, lifecycle,
|
|
||||||
KEY_ASSIST, true /* assistOnly */));
|
|
||||||
controllers.add(new AssistContextPreferenceController(context, lifecycle));
|
controllers.add(new AssistContextPreferenceController(context, lifecycle));
|
||||||
controllers.add(new AssistScreenshotPreferenceController(context, lifecycle));
|
controllers.add(new AssistScreenshotPreferenceController(context, lifecycle));
|
||||||
controllers.add(new AssistFlashScreenPreferenceController(context, lifecycle));
|
controllers.add(new AssistFlashScreenPreferenceController(context, lifecycle));
|
||||||
|
@@ -69,12 +69,16 @@ public class AmbientDisplayAlwaysOnPreferenceController extends TogglePreference
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConfig(AmbientDisplayConfiguration config) {
|
public AmbientDisplayAlwaysOnPreferenceController setConfig(
|
||||||
|
AmbientDisplayConfiguration config) {
|
||||||
mConfig = config;
|
mConfig = config;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCallback(OnPreferenceChangedCallback callback) {
|
public AmbientDisplayAlwaysOnPreferenceController setCallback(
|
||||||
|
OnPreferenceChangedCallback callback) {
|
||||||
mCallback = callback;
|
mCallback = callback;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAlwaysOnEnabled(AmbientDisplayConfiguration config) {
|
public static boolean isAlwaysOnEnabled(AmbientDisplayConfiguration config) {
|
||||||
|
@@ -56,8 +56,10 @@ public class AmbientDisplayNotificationsPreferenceController extends
|
|||||||
*
|
*
|
||||||
* @param config AmbientDisplayConfiguration for this controller
|
* @param config AmbientDisplayConfiguration for this controller
|
||||||
*/
|
*/
|
||||||
public void setConfig(AmbientDisplayConfiguration config) {
|
public AmbientDisplayNotificationsPreferenceController setConfig(
|
||||||
|
AmbientDisplayConfiguration config) {
|
||||||
mConfig = config;
|
mConfig = config;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -44,35 +44,18 @@ public class AmbientDisplaySettings extends DashboardFragment {
|
|||||||
public static final String KEY_AMBIENT_DISPLAY_ALWAYS_ON = "ambient_display_always_on";
|
public static final String KEY_AMBIENT_DISPLAY_ALWAYS_ON = "ambient_display_always_on";
|
||||||
|
|
||||||
private static final String TAG = "AmbientDisplaySettings";
|
private static final String TAG = "AmbientDisplaySettings";
|
||||||
private static final int MY_USER_ID = UserHandle.myUserId();
|
|
||||||
|
|
||||||
private static final String KEY_AMBIENT_DISPLAY_DOUBLE_TAP = "ambient_display_double_tap";
|
|
||||||
private static final String KEY_AMBIENT_DISPLAY_PICK_UP = "ambient_display_pick_up";
|
|
||||||
private static final String KEY_AMBIENT_DISPLAY_NOTIFICATION = "ambient_display_notification";
|
|
||||||
|
|
||||||
private AmbientDisplayConfiguration mConfig;
|
private AmbientDisplayConfiguration mConfig;
|
||||||
|
|
||||||
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
|
|
||||||
Lifecycle lifecycle, AmbientDisplayConfiguration config) {
|
|
||||||
|
|
||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
|
||||||
controllers.add(new DoubleTapScreenPreferenceController(context, lifecycle, config,
|
|
||||||
MY_USER_ID, KEY_AMBIENT_DISPLAY_DOUBLE_TAP));
|
|
||||||
controllers.add(new PickupGesturePreferenceController(context, lifecycle, config,
|
|
||||||
MY_USER_ID, KEY_AMBIENT_DISPLAY_PICK_UP));
|
|
||||||
return controllers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Context context) {
|
public void onAttach(Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
final AmbientDisplayAlwaysOnPreferenceController controller = use(
|
use(AmbientDisplayAlwaysOnPreferenceController.class)
|
||||||
AmbientDisplayAlwaysOnPreferenceController.class);
|
.setConfig(getConfig(context))
|
||||||
controller.setConfig(getConfig(context));
|
.setCallback(this::updatePreferenceStates);
|
||||||
controller.setCallback(this::updatePreferenceStates);
|
use(AmbientDisplayNotificationsPreferenceController.class).setConfig(getConfig(context));
|
||||||
final AmbientDisplayNotificationsPreferenceController notificationController = use(
|
use(DoubleTapScreenPreferenceController.class).setConfig(getConfig(context));
|
||||||
AmbientDisplayNotificationsPreferenceController.class);
|
use(PickupGesturePreferenceController.class).setConfig(getConfig(context));
|
||||||
notificationController.setConfig(getConfig(context));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -85,11 +68,6 @@ public class AmbientDisplaySettings extends DashboardFragment {
|
|||||||
return R.xml.ambient_display_settings;
|
return R.xml.ambient_display_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
|
||||||
return buildPreferenceControllers(context, getLifecycle(), getConfig(context));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return MetricsProto.MetricsEvent.AMBIENT_DISPLAY_SETTINGS;
|
return MetricsProto.MetricsEvent.AMBIENT_DISPLAY_SETTINGS;
|
||||||
@@ -107,13 +85,6 @@ public class AmbientDisplaySettings extends DashboardFragment {
|
|||||||
result.add(sir);
|
result.add(sir);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
|
||||||
Context context) {
|
|
||||||
return buildPreferenceControllers(context, null,
|
|
||||||
new AmbientDisplayConfiguration(context));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private AmbientDisplayConfiguration getConfig(Context context) {
|
private AmbientDisplayConfiguration getConfig(Context context) {
|
||||||
|
@@ -82,9 +82,11 @@ public class AssistGestureSettings extends DashboardFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isPageSearchEnabled(Context context) {
|
protected boolean isPageSearchEnabled(Context context) {
|
||||||
return new AssistGestureSettingsPreferenceController(context,
|
AssistGestureSettingsPreferenceController controller =
|
||||||
null /* lifecycle */, null /* key */, false /* assistOnly */)
|
new AssistGestureSettingsPreferenceController(context,
|
||||||
.isAvailable();
|
"gesture_assist_input_summary");
|
||||||
|
controller.setAssistOnly(false);
|
||||||
|
return controller.isAvailable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,6 @@ import android.content.Intent;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
import android.support.v7.preference.PreferenceScreen;
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
import android.support.v7.preference.TwoStatePreference;
|
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -32,11 +31,8 @@ import com.android.settings.overlay.FeatureFactory;
|
|||||||
import com.android.settings.search.DatabaseIndexingUtils;
|
import com.android.settings.search.DatabaseIndexingUtils;
|
||||||
import com.android.settings.search.InlineSwitchPayload;
|
import com.android.settings.search.InlineSwitchPayload;
|
||||||
import com.android.settings.search.ResultPayload;
|
import com.android.settings.search.ResultPayload;
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
import com.android.settingslib.core.lifecycle.events.OnResume;
|
|
||||||
|
|
||||||
public class AssistGestureSettingsPreferenceController extends GesturePreferenceController
|
public class AssistGestureSettingsPreferenceController extends GesturePreferenceController {
|
||||||
implements OnResume {
|
|
||||||
|
|
||||||
private static final String PREF_KEY_VIDEO = "gesture_assist_video";
|
private static final String PREF_KEY_VIDEO = "gesture_assist_video";
|
||||||
|
|
||||||
@@ -55,30 +51,25 @@ public class AssistGestureSettingsPreferenceController extends GesturePreference
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean mAssistOnly;
|
boolean mAssistOnly;
|
||||||
|
|
||||||
public AssistGestureSettingsPreferenceController(Context context, Lifecycle lifecycle,
|
public AssistGestureSettingsPreferenceController(Context context,
|
||||||
String key, boolean assistOnly) {
|
String key) {
|
||||||
super(context, lifecycle);
|
super(context, key);
|
||||||
mFeatureProvider = FeatureFactory.getFactory(context).getAssistGestureFeatureProvider();
|
mFeatureProvider = FeatureFactory.getFactory(context).getAssistGestureFeatureProvider();
|
||||||
mWasAvailable = isAvailable();
|
mWasAvailable = isAvailable();
|
||||||
mAssistGesturePrefKey = key;
|
mAssistGesturePrefKey = key;
|
||||||
mAssistOnly = assistOnly;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public int getAvailabilityStatus() {
|
||||||
if (mAssistOnly) {
|
final boolean isAvailable = mAssistOnly ? mFeatureProvider.isSupported(mContext)
|
||||||
return mFeatureProvider.isSupported(mContext);
|
: mFeatureProvider.isSensorAvailable(mContext);
|
||||||
} else {
|
return isAvailable ? AVAILABLE : DISABLED_UNSUPPORTED;
|
||||||
return mFeatureProvider.isSensorAvailable(mContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayPreference(PreferenceScreen screen) {
|
public void displayPreference(PreferenceScreen screen) {
|
||||||
mScreen = screen;
|
mScreen = screen;
|
||||||
mPreference = screen.findPreference(getPreferenceKey());
|
mPreference = screen.findPreference(getPreferenceKey());
|
||||||
// Call super last or AbstractPreferenceController might remove the preference from the
|
|
||||||
// screen (if !isAvailable()) before we can save a reference to it.
|
|
||||||
super.displayPreference(screen);
|
super.displayPreference(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +83,11 @@ public class AssistGestureSettingsPreferenceController extends GesturePreference
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AssistGestureSettingsPreferenceController setAssistOnly(boolean assistOnly) {
|
||||||
|
mAssistOnly = assistOnly;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private void updatePreference() {
|
private void updatePreference() {
|
||||||
if (mPreference == null) {
|
if (mPreference == null) {
|
||||||
return;
|
return;
|
||||||
@@ -117,31 +113,9 @@ public class AssistGestureSettingsPreferenceController extends GesturePreference
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public boolean setChecked(boolean isChecked) {
|
||||||
boolean isEnabled = isAssistGestureEnabled() && mFeatureProvider.isSupported(mContext);
|
return Settings.Secure.putInt(mContext.getContentResolver(), SECURE_KEY_ASSIST,
|
||||||
|
isChecked ? ON : OFF);
|
||||||
if (!mAssistOnly) {
|
|
||||||
isEnabled = isEnabled || isSilenceGestureEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preference != null) {
|
|
||||||
if (preference instanceof TwoStatePreference) {
|
|
||||||
((TwoStatePreference) preference).setChecked(isSwitchPrefEnabled());
|
|
||||||
} else {
|
|
||||||
preference.setSummary(isEnabled
|
|
||||||
? R.string.gesture_setting_on
|
|
||||||
: R.string.gesture_setting_off);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
||||||
final boolean enabled = (boolean) newValue;
|
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), SECURE_KEY_ASSIST,
|
|
||||||
enabled ? ON : OFF);
|
|
||||||
updateState(preference);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -150,17 +124,22 @@ public class AssistGestureSettingsPreferenceController extends GesturePreference
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPreferenceKey() {
|
public CharSequence getSummary() {
|
||||||
return mAssistGesturePrefKey;
|
boolean isEnabled = isAssistGestureEnabled() && mFeatureProvider.isSupported(mContext);
|
||||||
|
if (!mAssistOnly) {
|
||||||
|
isEnabled = isEnabled || isSilenceGestureEnabled();
|
||||||
|
}
|
||||||
|
return mContext.getText(
|
||||||
|
isEnabled ? R.string.gesture_setting_on : R.string.gesture_setting_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isSwitchPrefEnabled() {
|
public boolean isChecked() {
|
||||||
// Does nothing
|
return Settings.Secure.getInt(mContext.getContentResolver(), SECURE_KEY_ASSIST, OFF) == ON;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
//TODO (b/69808376): Remove result payload
|
||||||
public ResultPayload getResultPayload() {
|
public ResultPayload getResultPayload() {
|
||||||
final Intent intent = DatabaseIndexingUtils.buildSearchResultPageIntent(mContext,
|
final Intent intent = DatabaseIndexingUtils.buildSearchResultPageIntent(mContext,
|
||||||
AssistGestureSettings.class.getName(), mAssistGesturePrefKey,
|
AssistGestureSettings.class.getName(), mAssistGesturePrefKey,
|
||||||
|
@@ -23,13 +23,11 @@ import android.content.Intent;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.annotation.VisibleForTesting;
|
import android.support.annotation.VisibleForTesting;
|
||||||
import android.support.v7.preference.Preference;
|
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.search.DatabaseIndexingUtils;
|
import com.android.settings.search.DatabaseIndexingUtils;
|
||||||
import com.android.settings.search.InlineSwitchPayload;
|
import com.android.settings.search.InlineSwitchPayload;
|
||||||
import com.android.settings.search.ResultPayload;
|
import com.android.settings.search.ResultPayload;
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
public class DoubleTapPowerPreferenceController extends GesturePreferenceController {
|
public class DoubleTapPowerPreferenceController extends GesturePreferenceController {
|
||||||
|
|
||||||
@@ -43,8 +41,8 @@ public class DoubleTapPowerPreferenceController extends GesturePreferenceControl
|
|||||||
|
|
||||||
private final String SECURE_KEY = CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED;
|
private final String SECURE_KEY = CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED;
|
||||||
|
|
||||||
public DoubleTapPowerPreferenceController(Context context, Lifecycle lifecycle, String key) {
|
public DoubleTapPowerPreferenceController(Context context, String key) {
|
||||||
super(context, lifecycle);
|
super(context, key);
|
||||||
mDoubleTapPowerKey = key;
|
mDoubleTapPowerKey = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,8 +57,8 @@ public class DoubleTapPowerPreferenceController extends GesturePreferenceControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public int getAvailabilityStatus() {
|
||||||
return isGestureAvailable(mContext);
|
return isGestureAvailable(mContext) ? AVAILABLE : DISABLED_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,25 +67,20 @@ public class DoubleTapPowerPreferenceController extends GesturePreferenceControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPreferenceKey() {
|
public boolean isChecked() {
|
||||||
return mDoubleTapPowerKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
||||||
boolean enabled = (boolean) newValue;
|
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), SECURE_KEY, enabled ? ON : OFF);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isSwitchPrefEnabled() {
|
|
||||||
final int cameraDisabled = Settings.Secure.getInt(mContext.getContentResolver(),
|
final int cameraDisabled = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
SECURE_KEY, ON);
|
SECURE_KEY, ON);
|
||||||
return cameraDisabled == ON;
|
return cameraDisabled == ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public boolean setChecked(boolean isChecked) {
|
||||||
|
return Settings.Secure.putInt(mContext.getContentResolver(), SECURE_KEY,
|
||||||
|
isChecked ? ON : OFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
//TODO (b/69808376): Remove result payload
|
||||||
public ResultPayload getResultPayload() {
|
public ResultPayload getResultPayload() {
|
||||||
final Intent intent = DatabaseIndexingUtils.buildSearchResultPageIntent(mContext,
|
final Intent intent = DatabaseIndexingUtils.buildSearchResultPageIntent(mContext,
|
||||||
DoubleTapPowerSettings.class.getName(), mDoubleTapPowerKey,
|
DoubleTapPowerSettings.class.getName(), mDoubleTapPowerKey,
|
||||||
|
@@ -26,17 +26,13 @@ import com.android.settings.dashboard.DashboardFragment;
|
|||||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DoubleTapPowerSettings extends DashboardFragment {
|
public class DoubleTapPowerSettings extends DashboardFragment {
|
||||||
|
|
||||||
private static final String TAG = "DoubleTapPower";
|
private static final String TAG = "DoubleTapPower";
|
||||||
private static final String KEY_DOUBLE_TAP_POWER = "gesture_double_tap_power";
|
|
||||||
|
|
||||||
public static final String PREF_KEY_SUGGESTION_COMPLETE =
|
public static final String PREF_KEY_SUGGESTION_COMPLETE =
|
||||||
"pref_double_tap_power_suggestion_complete";
|
"pref_double_tap_power_suggestion_complete";
|
||||||
@@ -65,19 +61,6 @@ public class DoubleTapPowerSettings extends DashboardFragment {
|
|||||||
return R.xml.double_tap_power_settings;
|
return R.xml.double_tap_power_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
|
||||||
return buildPreferenceControllers(context, getLifecycle());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
|
|
||||||
Lifecycle lifecycle) {
|
|
||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
|
||||||
controllers.add(new DoubleTapPowerPreferenceController(context, lifecycle,
|
|
||||||
KEY_DOUBLE_TAP_POWER));
|
|
||||||
return controllers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
new BaseSearchIndexProvider() {
|
new BaseSearchIndexProvider() {
|
||||||
@Override
|
@Override
|
||||||
@@ -87,11 +70,5 @@ public class DoubleTapPowerSettings extends DashboardFragment {
|
|||||||
sir.xmlResId = R.xml.double_tap_power_settings;
|
sir.xmlResId = R.xml.double_tap_power_settings;
|
||||||
return Arrays.asList(sir);
|
return Arrays.asList(sir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
|
||||||
Context context) {
|
|
||||||
return buildPreferenceControllers(context, null /* lifecycle */);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,7 @@ import android.annotation.UserIdInt;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
import android.support.annotation.VisibleForTesting;
|
import android.support.annotation.VisibleForTesting;
|
||||||
@@ -29,7 +30,6 @@ import com.android.settings.R;
|
|||||||
import com.android.settings.search.DatabaseIndexingUtils;
|
import com.android.settings.search.DatabaseIndexingUtils;
|
||||||
import com.android.settings.search.InlineSwitchPayload;
|
import com.android.settings.search.InlineSwitchPayload;
|
||||||
import com.android.settings.search.ResultPayload;
|
import com.android.settings.search.ResultPayload;
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
import static android.provider.Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP;
|
import static android.provider.Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP;
|
||||||
|
|
||||||
@@ -43,18 +43,21 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro
|
|||||||
|
|
||||||
private final String SECURE_KEY = DOZE_PULSE_ON_DOUBLE_TAP;
|
private final String SECURE_KEY = DOZE_PULSE_ON_DOUBLE_TAP;
|
||||||
|
|
||||||
private final AmbientDisplayConfiguration mAmbientConfig;
|
private AmbientDisplayConfiguration mAmbientConfig;
|
||||||
@UserIdInt
|
@UserIdInt
|
||||||
private final int mUserId;
|
private final int mUserId;
|
||||||
|
|
||||||
public DoubleTapScreenPreferenceController(Context context, Lifecycle lifecycle,
|
public DoubleTapScreenPreferenceController(Context context, String key) {
|
||||||
AmbientDisplayConfiguration config, @UserIdInt int userId, String key) {
|
super(context, key);
|
||||||
super(context, lifecycle);
|
mUserId = UserHandle.myUserId();
|
||||||
mAmbientConfig = config;
|
|
||||||
mUserId = userId;
|
|
||||||
mDoubleTapScreenPrefKey = key;
|
mDoubleTapScreenPrefKey = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DoubleTapScreenPreferenceController setConfig(AmbientDisplayConfiguration config) {
|
||||||
|
mAmbientConfig = config;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isSuggestionComplete(Context context, SharedPreferences prefs) {
|
public static boolean isSuggestionComplete(Context context, SharedPreferences prefs) {
|
||||||
return isSuggestionComplete(new AmbientDisplayConfiguration(context), prefs);
|
return isSuggestionComplete(new AmbientDisplayConfiguration(context), prefs);
|
||||||
}
|
}
|
||||||
@@ -67,20 +70,17 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public int getAvailabilityStatus() {
|
||||||
return mAmbientConfig.pulseOnDoubleTapAvailable();
|
if (mAmbientConfig == null) {
|
||||||
|
mAmbientConfig = new AmbientDisplayConfiguration(mContext);
|
||||||
|
}
|
||||||
|
return mAmbientConfig.pulseOnDoubleTapAvailable() ? AVAILABLE : DISABLED_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPreferenceKey() {
|
public boolean setChecked(boolean isChecked) {
|
||||||
return mDoubleTapScreenPrefKey;
|
return Settings.Secure.putInt(mContext.getContentResolver(), SECURE_KEY,
|
||||||
}
|
isChecked ? ON : OFF);
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
||||||
final boolean enabled = (boolean) newValue;
|
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), SECURE_KEY, enabled ? ON : OFF);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -89,11 +89,12 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isSwitchPrefEnabled() {
|
public boolean isChecked() {
|
||||||
return mAmbientConfig.pulseOnDoubleTapEnabled(mUserId);
|
return mAmbientConfig.pulseOnDoubleTapEnabled(mUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
//TODO (b/69808376): Remove result payload
|
||||||
public ResultPayload getResultPayload() {
|
public ResultPayload getResultPayload() {
|
||||||
final Intent intent = DatabaseIndexingUtils.buildSearchResultPageIntent(mContext,
|
final Intent intent = DatabaseIndexingUtils.buildSearchResultPageIntent(mContext,
|
||||||
DoubleTapScreenSettings.class.getName(), mDoubleTapScreenPrefKey,
|
DoubleTapScreenSettings.class.getName(), mDoubleTapScreenPrefKey,
|
||||||
|
@@ -28,8 +28,6 @@ import com.android.settings.dashboard.DashboardFragment;
|
|||||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -38,7 +36,6 @@ import java.util.List;
|
|||||||
public class DoubleTapScreenSettings extends DashboardFragment {
|
public class DoubleTapScreenSettings extends DashboardFragment {
|
||||||
|
|
||||||
private static final String TAG = "DoubleTapScreen";
|
private static final String TAG = "DoubleTapScreen";
|
||||||
private static final String KEY_DOUBLE_TAP_SCREEN = "gesture_double_tap_screen";
|
|
||||||
|
|
||||||
public static final String PREF_KEY_SUGGESTION_COMPLETE =
|
public static final String PREF_KEY_SUGGESTION_COMPLETE =
|
||||||
"pref_double_tap_screen_suggestion_complete";
|
"pref_double_tap_screen_suggestion_complete";
|
||||||
@@ -50,6 +47,9 @@ public class DoubleTapScreenSettings extends DashboardFragment {
|
|||||||
.getSuggestionFeatureProvider(context);
|
.getSuggestionFeatureProvider(context);
|
||||||
SharedPreferences prefs = suggestionFeatureProvider.getSharedPrefs(context);
|
SharedPreferences prefs = suggestionFeatureProvider.getSharedPrefs(context);
|
||||||
prefs.edit().putBoolean(PREF_KEY_SUGGESTION_COMPLETE, true).apply();
|
prefs.edit().putBoolean(PREF_KEY_SUGGESTION_COMPLETE, true).apply();
|
||||||
|
|
||||||
|
use(DoubleTapScreenPreferenceController.class)
|
||||||
|
.setConfig(new AmbientDisplayConfiguration(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -72,20 +72,6 @@ public class DoubleTapScreenSettings extends DashboardFragment {
|
|||||||
return R.string.help_url_double_tap_screen;
|
return R.string.help_url_double_tap_screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
|
||||||
return buildPreferenceControllers(context, getLifecycle());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
|
|
||||||
Lifecycle lifecycle) {
|
|
||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
|
||||||
controllers.add(new DoubleTapScreenPreferenceController(context, lifecycle,
|
|
||||||
new AmbientDisplayConfiguration(context), UserHandle.myUserId(),
|
|
||||||
KEY_DOUBLE_TAP_SCREEN));
|
|
||||||
return controllers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
new BaseSearchIndexProvider() {
|
new BaseSearchIndexProvider() {
|
||||||
@Override
|
@Override
|
||||||
@@ -95,11 +81,5 @@ public class DoubleTapScreenSettings extends DashboardFragment {
|
|||||||
sir.xmlResId = R.xml.double_tap_screen_settings;
|
sir.xmlResId = R.xml.double_tap_screen_settings;
|
||||||
return Arrays.asList(sir);
|
return Arrays.asList(sir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
|
||||||
Context context) {
|
|
||||||
return buildPreferenceControllers(context, null /* lifecycle */);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -26,17 +26,13 @@ import com.android.settings.dashboard.DashboardFragment;
|
|||||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DoubleTwistGestureSettings extends DashboardFragment {
|
public class DoubleTwistGestureSettings extends DashboardFragment {
|
||||||
|
|
||||||
private static final String TAG = "DoubleTwistGesture";
|
private static final String TAG = "DoubleTwistGesture";
|
||||||
private static final String KEY_DOUBLE_TWIST = "gesture_double_twist";
|
|
||||||
|
|
||||||
public static final String PREF_KEY_SUGGESTION_COMPLETE =
|
public static final String PREF_KEY_SUGGESTION_COMPLETE =
|
||||||
"pref_double_twist_suggestion_complete";
|
"pref_double_twist_suggestion_complete";
|
||||||
@@ -65,18 +61,6 @@ public class DoubleTwistGestureSettings extends DashboardFragment {
|
|||||||
return R.xml.double_twist_gesture_settings;
|
return R.xml.double_twist_gesture_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
|
||||||
return buildPreferenceControllers(context, getLifecycle());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
|
|
||||||
Lifecycle lifecycle) {
|
|
||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
|
||||||
controllers.add(new DoubleTwistPreferenceController(context, lifecycle, KEY_DOUBLE_TWIST));
|
|
||||||
return controllers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
new BaseSearchIndexProvider() {
|
new BaseSearchIndexProvider() {
|
||||||
@Override
|
@Override
|
||||||
@@ -86,11 +70,6 @@ public class DoubleTwistGestureSettings extends DashboardFragment {
|
|||||||
sir.xmlResId = R.xml.double_twist_gesture_settings;
|
sir.xmlResId = R.xml.double_twist_gesture_settings;
|
||||||
return Arrays.asList(sir);
|
return Arrays.asList(sir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
|
||||||
return buildPreferenceControllers(context, null /* lifecycle */);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -25,12 +25,10 @@ import android.os.UserHandle;
|
|||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.annotation.VisibleForTesting;
|
import android.support.annotation.VisibleForTesting;
|
||||||
import android.support.v7.preference.Preference;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
public class DoubleTwistPreferenceController extends GesturePreferenceController {
|
public class DoubleTwistPreferenceController extends GesturePreferenceController {
|
||||||
|
|
||||||
@@ -41,8 +39,8 @@ public class DoubleTwistPreferenceController extends GesturePreferenceController
|
|||||||
private final String mDoubleTwistPrefKey;
|
private final String mDoubleTwistPrefKey;
|
||||||
private final UserManager mUserManager;
|
private final UserManager mUserManager;
|
||||||
|
|
||||||
public DoubleTwistPreferenceController(Context context, Lifecycle lifecycle, String key) {
|
public DoubleTwistPreferenceController(Context context, String key) {
|
||||||
super(context, lifecycle);
|
super(context, key);
|
||||||
mDoubleTwistPrefKey = key;
|
mDoubleTwistPrefKey = key;
|
||||||
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||||
}
|
}
|
||||||
@@ -69,8 +67,8 @@ public class DoubleTwistPreferenceController extends GesturePreferenceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public int getAvailabilityStatus() {
|
||||||
return isGestureAvailable(mContext);
|
return isGestureAvailable(mContext) ? AVAILABLE : DISABLED_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -84,9 +82,8 @@ public class DoubleTwistPreferenceController extends GesturePreferenceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean setChecked(boolean isChecked) {
|
||||||
final int enabled = (boolean) newValue ? ON : OFF;
|
setDoubleTwistPreference(mContext, mUserManager, isChecked ? ON : OFF);
|
||||||
setDoubleTwistPreference(mContext, mUserManager, enabled);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,12 +94,13 @@ public class DoubleTwistPreferenceController extends GesturePreferenceController
|
|||||||
final int managedProfileUserId = getManagedProfileId(userManager);
|
final int managedProfileUserId = getManagedProfileId(userManager);
|
||||||
if (managedProfileUserId != UserHandle.USER_NULL) {
|
if (managedProfileUserId != UserHandle.USER_NULL) {
|
||||||
Settings.Secure.putIntForUser(context.getContentResolver(),
|
Settings.Secure.putIntForUser(context.getContentResolver(),
|
||||||
Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, enabled, managedProfileUserId);
|
Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, enabled,
|
||||||
|
managedProfileUserId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isSwitchPrefEnabled() {
|
public boolean isChecked() {
|
||||||
final int doubleTwistEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
|
final int doubleTwistEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, ON);
|
Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, ON);
|
||||||
return doubleTwistEnabled != 0;
|
return doubleTwistEnabled != 0;
|
||||||
|
@@ -24,19 +24,17 @@ import android.support.v7.preference.PreferenceScreen;
|
|||||||
import android.support.v7.preference.TwoStatePreference;
|
import android.support.v7.preference.TwoStatePreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.PreferenceControllerMixin;
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
import com.android.settings.widget.VideoPreference;
|
import com.android.settings.widget.VideoPreference;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||||
import com.android.settingslib.core.lifecycle.events.OnCreate;
|
import com.android.settingslib.core.lifecycle.events.OnCreate;
|
||||||
import com.android.settingslib.core.lifecycle.events.OnPause;
|
import com.android.settingslib.core.lifecycle.events.OnPause;
|
||||||
import com.android.settingslib.core.lifecycle.events.OnResume;
|
import com.android.settingslib.core.lifecycle.events.OnResume;
|
||||||
import com.android.settingslib.core.lifecycle.events.OnSaveInstanceState;
|
import com.android.settingslib.core.lifecycle.events.OnSaveInstanceState;
|
||||||
|
|
||||||
public abstract class GesturePreferenceController extends AbstractPreferenceController
|
public abstract class GesturePreferenceController extends TogglePreferenceController
|
||||||
implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
|
implements Preference.OnPreferenceChangeListener,
|
||||||
LifecycleObserver, OnResume, OnPause, OnCreate, OnSaveInstanceState {
|
LifecycleObserver, OnResume, OnPause, OnCreate, OnSaveInstanceState {
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final String KEY_VIDEO_PAUSED = "key_video_paused";
|
static final String KEY_VIDEO_PAUSED = "key_video_paused";
|
||||||
@@ -45,11 +43,8 @@ public abstract class GesturePreferenceController extends AbstractPreferenceCont
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean mVideoPaused;
|
boolean mVideoPaused;
|
||||||
|
|
||||||
public GesturePreferenceController(Context context, Lifecycle lifecycle) {
|
public GesturePreferenceController(Context context, String key) {
|
||||||
super(context);
|
super(context, key);
|
||||||
if (lifecycle != null) {
|
|
||||||
lifecycle.addObserver(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -63,20 +58,21 @@ public abstract class GesturePreferenceController extends AbstractPreferenceCont
|
|||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference) {
|
public void updateState(Preference preference) {
|
||||||
super.updateState(preference);
|
super.updateState(preference);
|
||||||
final boolean isEnabled = isSwitchPrefEnabled();
|
|
||||||
if (preference != null) {
|
if (preference != null) {
|
||||||
if (preference instanceof TwoStatePreference) {
|
if (!(preference instanceof TwoStatePreference)) {
|
||||||
((TwoStatePreference) preference).setChecked(isEnabled);
|
preference.setSummary(getSummary());
|
||||||
} else {
|
|
||||||
preference.setSummary(isEnabled
|
|
||||||
? R.string.gesture_setting_on
|
|
||||||
: R.string.gesture_setting_off);
|
|
||||||
}
|
}
|
||||||
// Different meanings of "Enabled" for the Preference and Controller.
|
// Different meanings of "Enabled" for the Preference and Controller.
|
||||||
preference.setEnabled(canHandleClicks());
|
preference.setEnabled(canHandleClicks());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getSummary() {
|
||||||
|
return mContext.getText(
|
||||||
|
isChecked() ? R.string.gesture_setting_on : R.string.gesture_setting_off);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
@@ -106,8 +102,6 @@ public abstract class GesturePreferenceController extends AbstractPreferenceCont
|
|||||||
|
|
||||||
protected abstract String getVideoPrefKey();
|
protected abstract String getVideoPrefKey();
|
||||||
|
|
||||||
protected abstract boolean isSwitchPrefEnabled();
|
|
||||||
|
|
||||||
protected boolean canHandleClicks() {
|
protected boolean canHandleClicks() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -65,33 +65,32 @@ public class GestureSettings extends DashboardFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
||||||
if (mAmbientDisplayConfig == null) {
|
return buildPreferenceControllers(context, getLifecycle());
|
||||||
mAmbientDisplayConfig = new AmbientDisplayConfiguration(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
return buildPreferenceControllers(context, getLifecycle(), mAmbientDisplayConfig);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<AbstractPreferenceController> buildPreferenceControllers(
|
static List<AbstractPreferenceController> buildPreferenceControllers(
|
||||||
@NonNull Context context, @Nullable Lifecycle lifecycle,
|
@NonNull Context context, @Nullable Lifecycle lifecycle) {
|
||||||
@NonNull AmbientDisplayConfiguration ambientDisplayConfiguration) {
|
|
||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||||
controllers.add(new AssistGestureSettingsPreferenceController(context, lifecycle,
|
|
||||||
KEY_ASSIST, false /* assistOnly */));
|
|
||||||
controllers.add(new SwipeToNotificationPreferenceController(context, lifecycle,
|
|
||||||
KEY_SWIPE_DOWN));
|
|
||||||
controllers.add(new DoubleTwistPreferenceController(context, lifecycle, KEY_DOUBLE_TWIST));
|
|
||||||
controllers.add(new DoubleTapPowerPreferenceController(context, lifecycle,
|
|
||||||
KEY_DOUBLE_TAP_POWER));
|
|
||||||
controllers.add(new PickupGesturePreferenceController(context, lifecycle,
|
|
||||||
ambientDisplayConfiguration, UserHandle.myUserId(), KEY_PICK_UP));
|
|
||||||
controllers.add(new DoubleTapScreenPreferenceController(context, lifecycle,
|
|
||||||
ambientDisplayConfiguration, UserHandle.myUserId(), KEY_DOUBLE_TAP_SCREEN));
|
|
||||||
controllers.add(new PreventRingingPreferenceController(
|
controllers.add(new PreventRingingPreferenceController(
|
||||||
context, lifecycle, UserHandle.myUserId(), KEY_PREVENT_RINGING));
|
context, lifecycle, UserHandle.myUserId(), KEY_PREVENT_RINGING));
|
||||||
return controllers;
|
return controllers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
use(AssistGestureSettingsPreferenceController.class).setAssistOnly(false);
|
||||||
|
use(PickupGesturePreferenceController.class).setConfig(getConfig(context));
|
||||||
|
use(DoubleTapScreenPreferenceController.class).setConfig(getConfig(context));
|
||||||
|
}
|
||||||
|
|
||||||
|
private AmbientDisplayConfiguration getConfig(Context context) {
|
||||||
|
if (mAmbientDisplayConfig == null) {
|
||||||
|
mAmbientDisplayConfig = new AmbientDisplayConfiguration(context);
|
||||||
|
}
|
||||||
|
return mAmbientDisplayConfig;
|
||||||
|
}
|
||||||
|
|
||||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
new BaseSearchIndexProvider() {
|
new BaseSearchIndexProvider() {
|
||||||
@Override
|
@Override
|
||||||
@@ -105,8 +104,7 @@ public class GestureSettings extends DashboardFragment {
|
|||||||
@Override
|
@Override
|
||||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
public List<AbstractPreferenceController> createPreferenceControllers(
|
||||||
Context context) {
|
Context context) {
|
||||||
return buildPreferenceControllers(context, null,
|
return buildPreferenceControllers(context, null);
|
||||||
new AmbientDisplayConfiguration(context));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -19,6 +19,7 @@ package com.android.settings.gestures;
|
|||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -33,6 +34,7 @@ public class GesturesSettingPreferenceController extends BasePreferenceControlle
|
|||||||
private List<AbstractPreferenceController> mGestureControllers;
|
private List<AbstractPreferenceController> mGestureControllers;
|
||||||
|
|
||||||
private static final String KEY_GESTURES_SETTINGS = "gesture_settings";
|
private static final String KEY_GESTURES_SETTINGS = "gesture_settings";
|
||||||
|
private static final String FAKE_PREF_KEY = "fake_key_only_for_get_available";
|
||||||
|
|
||||||
public GesturesSettingPreferenceController(Context context) {
|
public GesturesSettingPreferenceController(Context context) {
|
||||||
super(context, KEY_GESTURES_SETTINGS);
|
super(context, KEY_GESTURES_SETTINGS);
|
||||||
@@ -42,16 +44,38 @@ public class GesturesSettingPreferenceController extends BasePreferenceControlle
|
|||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
if (mGestureControllers == null) {
|
if (mGestureControllers == null) {
|
||||||
mGestureControllers = GestureSettings.buildPreferenceControllers(mContext,
|
mGestureControllers = buildAllPreferenceControllers(mContext);
|
||||||
null /* lifecycle */, new AmbientDisplayConfiguration(mContext));
|
|
||||||
}
|
}
|
||||||
boolean isAvailable = false;
|
boolean isAvailable = false;
|
||||||
for (AbstractPreferenceController controller : mGestureControllers) {
|
for (AbstractPreferenceController controller : mGestureControllers) {
|
||||||
isAvailable = isAvailable || controller.isAvailable();
|
isAvailable = isAvailable || controller.isAvailable();
|
||||||
}
|
}
|
||||||
return isAvailable
|
return isAvailable ? AVAILABLE : DISABLED_UNSUPPORTED;
|
||||||
? AVAILABLE
|
}
|
||||||
: DISABLED_UNSUPPORTED;
|
|
||||||
|
/**
|
||||||
|
* Get all controllers for their availability status when doing getAvailabilityStatus.
|
||||||
|
* Do not use this method to add controllers into fragment, most of below controllers already
|
||||||
|
* convert to TogglePreferenceController, please register them in xml.
|
||||||
|
* The key is fake because those controllers won't be use to control preference.
|
||||||
|
*/
|
||||||
|
private static List<AbstractPreferenceController> buildAllPreferenceControllers(
|
||||||
|
@NonNull Context context) {
|
||||||
|
final AmbientDisplayConfiguration ambientDisplayConfiguration =
|
||||||
|
new AmbientDisplayConfiguration(context);
|
||||||
|
final List<AbstractPreferenceController> controllers =
|
||||||
|
GestureSettings.buildPreferenceControllers(context, null);
|
||||||
|
|
||||||
|
controllers.add(new AssistGestureSettingsPreferenceController(context, FAKE_PREF_KEY)
|
||||||
|
.setAssistOnly(false));
|
||||||
|
controllers.add(new SwipeToNotificationPreferenceController(context, FAKE_PREF_KEY));
|
||||||
|
controllers.add(new DoubleTwistPreferenceController(context, FAKE_PREF_KEY));
|
||||||
|
controllers.add(new DoubleTapPowerPreferenceController(context, FAKE_PREF_KEY));
|
||||||
|
controllers.add(new PickupGesturePreferenceController(context, FAKE_PREF_KEY)
|
||||||
|
.setConfig(ambientDisplayConfiguration));
|
||||||
|
controllers.add(new DoubleTapScreenPreferenceController(context, FAKE_PREF_KEY)
|
||||||
|
.setConfig(ambientDisplayConfiguration));
|
||||||
|
return controllers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -22,8 +22,8 @@ import android.annotation.UserIdInt;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.v7.preference.Preference;
|
|
||||||
import android.support.annotation.VisibleForTesting;
|
import android.support.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||||
@@ -31,7 +31,6 @@ import com.android.settings.R;
|
|||||||
import com.android.settings.search.DatabaseIndexingUtils;
|
import com.android.settings.search.DatabaseIndexingUtils;
|
||||||
import com.android.settings.search.InlineSwitchPayload;
|
import com.android.settings.search.InlineSwitchPayload;
|
||||||
import com.android.settings.search.ResultPayload;
|
import com.android.settings.search.ResultPayload;
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
public class PickupGesturePreferenceController extends GesturePreferenceController {
|
public class PickupGesturePreferenceController extends GesturePreferenceController {
|
||||||
|
|
||||||
@@ -43,18 +42,21 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll
|
|||||||
|
|
||||||
private final String SECURE_KEY = DOZE_PULSE_ON_PICK_UP;
|
private final String SECURE_KEY = DOZE_PULSE_ON_PICK_UP;
|
||||||
|
|
||||||
private final AmbientDisplayConfiguration mAmbientConfig;
|
private AmbientDisplayConfiguration mAmbientConfig;
|
||||||
@UserIdInt
|
@UserIdInt
|
||||||
private final int mUserId;
|
private final int mUserId;
|
||||||
|
|
||||||
public PickupGesturePreferenceController(Context context, Lifecycle lifecycle,
|
public PickupGesturePreferenceController(Context context, String key) {
|
||||||
AmbientDisplayConfiguration config, @UserIdInt int userId, String key) {
|
super(context, key);
|
||||||
super(context, lifecycle);
|
mUserId = UserHandle.myUserId();
|
||||||
mAmbientConfig = config;
|
|
||||||
mUserId = userId;
|
|
||||||
mPickUpPrefKey = key;
|
mPickUpPrefKey = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PickupGesturePreferenceController setConfig(AmbientDisplayConfiguration config) {
|
||||||
|
mAmbientConfig = config;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isSuggestionComplete(Context context, SharedPreferences prefs) {
|
public static boolean isSuggestionComplete(Context context, SharedPreferences prefs) {
|
||||||
AmbientDisplayConfiguration ambientConfig = new AmbientDisplayConfiguration(context);
|
AmbientDisplayConfiguration ambientConfig = new AmbientDisplayConfiguration(context);
|
||||||
return prefs.getBoolean(PickupGestureSettings.PREF_KEY_SUGGESTION_COMPLETE, false)
|
return prefs.getBoolean(PickupGestureSettings.PREF_KEY_SUGGESTION_COMPLETE, false)
|
||||||
@@ -62,8 +64,11 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public int getAvailabilityStatus() {
|
||||||
return mAmbientConfig.pulseOnPickupAvailable();
|
if (mAmbientConfig == null) {
|
||||||
|
mAmbientConfig = new AmbientDisplayConfiguration(mContext);
|
||||||
|
}
|
||||||
|
return mAmbientConfig.pulseOnPickupAvailable() ? AVAILABLE : DISABLED_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -72,7 +77,7 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isSwitchPrefEnabled() {
|
public boolean isChecked() {
|
||||||
return mAmbientConfig.pulseOnPickupEnabled(mUserId);
|
return mAmbientConfig.pulseOnPickupEnabled(mUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,11 +87,9 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean setChecked(boolean isChecked) {
|
||||||
final boolean enabled = (boolean) newValue;
|
return Settings.Secure.putInt(mContext.getContentResolver(), SECURE_KEY,
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
isChecked ? ON : OFF);
|
||||||
SECURE_KEY, enabled ? ON : OFF);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -18,7 +18,6 @@ package com.android.settings.gestures;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.provider.SearchIndexableResource;
|
import android.provider.SearchIndexableResource;
|
||||||
|
|
||||||
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||||
@@ -28,17 +27,13 @@ import com.android.settings.dashboard.DashboardFragment;
|
|||||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PickupGestureSettings extends DashboardFragment {
|
public class PickupGestureSettings extends DashboardFragment {
|
||||||
|
|
||||||
private static final String TAG = "PickupGestureSettings";
|
private static final String TAG = "PickupGestureSettings";
|
||||||
private static final String KEY_PICK_UP = "gesture_pick_up";
|
|
||||||
|
|
||||||
public static final String PREF_KEY_SUGGESTION_COMPLETE =
|
public static final String PREF_KEY_SUGGESTION_COMPLETE =
|
||||||
"pref_pickup_gesture_suggestion_complete";
|
"pref_pickup_gesture_suggestion_complete";
|
||||||
@@ -50,6 +45,9 @@ public class PickupGestureSettings extends DashboardFragment {
|
|||||||
.getSuggestionFeatureProvider(context);
|
.getSuggestionFeatureProvider(context);
|
||||||
SharedPreferences prefs = suggestionFeatureProvider.getSharedPrefs(context);
|
SharedPreferences prefs = suggestionFeatureProvider.getSharedPrefs(context);
|
||||||
prefs.edit().putBoolean(PREF_KEY_SUGGESTION_COMPLETE, true).apply();
|
prefs.edit().putBoolean(PREF_KEY_SUGGESTION_COMPLETE, true).apply();
|
||||||
|
|
||||||
|
use(PickupGesturePreferenceController.class)
|
||||||
|
.setConfig(new AmbientDisplayConfiguration(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -72,19 +70,6 @@ public class PickupGestureSettings extends DashboardFragment {
|
|||||||
return R.string.help_url_pickup_gesture;
|
return R.string.help_url_pickup_gesture;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
|
||||||
return buildPreferenceControllers(context, getLifecycle());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
|
|
||||||
Lifecycle lifecycle) {
|
|
||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
|
||||||
controllers.add(new PickupGesturePreferenceController(context, lifecycle,
|
|
||||||
new AmbientDisplayConfiguration(context), UserHandle.myUserId(), KEY_PICK_UP));
|
|
||||||
return controllers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
new BaseSearchIndexProvider() {
|
new BaseSearchIndexProvider() {
|
||||||
@Override
|
@Override
|
||||||
@@ -94,12 +79,6 @@ public class PickupGestureSettings extends DashboardFragment {
|
|||||||
sir.xmlResId = R.xml.pick_up_gesture_settings;
|
sir.xmlResId = R.xml.pick_up_gesture_settings;
|
||||||
return Arrays.asList(sir);
|
return Arrays.asList(sir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
|
||||||
Context context) {
|
|
||||||
return buildPreferenceControllers(context, null /* lifecycle */);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -21,10 +21,8 @@ import static android.provider.Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.v7.preference.Preference;
|
|
||||||
|
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
public class SwipeToNotificationPreferenceController extends GesturePreferenceController {
|
public class SwipeToNotificationPreferenceController extends GesturePreferenceController {
|
||||||
|
|
||||||
@@ -32,14 +30,11 @@ public class SwipeToNotificationPreferenceController extends GesturePreferenceCo
|
|||||||
private static final int OFF = 0;
|
private static final int OFF = 0;
|
||||||
|
|
||||||
private static final String PREF_KEY_VIDEO = "gesture_swipe_down_fingerprint_video";
|
private static final String PREF_KEY_VIDEO = "gesture_swipe_down_fingerprint_video";
|
||||||
private final String mSwipeDownFingerPrefKey;
|
|
||||||
|
|
||||||
private static final String SECURE_KEY = SYSTEM_NAVIGATION_KEYS_ENABLED;
|
private static final String SECURE_KEY = SYSTEM_NAVIGATION_KEYS_ENABLED;
|
||||||
|
|
||||||
public SwipeToNotificationPreferenceController(Context context, Lifecycle lifecycle,
|
public SwipeToNotificationPreferenceController(Context context, String key) {
|
||||||
String key) {
|
super(context, key);
|
||||||
super(context, lifecycle);
|
|
||||||
mSwipeDownFingerPrefKey = key;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSuggestionComplete(Context context, SharedPreferences prefs) {
|
public static boolean isSuggestionComplete(Context context, SharedPreferences prefs) {
|
||||||
@@ -54,29 +49,24 @@ public class SwipeToNotificationPreferenceController extends GesturePreferenceCo
|
|||||||
.getBoolean(com.android.internal.R.bool.config_supportSystemNavigationKeys);
|
.getBoolean(com.android.internal.R.bool.config_supportSystemNavigationKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPreferenceKey() {
|
|
||||||
return mSwipeDownFingerPrefKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getVideoPrefKey() {
|
protected String getVideoPrefKey() {
|
||||||
return PREF_KEY_VIDEO;
|
return PREF_KEY_VIDEO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public int getAvailabilityStatus() {
|
||||||
return SwipeToNotificationPreferenceController.isAvailable(mContext);
|
return isAvailable(mContext) ? AVAILABLE : DISABLED_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean setChecked(boolean isChecked) {
|
||||||
setSwipeToNotification(mContext, (boolean) newValue);
|
setSwipeToNotification(mContext, isChecked);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isSwitchPrefEnabled() {
|
public boolean isChecked() {
|
||||||
return isSwipeToNotificationOn(mContext);
|
return isSwipeToNotificationOn(mContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,10 +26,7 @@ import com.android.settings.dashboard.DashboardFragment;
|
|||||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -37,8 +34,6 @@ public class SwipeToNotificationSettings extends DashboardFragment {
|
|||||||
|
|
||||||
private static final String TAG = "SwipeToNotifSettings";
|
private static final String TAG = "SwipeToNotifSettings";
|
||||||
|
|
||||||
private static final String KEY = "gesture_swipe_down_fingerprint";
|
|
||||||
|
|
||||||
public static final String PREF_KEY_SUGGESTION_COMPLETE =
|
public static final String PREF_KEY_SUGGESTION_COMPLETE =
|
||||||
"pref_swipe_to_notification_suggestion_complete";
|
"pref_swipe_to_notification_suggestion_complete";
|
||||||
|
|
||||||
@@ -66,18 +61,6 @@ public class SwipeToNotificationSettings extends DashboardFragment {
|
|||||||
return R.xml.swipe_to_notification_settings;
|
return R.xml.swipe_to_notification_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
|
|
||||||
return buildPreferenceControllers(context, getLifecycle());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
|
|
||||||
Lifecycle lifecycle) {
|
|
||||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
|
||||||
controllers.add(new SwipeToNotificationPreferenceController(context, lifecycle, KEY));
|
|
||||||
return controllers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
new BaseSearchIndexProvider() {
|
new BaseSearchIndexProvider() {
|
||||||
@Override
|
@Override
|
||||||
@@ -87,11 +70,5 @@ public class SwipeToNotificationSettings extends DashboardFragment {
|
|||||||
sir.xmlResId = R.xml.swipe_to_notification_settings;
|
sir.xmlResId = R.xml.swipe_to_notification_settings;
|
||||||
return Arrays.asList(sir);
|
return Arrays.asList(sir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AbstractPreferenceController> createPreferenceControllers(
|
|
||||||
Context context) {
|
|
||||||
return buildPreferenceControllers(context, null /* lifecycle */);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -106,8 +106,6 @@ public class ConfigureNotificationSettings extends DashboardFragment {
|
|||||||
}
|
}
|
||||||
controllers.add(new RecentNotifyingAppsPreferenceController(
|
controllers.add(new RecentNotifyingAppsPreferenceController(
|
||||||
context, new NotificationBackend(), app, host));
|
context, new NotificationBackend(), app, host));
|
||||||
controllers.add(new SwipeToNotificationPreferenceController(context, lifecycle,
|
|
||||||
KEY_SWIPE_DOWN));
|
|
||||||
controllers.add(badgeController);
|
controllers.add(badgeController);
|
||||||
controllers.add(pulseController);
|
controllers.add(pulseController);
|
||||||
controllers.add(lockScreenNotificationController);
|
controllers.add(lockScreenNotificationController);
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
com.android.settings.testutils.FakeToggleController
|
com.android.settings.testutils.FakeToggleController
|
||||||
com.android.settings.testutils.FakeSliderController
|
com.android.settings.testutils.FakeSliderController
|
@@ -24,6 +24,8 @@ import static org.mockito.Mockito.verify;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.android.settings.gestures.DoubleTapScreenPreferenceController;
|
||||||
|
import com.android.settings.gestures.PickupGesturePreferenceController;
|
||||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
|
|
||||||
@@ -48,18 +50,48 @@ public class AmbientDisplaySettingsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onAttach_shouldInvokeSetters() {
|
public void onAttach_alwaysOn_shouldInvokeSetters() {
|
||||||
final AmbientDisplayAlwaysOnPreferenceController controller = mock(
|
final AmbientDisplayAlwaysOnPreferenceController controller = spy(
|
||||||
AmbientDisplayAlwaysOnPreferenceController.class);
|
new AmbientDisplayAlwaysOnPreferenceController(mContext, "key"));
|
||||||
doReturn(controller).when(mTestFragment).use(
|
doReturn(controller).when(mTestFragment).use(
|
||||||
AmbientDisplayAlwaysOnPreferenceController.class);
|
AmbientDisplayAlwaysOnPreferenceController.class);
|
||||||
|
|
||||||
mTestFragment.onAttach(mContext);
|
mTestFragment.onAttach(mContext);
|
||||||
|
|
||||||
verify(controller).setConfig(any());
|
verify(controller).setConfig(any());
|
||||||
verify(controller).setCallback(any());
|
verify(controller).setCallback(any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onAttach_notifications_shouldInvokeSetters() {
|
||||||
|
final AmbientDisplayNotificationsPreferenceController controller = spy(
|
||||||
|
new AmbientDisplayNotificationsPreferenceController(mContext, "key"));
|
||||||
|
doReturn(controller).when(mTestFragment).use(
|
||||||
|
AmbientDisplayNotificationsPreferenceController.class);
|
||||||
|
|
||||||
|
mTestFragment.onAttach(mContext);
|
||||||
|
verify(controller).setConfig(any());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onAttach_doubleTap_shouldInvokeSetters() {
|
||||||
|
final DoubleTapScreenPreferenceController controller = spy(
|
||||||
|
new DoubleTapScreenPreferenceController(mContext, "key"));
|
||||||
|
doReturn(controller).when(mTestFragment).use(DoubleTapScreenPreferenceController.class);
|
||||||
|
|
||||||
|
mTestFragment.onAttach(mContext);
|
||||||
|
verify(controller).setConfig(any());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onAttach_pickUp_shouldInvokeSetters() {
|
||||||
|
final PickupGesturePreferenceController controller = spy(
|
||||||
|
new PickupGesturePreferenceController(mContext, "key"));
|
||||||
|
doReturn(controller).when(mTestFragment).use(PickupGesturePreferenceController.class);
|
||||||
|
|
||||||
|
mTestFragment.onAttach(mContext);
|
||||||
|
verify(controller).setConfig(any());
|
||||||
|
}
|
||||||
|
|
||||||
public static class TestFragment extends AmbientDisplaySettings {
|
public static class TestFragment extends AmbientDisplaySettings {
|
||||||
@Override
|
@Override
|
||||||
protected <T extends AbstractPreferenceController> T use(Class<T> clazz) {
|
protected <T extends AbstractPreferenceController> T use(Class<T> clazz) {
|
||||||
|
@@ -55,8 +55,8 @@ public class AssistGestureSettingsPreferenceControllerTest {
|
|||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mFactory = FakeFeatureFactory.setupForTest();
|
mFactory = FakeFeatureFactory.setupForTest();
|
||||||
mController =
|
mController = new AssistGestureSettingsPreferenceController(mContext, KEY_ASSIST);
|
||||||
new AssistGestureSettingsPreferenceController(mContext, null, KEY_ASSIST, false);
|
mController.setAssistOnly(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -76,8 +76,8 @@ public class AssistGestureSettingsPreferenceControllerTest {
|
|||||||
public void testPreferenceController_ProperResultPayloadType() {
|
public void testPreferenceController_ProperResultPayloadType() {
|
||||||
final Context context = RuntimeEnvironment.application;
|
final Context context = RuntimeEnvironment.application;
|
||||||
AssistGestureSettingsPreferenceController controller =
|
AssistGestureSettingsPreferenceController controller =
|
||||||
new AssistGestureSettingsPreferenceController(context, null /* lifecycle */,
|
new AssistGestureSettingsPreferenceController(context, KEY_ASSIST);
|
||||||
KEY_ASSIST, false /* assistOnly */);
|
controller.setAssistOnly(false);
|
||||||
ResultPayload payload = controller.getResultPayload();
|
ResultPayload payload = controller.getResultPayload();
|
||||||
assertThat(payload).isInstanceOf(InlineSwitchPayload.class);
|
assertThat(payload).isInstanceOf(InlineSwitchPayload.class);
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,7 @@ public class DoubleTapPowerPreferenceControllerTest {
|
|||||||
public void setUp() {
|
public void setUp() {
|
||||||
mContext = RuntimeEnvironment.application;
|
mContext = RuntimeEnvironment.application;
|
||||||
mContentResolver = mContext.getContentResolver();
|
mContentResolver = mContext.getContentResolver();
|
||||||
mController = new DoubleTapPowerPreferenceController(mContext, null, KEY_DOUBLE_TAP_POWER);
|
mController = new DoubleTapPowerPreferenceController(mContext, KEY_DOUBLE_TAP_POWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
@@ -81,28 +81,27 @@ public class DoubleTapPowerPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSwitchEnabled_configIsNotSet_shouldReturnTrue() {
|
public void testIsChecked_configIsNotSet_shouldReturnTrue() {
|
||||||
// Set the setting to be enabled.
|
// Set the setting to be enabled.
|
||||||
Settings.System.putInt(mContentResolver, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, ON);
|
Settings.System.putInt(mContentResolver, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, ON);
|
||||||
mController = new DoubleTapPowerPreferenceController(mContext, null, KEY_DOUBLE_TAP_POWER);
|
mController = new DoubleTapPowerPreferenceController(mContext, KEY_DOUBLE_TAP_POWER);
|
||||||
|
|
||||||
assertThat(mController.isSwitchPrefEnabled()).isTrue();
|
assertThat(mController.isChecked()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSwitchEnabled_configIsSet_shouldReturnFalse() {
|
public void testIsChecked_configIsSet_shouldReturnFalse() {
|
||||||
// Set the setting to be disabled.
|
// Set the setting to be disabled.
|
||||||
Settings.System.putInt(mContentResolver, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, OFF);
|
Settings.System.putInt(mContentResolver, CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, OFF);
|
||||||
mController = new DoubleTapPowerPreferenceController(mContext, null, KEY_DOUBLE_TAP_POWER);
|
mController = new DoubleTapPowerPreferenceController(mContext, KEY_DOUBLE_TAP_POWER);
|
||||||
|
|
||||||
assertThat(mController.isSwitchPrefEnabled()).isFalse();
|
assertThat(mController.isChecked()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPreferenceController_ProperResultPayloadType() {
|
public void testPreferenceController_ProperResultPayloadType() {
|
||||||
DoubleTapPowerPreferenceController controller =
|
DoubleTapPowerPreferenceController controller =
|
||||||
new DoubleTapPowerPreferenceController(mContext, null /* lifecycle */,
|
new DoubleTapPowerPreferenceController(mContext, KEY_DOUBLE_TAP_POWER);
|
||||||
KEY_DOUBLE_TAP_POWER);
|
|
||||||
ResultPayload payload = controller.getResultPayload();
|
ResultPayload payload = controller.getResultPayload();
|
||||||
assertThat(payload).isInstanceOf(InlineSwitchPayload.class);
|
assertThat(payload).isInstanceOf(InlineSwitchPayload.class);
|
||||||
}
|
}
|
||||||
|
@@ -56,8 +56,8 @@ public class DoubleTapScreenPreferenceControllerTest {
|
|||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mController = new DoubleTapScreenPreferenceController(
|
mController = new DoubleTapScreenPreferenceController(mContext, KEY_DOUBLE_TAP_SCREEN);
|
||||||
mContext, null, mAmbientDisplayConfiguration, 0, KEY_DOUBLE_TAP_SCREEN);
|
mController.setConfig(mAmbientDisplayConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -75,26 +75,26 @@ public class DoubleTapScreenPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSwitchEnabled_configIsSet_shouldReturnTrue() {
|
public void testIsChecked_configIsSet_shouldReturnTrue() {
|
||||||
// Set the setting to be enabled.
|
// Set the setting to be enabled.
|
||||||
when(mAmbientDisplayConfiguration.pulseOnDoubleTapEnabled(anyInt())).thenReturn(true);
|
when(mAmbientDisplayConfiguration.pulseOnDoubleTapEnabled(anyInt())).thenReturn(true);
|
||||||
|
|
||||||
assertThat(mController.isSwitchPrefEnabled()).isTrue();
|
assertThat(mController.isChecked()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSwitchEnabled_configIsNotSet_shouldReturnFalse() {
|
public void testIsChecked_configIsNotSet_shouldReturnFalse() {
|
||||||
when(mAmbientDisplayConfiguration.pulseOnDoubleTapEnabled(anyInt())).thenReturn(false);
|
when(mAmbientDisplayConfiguration.pulseOnDoubleTapEnabled(anyInt())).thenReturn(false);
|
||||||
|
|
||||||
assertThat(mController.isSwitchPrefEnabled()).isFalse();
|
assertThat(mController.isChecked()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPreferenceController_ProperResultPayloadType() {
|
public void testPreferenceController_ProperResultPayloadType() {
|
||||||
final Context context = RuntimeEnvironment.application;
|
final Context context = RuntimeEnvironment.application;
|
||||||
DoubleTapScreenPreferenceController controller =
|
DoubleTapScreenPreferenceController controller =
|
||||||
new DoubleTapScreenPreferenceController(context, null /* lifecycle */,
|
new DoubleTapScreenPreferenceController(context, KEY_DOUBLE_TAP_SCREEN);
|
||||||
mAmbientDisplayConfiguration, 0 /* userid */, KEY_DOUBLE_TAP_SCREEN);
|
controller.setConfig(mAmbientDisplayConfiguration);
|
||||||
ResultPayload payload = controller.getResultPayload();
|
ResultPayload payload = controller.getResultPayload();
|
||||||
assertThat(payload).isInstanceOf(InlineSwitchPayload.class);
|
assertThat(payload).isInstanceOf(InlineSwitchPayload.class);
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ public class DoubleTwistPreferenceControllerTest {
|
|||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mock(UserManager.class));
|
when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mock(UserManager.class));
|
||||||
mController = new DoubleTwistPreferenceController(mContext, null, KEY_DOUBLE_TWIST);
|
mController = new DoubleTwistPreferenceController(mContext, KEY_DOUBLE_TWIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
@@ -120,7 +120,7 @@ public class DoubleTwistPreferenceControllerTest {
|
|||||||
Settings.Secure.putIntForUser(
|
Settings.Secure.putIntForUser(
|
||||||
null, Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 0, managedId);
|
null, Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 0, managedId);
|
||||||
DoubleTwistPreferenceController controller =
|
DoubleTwistPreferenceController controller =
|
||||||
spy(new DoubleTwistPreferenceController(mContext, null, KEY_DOUBLE_TWIST));
|
spy(new DoubleTwistPreferenceController(mContext, KEY_DOUBLE_TWIST));
|
||||||
ShadowDoubleTwistPreferenceController.setManagedProfileId(managedId);
|
ShadowDoubleTwistPreferenceController.setManagedProfileId(managedId);
|
||||||
|
|
||||||
// enable the gesture
|
// enable the gesture
|
||||||
@@ -135,24 +135,24 @@ public class DoubleTwistPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSwitchEnabled_configIsSet_shouldReturnTrue() {
|
public void testIsChecked_configIsSet_shouldReturnTrue() {
|
||||||
// Set the setting to be enabled.
|
// Set the setting to be enabled.
|
||||||
final Context context = RuntimeEnvironment.application;
|
final Context context = RuntimeEnvironment.application;
|
||||||
Settings.System.putInt(context.getContentResolver(),
|
Settings.System.putInt(context.getContentResolver(),
|
||||||
Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 1);
|
Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 1);
|
||||||
mController = new DoubleTwistPreferenceController(context, null, KEY_DOUBLE_TWIST);
|
mController = new DoubleTwistPreferenceController(context, KEY_DOUBLE_TWIST);
|
||||||
|
|
||||||
assertThat(mController.isSwitchPrefEnabled()).isTrue();
|
assertThat(mController.isChecked()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSwitchEnabled_configIsNotSet_shouldReturnFalse() {
|
public void testIsChecked_configIsNotSet_shouldReturnFalse() {
|
||||||
// Set the setting to be disabled.
|
// Set the setting to be disabled.
|
||||||
final Context context = RuntimeEnvironment.application;
|
final Context context = RuntimeEnvironment.application;
|
||||||
Settings.System.putInt(context.getContentResolver(),
|
Settings.System.putInt(context.getContentResolver(),
|
||||||
Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 0);
|
Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 0);
|
||||||
mController = new DoubleTwistPreferenceController(context, null, KEY_DOUBLE_TWIST);
|
mController = new DoubleTwistPreferenceController(context, KEY_DOUBLE_TWIST);
|
||||||
|
|
||||||
assertThat(mController.isSwitchPrefEnabled()).isFalse();
|
assertThat(mController.isChecked()).isFalse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,9 @@
|
|||||||
package com.android.settings.gestures;
|
package com.android.settings.gestures;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import static junit.framework.Assert.assertEquals;
|
||||||
|
|
||||||
import static org.mockito.Matchers.anyString;
|
import static org.mockito.Matchers.anyString;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.reset;
|
import static org.mockito.Mockito.reset;
|
||||||
@@ -31,7 +34,6 @@ import android.support.v7.preference.TwoStatePreference;
|
|||||||
|
|
||||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||||
import com.android.settings.widget.VideoPreference;
|
import com.android.settings.widget.VideoPreference;
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -49,7 +51,6 @@ public class GesturePreferenceControllerTest {
|
|||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
private PreferenceScreen mScreen;
|
private PreferenceScreen mScreen;
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
private Lifecycle mLifecycle;
|
|
||||||
|
|
||||||
private TestPrefController mController;
|
private TestPrefController mController;
|
||||||
private Preference mPreference;
|
private Preference mPreference;
|
||||||
@@ -57,7 +58,7 @@ public class GesturePreferenceControllerTest {
|
|||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mController = new TestPrefController(mContext, mLifecycle);
|
mController = new TestPrefController(mContext, "testKey");
|
||||||
mPreference = new Preference(RuntimeEnvironment.application);
|
mPreference = new Preference(RuntimeEnvironment.application);
|
||||||
mPreference.setKey(mController.getPreferenceKey());
|
mPreference.setKey(mController.getPreferenceKey());
|
||||||
when(mScreen.findPreference(mPreference.getKey())).thenReturn(mPreference);
|
when(mScreen.findPreference(mPreference.getKey())).thenReturn(mPreference);
|
||||||
@@ -187,7 +188,8 @@ public class GesturePreferenceControllerTest {
|
|||||||
mController.updateState(preference);
|
mController.updateState(preference);
|
||||||
|
|
||||||
// Verify summary is set to off (as setting is disabled).
|
// Verify summary is set to off (as setting is disabled).
|
||||||
verify(preference).setSummary(com.android.settings.R.string.gesture_setting_off);
|
assertThat(preference.getSummary()).isEqualTo(
|
||||||
|
mContext.getString(com.android.settings.R.string.gesture_setting_off));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestPrefController extends GesturePreferenceController {
|
private class TestPrefController extends GesturePreferenceController {
|
||||||
@@ -196,18 +198,13 @@ public class GesturePreferenceControllerTest {
|
|||||||
boolean mIsPrefEnabled;
|
boolean mIsPrefEnabled;
|
||||||
|
|
||||||
private TestPrefController(Context context,
|
private TestPrefController(Context context,
|
||||||
Lifecycle lifecycle) {
|
String key) {
|
||||||
super(context, lifecycle);
|
super(context, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAvailable() {
|
public int getAvailabilityStatus() {
|
||||||
return mIsPrefAvailable;
|
return mIsPrefAvailable ? AVAILABLE : DISABLED_UNSUPPORTED;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPreferenceKey() {
|
|
||||||
return "testKey";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -216,12 +213,12 @@ public class GesturePreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isSwitchPrefEnabled() {
|
public boolean isChecked() {
|
||||||
return mIsPrefEnabled;
|
return mIsPrefEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean setChecked(boolean isChecked) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -57,8 +57,8 @@ public class PickupGesturePreferenceControllerTest {
|
|||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mController = new PickupGesturePreferenceController(
|
mController = new PickupGesturePreferenceController(mContext, KEY_PICK_UP);
|
||||||
mContext, null, mAmbientDisplayConfiguration, 0, KEY_PICK_UP);
|
mController.setConfig(mAmbientDisplayConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -76,19 +76,19 @@ public class PickupGesturePreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSwitchEnabled_configIsSet_shouldReturnTrue() {
|
public void testIsChecked_configIsSet_shouldReturnTrue() {
|
||||||
// Set the setting to be enabled.
|
// Set the setting to be enabled.
|
||||||
when(mAmbientDisplayConfiguration.pulseOnPickupEnabled(anyInt())).thenReturn(true);
|
when(mAmbientDisplayConfiguration.pulseOnPickupEnabled(anyInt())).thenReturn(true);
|
||||||
|
|
||||||
assertThat(mController.isSwitchPrefEnabled()).isTrue();
|
assertThat(mController.isChecked()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSwitchEnabled_configIsNotSet_shouldReturnFalse() {
|
public void testIsChecked_configIsNotSet_shouldReturnFalse() {
|
||||||
// Set the setting to be disabled.
|
// Set the setting to be disabled.
|
||||||
when(mAmbientDisplayConfiguration.pulseOnPickupEnabled(anyInt())).thenReturn(false);
|
when(mAmbientDisplayConfiguration.pulseOnPickupEnabled(anyInt())).thenReturn(false);
|
||||||
|
|
||||||
assertThat(mController.isSwitchPrefEnabled()).isFalse();
|
assertThat(mController.isChecked()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -111,8 +111,8 @@ public class PickupGesturePreferenceControllerTest {
|
|||||||
public void testPreferenceController_ProperResultPayloadType() {
|
public void testPreferenceController_ProperResultPayloadType() {
|
||||||
final Context context = RuntimeEnvironment.application;
|
final Context context = RuntimeEnvironment.application;
|
||||||
PickupGesturePreferenceController controller =
|
PickupGesturePreferenceController controller =
|
||||||
new PickupGesturePreferenceController(
|
new PickupGesturePreferenceController(context, KEY_PICK_UP);
|
||||||
context, null, mAmbientDisplayConfiguration, 0, KEY_PICK_UP);
|
controller.setConfig(mAmbientDisplayConfiguration);
|
||||||
ResultPayload payload = controller.getResultPayload();
|
ResultPayload payload = controller.getResultPayload();
|
||||||
assertThat(payload).isInstanceOf(InlineSwitchPayload.class);
|
assertThat(payload).isInstanceOf(InlineSwitchPayload.class);
|
||||||
}
|
}
|
||||||
|
@@ -53,7 +53,7 @@ public class SwipeToNotificationPreferenceControllerTest {
|
|||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mController = new SwipeToNotificationPreferenceController(mContext, null, KEY_SWIPE_DOWN);
|
mController = new SwipeToNotificationPreferenceController(mContext, KEY_SWIPE_DOWN);
|
||||||
when(mContext.getPackageManager()).thenReturn(mPackageManager);
|
when(mContext.getPackageManager()).thenReturn(mPackageManager);
|
||||||
when(mContext.getSystemService(Context.FINGERPRINT_SERVICE))
|
when(mContext.getSystemService(Context.FINGERPRINT_SERVICE))
|
||||||
.thenReturn(mFingerprintManager);
|
.thenReturn(mFingerprintManager);
|
||||||
@@ -93,27 +93,27 @@ public class SwipeToNotificationPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSwitchEnabled_configIsSet_shouldReturnTrue() {
|
public void testIsChecked_configIsSet_shouldReturnTrue() {
|
||||||
stubFingerprintSupported(true);
|
stubFingerprintSupported(true);
|
||||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||||
// Set the setting to be enabled.
|
// Set the setting to be enabled.
|
||||||
final Context context = RuntimeEnvironment.application;
|
final Context context = RuntimeEnvironment.application;
|
||||||
Settings.System.putInt(context.getContentResolver(), SYSTEM_NAVIGATION_KEYS_ENABLED, 1);
|
Settings.System.putInt(context.getContentResolver(), SYSTEM_NAVIGATION_KEYS_ENABLED, 1);
|
||||||
mController = new SwipeToNotificationPreferenceController(context, null, KEY_SWIPE_DOWN);
|
mController = new SwipeToNotificationPreferenceController(context, KEY_SWIPE_DOWN);
|
||||||
|
|
||||||
assertThat(mController.isSwitchPrefEnabled()).isTrue();
|
assertThat(mController.isChecked()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSwitchEnabled_configIsNotSet_shouldReturnFalse() {
|
public void testIsChecked_configIsNotSet_shouldReturnFalse() {
|
||||||
stubFingerprintSupported(true);
|
stubFingerprintSupported(true);
|
||||||
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
|
||||||
// Set the setting to be disabled.
|
// Set the setting to be disabled.
|
||||||
final Context context = RuntimeEnvironment.application;
|
final Context context = RuntimeEnvironment.application;
|
||||||
Settings.System.putInt(context.getContentResolver(), SYSTEM_NAVIGATION_KEYS_ENABLED, 0);
|
Settings.System.putInt(context.getContentResolver(), SYSTEM_NAVIGATION_KEYS_ENABLED, 0);
|
||||||
mController = new SwipeToNotificationPreferenceController(context, null, KEY_SWIPE_DOWN);
|
mController = new SwipeToNotificationPreferenceController(context, KEY_SWIPE_DOWN);
|
||||||
|
|
||||||
assertThat(mController.isSwitchPrefEnabled()).isFalse();
|
assertThat(mController.isChecked()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -53,14 +53,6 @@ public class SwipeToNotificationSettingsTest {
|
|||||||
.isEqualTo(R.xml.swipe_to_notification_settings);
|
.isEqualTo(R.xml.swipe_to_notification_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetPreferenceControllers_shouldAllBeCreated() {
|
|
||||||
final List<AbstractPreferenceController> controllers =
|
|
||||||
mFragment.createPreferenceControllers(mContext);
|
|
||||||
|
|
||||||
assertThat(controllers.isEmpty()).isFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchIndexProvider_shouldIndexResource() {
|
public void testSearchIndexProvider_shouldIndexResource() {
|
||||||
final List<SearchIndexableResource> indexRes =
|
final List<SearchIndexableResource> indexRes =
|
||||||
|
Reference in New Issue
Block a user