Availability of the gesture is gated by a new FeatureProvider.
Test: make -j RunSettingsRoboTests; manual test on
supported/unsupported configurations.
Change-Id: I3529367a73e33370d5112b91d5144293ffa7fa22
<!-- 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>
+ <!-- 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 -->
<string name="gesture_setting_on">On</string>
<string name="gesture_setting_off">Off</string>
--- /dev/null
+<?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>
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
android:key="gesture_swipe_down_fingerprint"
android:title="@string/fingerprint_swipe_for_notifications_title"
android:summary="@string/fingerprint_swipe_for_notifications_summary"
settings:animation="@raw/gesture_ambient_lift"
settings:preview="@drawable/gesture_ambient_lift"/>
-</PreferenceScreen>
\ No newline at end of file
+</PreferenceScreen>
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
android:key="gesture_swipe_down_fingerprint"
android:title="@string/fingerprint_swipe_for_notifications_title"
android:fragment="com.android.settings.gestures.SwipeToNotificationSettings"/>
</PreferenceCategory>
-</PreferenceScreen>
\ No newline at end of file
+</PreferenceScreen>
android:title="@string/default_assist_title"
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
android:key="context"
android:title="@string/assist_access_context_title"
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.gestures.AssistGestureFeatureProvider;
+import com.android.settings.overlay.FeatureFactory;
import com.android.settings.voice.VoiceInputListPreference;
/**
implements Preference.OnPreferenceChangeListener {
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_SCREENSHOT = "screenshot";
private static final String KEY_VOICE_INPUT = "voice_input_settings";
private VoiceInputListPreference mVoiceInputPref;
private Handler mHandler = new Handler();
+ private Preference mAssistGesturePref;
+ private AssistGestureFeatureProvider mAssistGestureFeatureProvider;
+
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mDefaultAssitPref = (DefaultAssistPreference) findPreference(KEY_DEFAULT_ASSIST);
mDefaultAssitPref.setOnPreferenceChangeListener(this);
+ mAssistGesturePref = findPreference(KEY_ASSIST_GESTURE);
+ mAssistGestureFeatureProvider =
+ FeatureFactory.getFactory(getContext()).getAssistGestureFeatureProvider();
+
mContextPref = (SwitchPreference) findPreference(KEY_CONTEXT);
mContextPref.setChecked(Settings.Secure.getInt(getContentResolver(),
Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1) != 0);
getPreferenceScreen().removePreference(mFlashPref);
}
+ if (hasAssistant && mAssistGestureFeatureProvider.isSupported(getContext())) {
+ getPreferenceScreen().addPreference(mAssistGesturePref);
+ } else {
+ getPreferenceScreen().removePreference(mAssistGesturePref);
+ }
+
if (hasAssistant && AssistUtils.allowDisablingAssistDisclosure(getContext())) {
getPreferenceScreen().addPreference(mFlashPref);
} else {
import com.android.settings.fuelgauge.BatterySaverSettings;
import com.android.settings.fuelgauge.PowerUsageDetail;
import com.android.settings.fuelgauge.PowerUsageSummary;
+import com.android.settings.gestures.AssistGestureSettings;
import com.android.settings.gestures.DoubleTapPowerSettings;
import com.android.settings.gestures.DoubleTapScreenSettings;
import com.android.settings.gestures.DoubleTwistGestureSettings;
AccountSyncSettings.class.getName(),
AccountSettings.class.getName(),
GestureSettings.class.getName(),
+ AssistGestureSettings.class.getName(),
SwipeToNotificationSettings.class.getName(),
DoubleTapPowerSettings.class.getName(),
DoubleTapScreenSettings.class.getName(),
--- /dev/null
+/*
+ * 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);
+
+}
--- /dev/null
+/*
+ * 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;
+ }
+
+}
--- /dev/null
+/*
+ * 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;
+ }
+}
--- /dev/null
+/*
+ * 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);
+ }
+ };
+}
+
final AmbientDisplayConfiguration ambientConfig = new AmbientDisplayConfiguration(context);
final List<PreferenceController> controllers = new ArrayList<>();
final Lifecycle lifecycle = getLifecycle();
+ controllers.add(new AssistGesturePreferenceController(context, lifecycle));
controllers.add(new SwipeToNotificationPreferenceController(context, lifecycle));
controllers.add(new DoubleTapPowerPreferenceController(context, lifecycle));
controllers.add(new DoubleTwistPreferenceController(context, lifecycle));
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
mPreferences = new ArrayList();
+ addPreferenceToTrackingList(AssistGesturePreferenceController.class);
addPreferenceToTrackingList(SwipeToNotificationPreferenceController.class);
addPreferenceToTrackingList(DoubleTapScreenPreferenceController.class);
addPreferenceToTrackingList(DoubleTwistPreferenceController.class);
import com.android.settings.core.PreferenceController;
import com.android.settings.core.lifecycle.Lifecycle;
import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.gestures.AssistGesturePreferenceController;
import com.android.settings.gestures.DoubleTapPowerPreferenceController;
import com.android.settings.gestures.DoubleTapScreenPreferenceController;
import com.android.settings.gestures.DoubleTwistPreferenceController;
}
controllers.add(gameControllerPreferenceController);
// Gestures
-
+ controllers.add(new AssistGesturePreferenceController(context, lifecycle));
controllers.add(new SwipeToNotificationPreferenceController(context, lifecycle));
controllers.add(new DoubleTwistPreferenceController(context, lifecycle));
controllers.add(new DoubleTapPowerPreferenceController(context, lifecycle));
import com.android.settings.dashboard.SuggestionFeatureProvider;
import com.android.settings.enterprise.EnterprisePrivacyFeatureProvider;
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
+import com.android.settings.gestures.AssistGestureFeatureProvider;
import com.android.settings.localepicker.LocaleFeatureProvider;
import com.android.settings.security.SecurityFeatureProvider;
import com.android.settings.search2.SearchFeatureProvider;
return sFactory;
}
+ public abstract AssistGestureFeatureProvider getAssistGestureFeatureProvider();
+
public abstract SuggestionFeatureProvider getSuggestionFeatureProvider();
public abstract SupportFeatureProvider getSupportFeatureProvider(Context context);
import com.android.settings.enterprise.EnterprisePrivacyFeatureProviderImpl;
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
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.LocaleFeatureProviderImpl;
import com.android.settings.search2.SearchFeatureProvider;
private SecurityFeatureProvider mSecurityFeatureProvider;
private SuggestionFeatureProvider mSuggestionFeatureProvider;
private PowerUsageFeatureProvider mPowerUsageFeatureProvider;
+ private AssistGestureFeatureProvider mAssistGestureFeatureProvider;
@Override
public SupportFeatureProvider getSupportFeatureProvider(Context context) {
}
return mSuggestionFeatureProvider;
}
+
+ @Override
+ public AssistGestureFeatureProvider getAssistGestureFeatureProvider() {
+ if (mAssistGestureFeatureProvider == null) {
+ mAssistGestureFeatureProvider = new AssistGestureFeatureProviderImpl();
+ }
+ return mAssistGestureFeatureProvider;
+ }
}
import com.android.settings.fuelgauge.PowerUsageAdvanced;
import com.android.settings.fuelgauge.PowerUsageDetail;
import com.android.settings.fuelgauge.PowerUsageSummary;
+import com.android.settings.gestures.AssistGestureSettings;
import com.android.settings.gestures.DoubleTapPowerSettings;
import com.android.settings.gestures.DoubleTapScreenSettings;
import com.android.settings.gestures.DoubleTwistGestureSettings;
R.xml.special_access, R.drawable.ic_settings_applications);
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(AssistGestureSettings.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(DoubleTapPowerSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_gestures);
--- /dev/null
+/*
+ * 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();
+ }
+}
+
--- /dev/null
+/*
+ * 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());
+ }
+}
+
mManager.indexOneSearchIndexableData(mDb, localeStr, resource,
new HashMap<>());
Cursor cursor = mDb.rawQuery("SELECT * FROM prefs_index", null);
- assertThat(cursor.getCount()).isEqualTo(6);
+ assertThat(cursor.getCount()).isEqualTo(7);
}
@Test
Cursor cursor = mDb.rawQuery("SELECT * FROM prefs_index WHERE enabled = 0", null);
assertThat(cursor.getCount()).isEqualTo(2);
cursor = mDb.rawQuery("SELECT * FROM prefs_index WHERE enabled = 1", null);
- assertThat(cursor.getCount()).isEqualTo(4);
+ assertThat(cursor.getCount()).isEqualTo(5);
}
@Test
niks.put(packageName, keysList);
return niks;
}
-}
\ No newline at end of file
+}
"com.android.settings.gestures.GesturePreference");
final AttributeSet attrs = Xml.asAttributeSet(parser);
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);
}
"com.android.settings.gestures.GesturePreference");
final AttributeSet attrs = Xml.asAttributeSet(parser);
String key = XmlParserUtils.getDataKey(mContext, attrs);
- String expKey = "gesture_swipe_down_fingerprint";
+ String expKey = "gesture_assist";
assertThat(key).isEqualTo(expKey);
}
"com.android.settings.gestures.GesturePreference");
final AttributeSet attrs = Xml.asAttributeSet(parser);
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);
}
import com.android.settings.dashboard.SuggestionFeatureProvider;
import com.android.settings.enterprise.EnterprisePrivacyFeatureProvider;
import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
+import com.android.settings.gestures.AssistGestureFeatureProvider;
import com.android.settings.localepicker.LocaleFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.overlay.SupportFeatureProvider;
public final SurveyFeatureProvider surveyFeatureProvider;
public final SecurityFeatureProvider securityFeatureProvider;
public final SuggestionFeatureProvider suggestionsFeatureProvider;
+ public final AssistGestureFeatureProvider assistGestureFeatureProvider;
/**
* Call this in {@code @Before} method of the test class to use fake factory.
surveyFeatureProvider = mock(SurveyFeatureProvider.class);
securityFeatureProvider = mock(SecurityFeatureProvider.class);
suggestionsFeatureProvider = mock(SuggestionFeatureProvider.class);
+ assistGestureFeatureProvider = mock(AssistGestureFeatureProvider.class);
}
@Override
public SecurityFeatureProvider getSecurityFeatureProvider() {
return securityFeatureProvider;
}
+
+ @Override
+ public AssistGestureFeatureProvider getAssistGestureFeatureProvider() {
+ return assistGestureFeatureProvider;
+ }
}