Add settings for the assist gesture.
Availability of the gesture is gated by a new FeatureProvider. Test: make -j RunSettingsRoboTests; manual test on supported/unsupported configurations. Change-Id: I3529367a73e33370d5112b91d5144293ffa7fa22
This commit is contained in:
0
res/drawable-nodpi/gesture_assist
Normal file
0
res/drawable-nodpi/gesture_assist
Normal file
0
res/raw/gesture_assist.mp4
Normal file
0
res/raw/gesture_assist.mp4
Normal file
@@ -8030,6 +8030,12 @@
|
|||||||
<!-- Summary text for fingerprint swipe for notifications (device) [CHAR LIMIT=160]-->
|
<!-- Summary text for fingerprint swipe for notifications (device) [CHAR LIMIT=160]-->
|
||||||
<string name="fingerprint_swipe_for_notifications_summary" product="device">To check your notifications, swipe down on the fingerprint sensor on the back of your device.</string>
|
<string name="fingerprint_swipe_for_notifications_summary" product="device">To check your notifications, swipe down on the fingerprint sensor on the back of your device.</string>
|
||||||
|
|
||||||
|
<!-- Title text for the assist gesture [CHAR LIMIT=60]-->
|
||||||
|
<string name="assist_gesture_title">Assist gesture</string>
|
||||||
|
|
||||||
|
<!-- Summary text for the assist gesture [CHAR LIMIT=160]-->
|
||||||
|
<string name="assist_gesture_summary"></string>
|
||||||
|
|
||||||
<!-- Switch text for each gesture setting state -->
|
<!-- Switch text for each gesture setting state -->
|
||||||
<string name="gesture_setting_on">On</string>
|
<string name="gesture_setting_on">On</string>
|
||||||
<string name="gesture_setting_off">Off</string>
|
<string name="gesture_setting_off">Off</string>
|
||||||
|
32
res/xml/assist_gesture_settings.xml
Normal file
32
res/xml/assist_gesture_settings.xml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2017 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:title="@string/assist_gesture_title">
|
||||||
|
|
||||||
|
<com.android.settings.widget.VideoPreference
|
||||||
|
android:key="gesture_assist_video"
|
||||||
|
app:animation="@raw/gesture_assist"
|
||||||
|
app:preview="@drawable/gesture_assist" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="gesture_assist"
|
||||||
|
android:title="@string/assist_gesture_title"
|
||||||
|
android:summary="@string/assist_gesture_summary" />
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
@@ -19,6 +19,13 @@
|
|||||||
android:title="@string/gesture_preference_title"
|
android:title="@string/gesture_preference_title"
|
||||||
settings:keywords="@string/keywords_gesture">
|
settings:keywords="@string/keywords_gesture">
|
||||||
|
|
||||||
|
<com.android.settings.gestures.GesturePreference
|
||||||
|
android:key="gesture_assist"
|
||||||
|
android:title="@string/assist_gesture_title"
|
||||||
|
android:summary="@string/assist_gesture_summary"
|
||||||
|
settings:animation="@raw/gesture_assist"
|
||||||
|
settings:preview="@drawable/gesture_assist"/>
|
||||||
|
|
||||||
<com.android.settings.gestures.GesturePreference
|
<com.android.settings.gestures.GesturePreference
|
||||||
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"
|
||||||
@@ -54,4 +61,4 @@
|
|||||||
settings:animation="@raw/gesture_ambient_lift"
|
settings:animation="@raw/gesture_ambient_lift"
|
||||||
settings:preview="@drawable/gesture_ambient_lift"/>
|
settings:preview="@drawable/gesture_ambient_lift"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -52,6 +52,11 @@
|
|||||||
android:key="gesture_settings_category"
|
android:key="gesture_settings_category"
|
||||||
android:title="@string/gesture_preference_title">
|
android:title="@string/gesture_preference_title">
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="gesture_assist"
|
||||||
|
android:title="@string/assist_gesture_title"
|
||||||
|
android:fragment="com.android.settings.gestures.AssistGestureSettings"/>
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
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"
|
||||||
@@ -114,4 +119,4 @@
|
|||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -24,6 +24,11 @@
|
|||||||
android:title="@string/default_assist_title"
|
android:title="@string/default_assist_title"
|
||||||
android:summary="@string/default_assist_none"/>
|
android:summary="@string/default_assist_none"/>
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="gesture_assist"
|
||||||
|
android:title="@string/assist_gesture_title"
|
||||||
|
android:fragment="com.android.settings.gestures.AssistGestureSettings"/>
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="context"
|
android:key="context"
|
||||||
android:title="@string/assist_access_context_title"
|
android:title="@string/assist_access_context_title"
|
||||||
|
@@ -29,6 +29,8 @@ import com.android.internal.app.AssistUtils;
|
|||||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
|
import com.android.settings.gestures.AssistGestureFeatureProvider;
|
||||||
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.voice.VoiceInputListPreference;
|
import com.android.settings.voice.VoiceInputListPreference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,6 +40,7 @@ public class ManageAssist extends SettingsPreferenceFragment
|
|||||||
implements Preference.OnPreferenceChangeListener {
|
implements Preference.OnPreferenceChangeListener {
|
||||||
|
|
||||||
private static final String KEY_DEFAULT_ASSIST = "default_assist";
|
private static final String KEY_DEFAULT_ASSIST = "default_assist";
|
||||||
|
private static final String KEY_ASSIST_GESTURE = "gesture_assist";
|
||||||
private static final String KEY_CONTEXT = "context";
|
private static final String KEY_CONTEXT = "context";
|
||||||
private static final String KEY_SCREENSHOT = "screenshot";
|
private static final String KEY_SCREENSHOT = "screenshot";
|
||||||
private static final String KEY_VOICE_INPUT = "voice_input_settings";
|
private static final String KEY_VOICE_INPUT = "voice_input_settings";
|
||||||
@@ -50,6 +53,9 @@ public class ManageAssist extends SettingsPreferenceFragment
|
|||||||
private VoiceInputListPreference mVoiceInputPref;
|
private VoiceInputListPreference mVoiceInputPref;
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
|
|
||||||
|
private Preference mAssistGesturePref;
|
||||||
|
private AssistGestureFeatureProvider mAssistGestureFeatureProvider;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
@@ -58,6 +64,10 @@ public class ManageAssist extends SettingsPreferenceFragment
|
|||||||
mDefaultAssitPref = (DefaultAssistPreference) findPreference(KEY_DEFAULT_ASSIST);
|
mDefaultAssitPref = (DefaultAssistPreference) findPreference(KEY_DEFAULT_ASSIST);
|
||||||
mDefaultAssitPref.setOnPreferenceChangeListener(this);
|
mDefaultAssitPref.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
|
mAssistGesturePref = findPreference(KEY_ASSIST_GESTURE);
|
||||||
|
mAssistGestureFeatureProvider =
|
||||||
|
FeatureFactory.getFactory(getContext()).getAssistGestureFeatureProvider();
|
||||||
|
|
||||||
mContextPref = (SwitchPreference) findPreference(KEY_CONTEXT);
|
mContextPref = (SwitchPreference) findPreference(KEY_CONTEXT);
|
||||||
mContextPref.setChecked(Settings.Secure.getInt(getContentResolver(),
|
mContextPref.setChecked(Settings.Secure.getInt(getContentResolver(),
|
||||||
Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1) != 0);
|
Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1) != 0);
|
||||||
@@ -142,6 +152,12 @@ public class ManageAssist extends SettingsPreferenceFragment
|
|||||||
getPreferenceScreen().removePreference(mFlashPref);
|
getPreferenceScreen().removePreference(mFlashPref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasAssistant && mAssistGestureFeatureProvider.isSupported(getContext())) {
|
||||||
|
getPreferenceScreen().addPreference(mAssistGesturePref);
|
||||||
|
} else {
|
||||||
|
getPreferenceScreen().removePreference(mAssistGesturePref);
|
||||||
|
}
|
||||||
|
|
||||||
if (hasAssistant && AssistUtils.allowDisablingAssistDisclosure(getContext())) {
|
if (hasAssistant && AssistUtils.allowDisablingAssistDisclosure(getContext())) {
|
||||||
getPreferenceScreen().addPreference(mFlashPref);
|
getPreferenceScreen().addPreference(mFlashPref);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -81,6 +81,7 @@ import com.android.settings.enterprise.EnterprisePrivacySettings;
|
|||||||
import com.android.settings.fuelgauge.BatterySaverSettings;
|
import com.android.settings.fuelgauge.BatterySaverSettings;
|
||||||
import com.android.settings.fuelgauge.PowerUsageDetail;
|
import com.android.settings.fuelgauge.PowerUsageDetail;
|
||||||
import com.android.settings.fuelgauge.PowerUsageSummary;
|
import com.android.settings.fuelgauge.PowerUsageSummary;
|
||||||
|
import com.android.settings.gestures.AssistGestureSettings;
|
||||||
import com.android.settings.gestures.DoubleTapPowerSettings;
|
import com.android.settings.gestures.DoubleTapPowerSettings;
|
||||||
import com.android.settings.gestures.DoubleTapScreenSettings;
|
import com.android.settings.gestures.DoubleTapScreenSettings;
|
||||||
import com.android.settings.gestures.DoubleTwistGestureSettings;
|
import com.android.settings.gestures.DoubleTwistGestureSettings;
|
||||||
@@ -182,6 +183,7 @@ public class SettingsGateway {
|
|||||||
AccountSyncSettings.class.getName(),
|
AccountSyncSettings.class.getName(),
|
||||||
AccountSettings.class.getName(),
|
AccountSettings.class.getName(),
|
||||||
GestureSettings.class.getName(),
|
GestureSettings.class.getName(),
|
||||||
|
AssistGestureSettings.class.getName(),
|
||||||
SwipeToNotificationSettings.class.getName(),
|
SwipeToNotificationSettings.class.getName(),
|
||||||
DoubleTapPowerSettings.class.getName(),
|
DoubleTapPowerSettings.class.getName(),
|
||||||
DoubleTapScreenSettings.class.getName(),
|
DoubleTapScreenSettings.class.getName(),
|
||||||
|
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.gestures;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
/** Feature provider for the assist gesture. */
|
||||||
|
public interface AssistGestureFeatureProvider {
|
||||||
|
|
||||||
|
/** Returns true if the assist gesture is supported. */
|
||||||
|
boolean isSupported(Context context);
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.gestures;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public class AssistGestureFeatureProviderImpl implements AssistGestureFeatureProvider {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSupported(Context context) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.gestures;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.support.v7.preference.Preference;
|
||||||
|
import android.util.ArrayMap;
|
||||||
|
|
||||||
|
import com.android.settings.core.lifecycle.Lifecycle;
|
||||||
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
|
import com.android.settings.search2.InlineSwitchPayload;
|
||||||
|
import com.android.settings.search2.ResultPayload;
|
||||||
|
|
||||||
|
public class AssistGesturePreferenceController extends GesturePreferenceController {
|
||||||
|
|
||||||
|
private static final String PREF_KEY_VIDEO = "gesture_assist_video";
|
||||||
|
private static final String PREF_KEY_ASSIST_GESTURE = "gesture_assist";
|
||||||
|
|
||||||
|
public AssistGesturePreferenceController(Context context, Lifecycle lifecycle) {
|
||||||
|
super(context, lifecycle);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable() {
|
||||||
|
AssistGestureFeatureProvider provider =
|
||||||
|
FeatureFactory.getFactory(mContext).getAssistGestureFeatureProvider();
|
||||||
|
return provider.isSupported(mContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getVideoPrefKey() {
|
||||||
|
return PREF_KEY_VIDEO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPreferenceKey() {
|
||||||
|
return PREF_KEY_ASSIST_GESTURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
final boolean enabled = (boolean) newValue;
|
||||||
|
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.ASSIST_GESTURE_ENABLED, enabled ? 1 : 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isSwitchPrefEnabled() {
|
||||||
|
final int assistGestureEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.ASSIST_GESTURE_ENABLED, 1);
|
||||||
|
return assistGestureEnabled != 0;
|
||||||
|
}
|
||||||
|
}
|
74
src/com/android/settings/gestures/AssistGestureSettings.java
Normal file
74
src/com/android/settings/gestures/AssistGestureSettings.java
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.gestures;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.provider.SearchIndexableResource;
|
||||||
|
|
||||||
|
import com.android.internal.logging.nano.MetricsProto;
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.core.PreferenceController;
|
||||||
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AssistGestureSettings extends DashboardFragment {
|
||||||
|
|
||||||
|
private static final String TAG = "AssistGesture";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetricsCategory() {
|
||||||
|
return MetricsProto.MetricsEvent.VIEW_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getLogTag() {
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getPreferenceScreenResId() {
|
||||||
|
return R.xml.assist_gesture_settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<PreferenceController> getPreferenceControllers(Context context) {
|
||||||
|
final List<PreferenceController> controllers = new ArrayList<>();
|
||||||
|
controllers.add(new AssistGesturePreferenceController(context, getLifecycle()));
|
||||||
|
return controllers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
|
new BaseSearchIndexProvider() {
|
||||||
|
@Override
|
||||||
|
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||||
|
Context context, boolean enabled) {
|
||||||
|
if (!FeatureFactory.getFactory(context).getDashboardFeatureProvider(context)
|
||||||
|
.isEnabled()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||||
|
sir.xmlResId = R.xml.assist_gesture_settings;
|
||||||
|
return Arrays.asList(sir);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@@ -58,6 +58,7 @@ public class GestureSettings extends DashboardFragment {
|
|||||||
final AmbientDisplayConfiguration ambientConfig = new AmbientDisplayConfiguration(context);
|
final AmbientDisplayConfiguration ambientConfig = new AmbientDisplayConfiguration(context);
|
||||||
final List<PreferenceController> controllers = new ArrayList<>();
|
final List<PreferenceController> controllers = new ArrayList<>();
|
||||||
final Lifecycle lifecycle = getLifecycle();
|
final Lifecycle lifecycle = getLifecycle();
|
||||||
|
controllers.add(new AssistGesturePreferenceController(context, lifecycle));
|
||||||
controllers.add(new SwipeToNotificationPreferenceController(context, lifecycle));
|
controllers.add(new SwipeToNotificationPreferenceController(context, lifecycle));
|
||||||
controllers.add(new DoubleTapPowerPreferenceController(context, lifecycle));
|
controllers.add(new DoubleTapPowerPreferenceController(context, lifecycle));
|
||||||
controllers.add(new DoubleTwistPreferenceController(context, lifecycle));
|
controllers.add(new DoubleTwistPreferenceController(context, lifecycle));
|
||||||
@@ -72,6 +73,7 @@ public class GestureSettings extends DashboardFragment {
|
|||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
super.onCreatePreferences(savedInstanceState, rootKey);
|
super.onCreatePreferences(savedInstanceState, rootKey);
|
||||||
mPreferences = new ArrayList();
|
mPreferences = new ArrayList();
|
||||||
|
addPreferenceToTrackingList(AssistGesturePreferenceController.class);
|
||||||
addPreferenceToTrackingList(SwipeToNotificationPreferenceController.class);
|
addPreferenceToTrackingList(SwipeToNotificationPreferenceController.class);
|
||||||
addPreferenceToTrackingList(DoubleTapScreenPreferenceController.class);
|
addPreferenceToTrackingList(DoubleTapScreenPreferenceController.class);
|
||||||
addPreferenceToTrackingList(DoubleTwistPreferenceController.class);
|
addPreferenceToTrackingList(DoubleTwistPreferenceController.class);
|
||||||
|
@@ -28,6 +28,7 @@ import com.android.settings.R;
|
|||||||
import com.android.settings.core.PreferenceController;
|
import com.android.settings.core.PreferenceController;
|
||||||
import com.android.settings.core.lifecycle.Lifecycle;
|
import com.android.settings.core.lifecycle.Lifecycle;
|
||||||
import com.android.settings.dashboard.DashboardFragment;
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
|
import com.android.settings.gestures.AssistGesturePreferenceController;
|
||||||
import com.android.settings.gestures.DoubleTapPowerPreferenceController;
|
import com.android.settings.gestures.DoubleTapPowerPreferenceController;
|
||||||
import com.android.settings.gestures.DoubleTapScreenPreferenceController;
|
import com.android.settings.gestures.DoubleTapScreenPreferenceController;
|
||||||
import com.android.settings.gestures.DoubleTwistPreferenceController;
|
import com.android.settings.gestures.DoubleTwistPreferenceController;
|
||||||
@@ -88,7 +89,7 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
|||||||
}
|
}
|
||||||
controllers.add(gameControllerPreferenceController);
|
controllers.add(gameControllerPreferenceController);
|
||||||
// Gestures
|
// Gestures
|
||||||
|
controllers.add(new AssistGesturePreferenceController(context, lifecycle));
|
||||||
controllers.add(new SwipeToNotificationPreferenceController(context, lifecycle));
|
controllers.add(new SwipeToNotificationPreferenceController(context, lifecycle));
|
||||||
controllers.add(new DoubleTwistPreferenceController(context, lifecycle));
|
controllers.add(new DoubleTwistPreferenceController(context, lifecycle));
|
||||||
controllers.add(new DoubleTapPowerPreferenceController(context, lifecycle));
|
controllers.add(new DoubleTapPowerPreferenceController(context, lifecycle));
|
||||||
|
@@ -27,6 +27,7 @@ import com.android.settings.dashboard.DashboardFeatureProvider;
|
|||||||
import com.android.settings.dashboard.SuggestionFeatureProvider;
|
import com.android.settings.dashboard.SuggestionFeatureProvider;
|
||||||
import com.android.settings.enterprise.EnterprisePrivacyFeatureProvider;
|
import com.android.settings.enterprise.EnterprisePrivacyFeatureProvider;
|
||||||
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
|
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
|
||||||
|
import com.android.settings.gestures.AssistGestureFeatureProvider;
|
||||||
import com.android.settings.localepicker.LocaleFeatureProvider;
|
import com.android.settings.localepicker.LocaleFeatureProvider;
|
||||||
import com.android.settings.security.SecurityFeatureProvider;
|
import com.android.settings.security.SecurityFeatureProvider;
|
||||||
import com.android.settings.search2.SearchFeatureProvider;
|
import com.android.settings.search2.SearchFeatureProvider;
|
||||||
@@ -68,6 +69,8 @@ public abstract class FeatureFactory {
|
|||||||
return sFactory;
|
return sFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract AssistGestureFeatureProvider getAssistGestureFeatureProvider();
|
||||||
|
|
||||||
public abstract SuggestionFeatureProvider getSuggestionFeatureProvider();
|
public abstract SuggestionFeatureProvider getSuggestionFeatureProvider();
|
||||||
|
|
||||||
public abstract SupportFeatureProvider getSupportFeatureProvider(Context context);
|
public abstract SupportFeatureProvider getSupportFeatureProvider(Context context);
|
||||||
|
@@ -38,6 +38,8 @@ import com.android.settings.enterprise.EnterprisePrivacyFeatureProvider;
|
|||||||
import com.android.settings.enterprise.EnterprisePrivacyFeatureProviderImpl;
|
import com.android.settings.enterprise.EnterprisePrivacyFeatureProviderImpl;
|
||||||
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
|
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
|
||||||
import com.android.settings.fuelgauge.PowerUsageFeatureProviderImpl;
|
import com.android.settings.fuelgauge.PowerUsageFeatureProviderImpl;
|
||||||
|
import com.android.settings.gestures.AssistGestureFeatureProvider;
|
||||||
|
import com.android.settings.gestures.AssistGestureFeatureProviderImpl;
|
||||||
import com.android.settings.localepicker.LocaleFeatureProvider;
|
import com.android.settings.localepicker.LocaleFeatureProvider;
|
||||||
import com.android.settings.localepicker.LocaleFeatureProviderImpl;
|
import com.android.settings.localepicker.LocaleFeatureProviderImpl;
|
||||||
import com.android.settings.search2.SearchFeatureProvider;
|
import com.android.settings.search2.SearchFeatureProvider;
|
||||||
@@ -61,6 +63,7 @@ public class FeatureFactoryImpl extends FeatureFactory {
|
|||||||
private SecurityFeatureProvider mSecurityFeatureProvider;
|
private SecurityFeatureProvider mSecurityFeatureProvider;
|
||||||
private SuggestionFeatureProvider mSuggestionFeatureProvider;
|
private SuggestionFeatureProvider mSuggestionFeatureProvider;
|
||||||
private PowerUsageFeatureProvider mPowerUsageFeatureProvider;
|
private PowerUsageFeatureProvider mPowerUsageFeatureProvider;
|
||||||
|
private AssistGestureFeatureProvider mAssistGestureFeatureProvider;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SupportFeatureProvider getSupportFeatureProvider(Context context) {
|
public SupportFeatureProvider getSupportFeatureProvider(Context context) {
|
||||||
@@ -154,4 +157,12 @@ public class FeatureFactoryImpl extends FeatureFactory {
|
|||||||
}
|
}
|
||||||
return mSuggestionFeatureProvider;
|
return mSuggestionFeatureProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AssistGestureFeatureProvider getAssistGestureFeatureProvider() {
|
||||||
|
if (mAssistGestureFeatureProvider == null) {
|
||||||
|
mAssistGestureFeatureProvider = new AssistGestureFeatureProviderImpl();
|
||||||
|
}
|
||||||
|
return mAssistGestureFeatureProvider;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -50,6 +50,7 @@ import com.android.settings.fuelgauge.BatterySaverSettings;
|
|||||||
import com.android.settings.fuelgauge.PowerUsageAdvanced;
|
import com.android.settings.fuelgauge.PowerUsageAdvanced;
|
||||||
import com.android.settings.fuelgauge.PowerUsageDetail;
|
import com.android.settings.fuelgauge.PowerUsageDetail;
|
||||||
import com.android.settings.fuelgauge.PowerUsageSummary;
|
import com.android.settings.fuelgauge.PowerUsageSummary;
|
||||||
|
import com.android.settings.gestures.AssistGestureSettings;
|
||||||
import com.android.settings.gestures.DoubleTapPowerSettings;
|
import com.android.settings.gestures.DoubleTapPowerSettings;
|
||||||
import com.android.settings.gestures.DoubleTapScreenSettings;
|
import com.android.settings.gestures.DoubleTapScreenSettings;
|
||||||
import com.android.settings.gestures.DoubleTwistGestureSettings;
|
import com.android.settings.gestures.DoubleTwistGestureSettings;
|
||||||
@@ -136,6 +137,7 @@ public final class SearchIndexableResources {
|
|||||||
R.xml.special_access, R.drawable.ic_settings_applications);
|
R.xml.special_access, R.drawable.ic_settings_applications);
|
||||||
addIndex(UserSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_multiuser);
|
addIndex(UserSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_multiuser);
|
||||||
addIndex(GestureSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_gestures);
|
addIndex(GestureSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_gestures);
|
||||||
|
addIndex(AssistGestureSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_gestures);
|
||||||
addIndex(PickupGestureSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_gestures);
|
addIndex(PickupGestureSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_gestures);
|
||||||
addIndex(DoubleTapScreenSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_gestures);
|
addIndex(DoubleTapScreenSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_gestures);
|
||||||
addIndex(DoubleTapPowerSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_gestures);
|
addIndex(DoubleTapPowerSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_gestures);
|
||||||
|
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.gestures;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import com.android.settings.SettingsRobolectricTestRunner;
|
||||||
|
import com.android.settings.TestConfig;
|
||||||
|
import com.android.settings.testutils.FakeFeatureFactory;
|
||||||
|
|
||||||
|
import com.android.settings.search2.InlineSwitchPayload;
|
||||||
|
import com.android.settings.search2.ResultPayload;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Answers;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.MockitoAnnotations;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
import org.robolectric.shadows.ShadowApplication;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static android.provider.Settings.Secure.ASSIST_GESTURE_ENABLED;
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
import static org.mockito.Matchers.anyInt;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
|
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||||
|
public class AssistGesturePreferenceControllerTest {
|
||||||
|
|
||||||
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
|
private Context mContext;
|
||||||
|
private FakeFeatureFactory mFactory;
|
||||||
|
private AssistGesturePreferenceController mController;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
MockitoAnnotations.initMocks(this);
|
||||||
|
FakeFeatureFactory.setupForTest(mContext);
|
||||||
|
mFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
|
||||||
|
mController = new AssistGesturePreferenceController(mContext, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isAvailable_whenSupported_shouldReturnTrue() {
|
||||||
|
when(mFactory.assistGestureFeatureProvider.isSupported(mContext)).thenReturn(true);
|
||||||
|
assertThat(mController.isAvailable()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isAvailable_whenUnsupported_shouldReturnFalse() {
|
||||||
|
when(mFactory.assistGestureFeatureProvider.isSupported(mContext)).thenReturn(false);
|
||||||
|
assertThat(mController.isAvailable()).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwitchEnabled_configIsSet_shouldReturnTrue() {
|
||||||
|
// Set the setting to be enabled.
|
||||||
|
final Context context = ShadowApplication.getInstance().getApplicationContext();
|
||||||
|
Settings.System.putInt(context.getContentResolver(), ASSIST_GESTURE_ENABLED, 1);
|
||||||
|
mController = new AssistGesturePreferenceController(context, null);
|
||||||
|
|
||||||
|
assertThat(mController.isSwitchPrefEnabled()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwitchEnabled_configIsNotSet_shouldReturnFalse() {
|
||||||
|
// Set the setting to be disabled.
|
||||||
|
final Context context = ShadowApplication.getInstance().getApplicationContext();
|
||||||
|
Settings.System.putInt(context.getContentResolver(), ASSIST_GESTURE_ENABLED, 0);
|
||||||
|
mController = new AssistGesturePreferenceController(context, null);
|
||||||
|
|
||||||
|
assertThat(mController.isSwitchPrefEnabled()).isFalse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.gestures;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.provider.SearchIndexableResource;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.SettingsRobolectricTestRunner;
|
||||||
|
import com.android.settings.TestConfig;
|
||||||
|
import com.android.settings.core.PreferenceController;
|
||||||
|
import com.android.settings.testutils.FakeFeatureFactory;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Answers;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.MockitoAnnotations;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
import org.robolectric.shadows.ShadowApplication;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
@RunWith(SettingsRobolectricTestRunner.class)
|
||||||
|
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||||
|
public class AssistGestureSettingsTest {
|
||||||
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
|
private Context mContext;
|
||||||
|
private AssistGestureSettings mSettings;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
MockitoAnnotations.initMocks(this);
|
||||||
|
FakeFeatureFactory.setupForTest(mContext);
|
||||||
|
final FakeFeatureFactory factory =
|
||||||
|
(FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
|
||||||
|
when(factory.dashboardFeatureProvider.isEnabled()).thenReturn(true);
|
||||||
|
mSettings = new AssistGestureSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetPreferenceScreenResId() {
|
||||||
|
assertThat(mSettings.getPreferenceScreenResId())
|
||||||
|
.isEqualTo(R.xml.assist_gesture_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetPreferenceControllers_shouldAllBeCreated() {
|
||||||
|
final List<PreferenceController> controllers =
|
||||||
|
mSettings.getPreferenceControllers(mContext);
|
||||||
|
assertThat(controllers.isEmpty()).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchIndexProvider_shouldIndexResource() {
|
||||||
|
final List<SearchIndexableResource> indexRes =
|
||||||
|
AssistGestureSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
|
||||||
|
ShadowApplication.getInstance().getApplicationContext(),
|
||||||
|
true /* enabled */);
|
||||||
|
|
||||||
|
assertThat(indexRes).isNotNull();
|
||||||
|
assertThat(indexRes.get(0).xmlResId).isEqualTo(mSettings.getPreferenceScreenResId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@@ -210,7 +210,7 @@ public class DatabaseIndexingManagerTest {
|
|||||||
mManager.indexOneSearchIndexableData(mDb, localeStr, resource,
|
mManager.indexOneSearchIndexableData(mDb, localeStr, resource,
|
||||||
new HashMap<>());
|
new HashMap<>());
|
||||||
Cursor cursor = mDb.rawQuery("SELECT * FROM prefs_index", null);
|
Cursor cursor = mDb.rawQuery("SELECT * FROM prefs_index", null);
|
||||||
assertThat(cursor.getCount()).isEqualTo(6);
|
assertThat(cursor.getCount()).isEqualTo(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -224,7 +224,7 @@ public class DatabaseIndexingManagerTest {
|
|||||||
Cursor cursor = mDb.rawQuery("SELECT * FROM prefs_index WHERE enabled = 0", null);
|
Cursor cursor = mDb.rawQuery("SELECT * FROM prefs_index WHERE enabled = 0", null);
|
||||||
assertThat(cursor.getCount()).isEqualTo(2);
|
assertThat(cursor.getCount()).isEqualTo(2);
|
||||||
cursor = mDb.rawQuery("SELECT * FROM prefs_index WHERE enabled = 1", null);
|
cursor = mDb.rawQuery("SELECT * FROM prefs_index WHERE enabled = 1", null);
|
||||||
assertThat(cursor.getCount()).isEqualTo(4);
|
assertThat(cursor.getCount()).isEqualTo(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -673,4 +673,4 @@ public class DatabaseIndexingManagerTest {
|
|||||||
niks.put(packageName, keysList);
|
niks.put(packageName, keysList);
|
||||||
return niks;
|
return niks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ public class XmlParserUtilTest {
|
|||||||
"com.android.settings.gestures.GesturePreference");
|
"com.android.settings.gestures.GesturePreference");
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
String title = XmlParserUtils.getDataTitle(mContext, attrs);
|
String title = XmlParserUtils.getDataTitle(mContext, attrs);
|
||||||
String expTitle = mContext.getString(R.string.fingerprint_swipe_for_notifications_title);
|
String expTitle = mContext.getString(R.string.assist_gesture_title);
|
||||||
assertThat(title).isEqualTo(expTitle);
|
assertThat(title).isEqualTo(expTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ public class XmlParserUtilTest {
|
|||||||
"com.android.settings.gestures.GesturePreference");
|
"com.android.settings.gestures.GesturePreference");
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
String key = XmlParserUtils.getDataKey(mContext, attrs);
|
String key = XmlParserUtils.getDataKey(mContext, attrs);
|
||||||
String expKey = "gesture_swipe_down_fingerprint";
|
String expKey = "gesture_assist";
|
||||||
assertThat(key).isEqualTo(expKey);
|
assertThat(key).isEqualTo(expKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ public class XmlParserUtilTest {
|
|||||||
"com.android.settings.gestures.GesturePreference");
|
"com.android.settings.gestures.GesturePreference");
|
||||||
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
final AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
String summary = XmlParserUtils.getDataSummary(mContext, attrs);
|
String summary = XmlParserUtils.getDataSummary(mContext, attrs);
|
||||||
String expSummary = mContext.getString(R.string.fingerprint_swipe_for_notifications_summary);
|
String expSummary = mContext.getString(R.string.assist_gesture_summary);
|
||||||
assertThat(summary).isEqualTo(expSummary);
|
assertThat(summary).isEqualTo(expSummary);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -23,6 +23,7 @@ import com.android.settings.dashboard.DashboardFeatureProvider;
|
|||||||
import com.android.settings.dashboard.SuggestionFeatureProvider;
|
import com.android.settings.dashboard.SuggestionFeatureProvider;
|
||||||
import com.android.settings.enterprise.EnterprisePrivacyFeatureProvider;
|
import com.android.settings.enterprise.EnterprisePrivacyFeatureProvider;
|
||||||
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
|
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
|
||||||
|
import com.android.settings.gestures.AssistGestureFeatureProvider;
|
||||||
import com.android.settings.localepicker.LocaleFeatureProvider;
|
import com.android.settings.localepicker.LocaleFeatureProvider;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.overlay.SupportFeatureProvider;
|
import com.android.settings.overlay.SupportFeatureProvider;
|
||||||
@@ -51,6 +52,7 @@ public class FakeFeatureFactory extends FeatureFactory {
|
|||||||
public final SurveyFeatureProvider surveyFeatureProvider;
|
public final SurveyFeatureProvider surveyFeatureProvider;
|
||||||
public final SecurityFeatureProvider securityFeatureProvider;
|
public final SecurityFeatureProvider securityFeatureProvider;
|
||||||
public final SuggestionFeatureProvider suggestionsFeatureProvider;
|
public final SuggestionFeatureProvider suggestionsFeatureProvider;
|
||||||
|
public final AssistGestureFeatureProvider assistGestureFeatureProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this in {@code @Before} method of the test class to use fake factory.
|
* Call this in {@code @Before} method of the test class to use fake factory.
|
||||||
@@ -84,6 +86,7 @@ public class FakeFeatureFactory extends FeatureFactory {
|
|||||||
surveyFeatureProvider = mock(SurveyFeatureProvider.class);
|
surveyFeatureProvider = mock(SurveyFeatureProvider.class);
|
||||||
securityFeatureProvider = mock(SecurityFeatureProvider.class);
|
securityFeatureProvider = mock(SecurityFeatureProvider.class);
|
||||||
suggestionsFeatureProvider = mock(SuggestionFeatureProvider.class);
|
suggestionsFeatureProvider = mock(SuggestionFeatureProvider.class);
|
||||||
|
assistGestureFeatureProvider = mock(AssistGestureFeatureProvider.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -140,4 +143,9 @@ public class FakeFeatureFactory extends FeatureFactory {
|
|||||||
public SecurityFeatureProvider getSecurityFeatureProvider() {
|
public SecurityFeatureProvider getSecurityFeatureProvider() {
|
||||||
return securityFeatureProvider;
|
return securityFeatureProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AssistGestureFeatureProvider getAssistGestureFeatureProvider() {
|
||||||
|
return assistGestureFeatureProvider;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user