Move Gesture settings up one level.
Move System->Languages, input & gestures->Gestures to System->Gestures. Change-Id: Ie81876208383f69ebf1a0465d76c760d7dd9d95d Fix: 62276882 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -557,7 +557,7 @@
|
||||
</activity>
|
||||
|
||||
<activity android:name=".Settings$LanguageAndInputSettingsActivity"
|
||||
android:label="@string/language_input_gesture_title"
|
||||
android:label="@string/language_settings"
|
||||
android:icon="@drawable/ic_settings_language"
|
||||
android:taskAffinity="com.android.settings"
|
||||
android:parentActivityName="Settings$SystemDashboardActivity">
|
||||
@@ -3193,7 +3193,7 @@
|
||||
<activity
|
||||
android:name=".Settings$DoubleTapPowerSuggestionActivity"
|
||||
android:label="@string/double_tap_power_for_camera_title"
|
||||
android:icon="@drawable/ic_suggestion_gesture">
|
||||
android:icon="@drawable/ic_settings_gestures">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="com.android.settings.suggested.category.GESTURE" />
|
||||
@@ -3215,7 +3215,7 @@
|
||||
<activity
|
||||
android:name=".Settings$DoubleTwistSuggestionActivity"
|
||||
android:label="@string/double_twist_for_camera_mode_title"
|
||||
android:icon="@drawable/ic_suggestion_gesture">
|
||||
android:icon="@drawable/ic_settings_gestures">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="com.android.settings.suggested.category.GESTURE" />
|
||||
@@ -3237,7 +3237,7 @@
|
||||
<activity
|
||||
android:name=".Settings$AmbientDisplaySuggestionActivity"
|
||||
android:label="@string/ambient_display_title"
|
||||
android:icon="@drawable/ic_suggestion_gesture">
|
||||
android:icon="@drawable/ic_settings_gestures">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="com.android.settings.suggested.category.GESTURE" />
|
||||
@@ -3259,7 +3259,7 @@
|
||||
<activity
|
||||
android:name=".Settings$AmbientDisplayPickupSuggestionActivity"
|
||||
android:label="@string/ambient_display_pickup_title"
|
||||
android:icon="@drawable/ic_suggestion_gesture">
|
||||
android:icon="@drawable/ic_settings_gestures">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="com.android.settings.suggested.category.GESTURE" />
|
||||
@@ -3281,7 +3281,7 @@
|
||||
<activity
|
||||
android:name=".Settings$SwipeToNotificationSuggestionActivity"
|
||||
android:label="@string/fingerprint_swipe_for_notifications_title"
|
||||
android:icon="@drawable/ic_suggestion_gesture">
|
||||
android:icon="@drawable/ic_settings_gestures">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="com.android.settings.suggested.category.GESTURE" />
|
||||
|
@@ -16,10 +16,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="32.0"
|
||||
android:viewportHeight="32.0"
|
||||
android:tint="?android:attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M9,11.24L9,7.5C9,6.12 10.12,5 11.5,5S14,6.12 14,7.5v3.74c1.21,-0.81 2,-2.18 2,-3.74C16,5.01 13.99,3 11.5,3S7,5.01 7,7.5c0,1.56 0.79,2.93 2,3.74zM18.84,15.87l-4.54,-2.26c-0.17,-0.07 -0.35,-0.11 -0.54,-0.11L13,13.5v-6c0,-0.83 -0.67,-1.5 -1.5,-1.5S10,6.67 10,7.5v10.74l-3.43,-0.72c-0.08,-0.01 -0.15,-0.03 -0.24,-0.03 -0.31,0 -0.59,0.13 -0.79,0.33l-0.79,0.8 4.94,4.94c0.27,0.27 0.65,0.44 1.06,0.44h6.79c0.75,0 1.33,-0.55 1.44,-1.28l0.75,-5.27c0.01,-0.07 0.02,-0.14 0.02,-0.2 0,-0.62 -0.38,-1.16 -0.91,-1.38z"/>
|
||||
android:pathData="M20,20.2V24H6V5.3h8.7l2.4,-4H7.6c-2.2,0 -4,1.8 -4,4v21.3c0,2.2 1.8,4 4,4h10.7c2.2,0 4,-1.8 4,-4V14.9L20,20.2zM15.6,28h-5.3v-1.3h5.3V28z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M28.5,7l1.1,-2.4L32,3.5l-2.4,-1.1L28.5,0l-1.1,2.4L25,3.5l2.4,1.1L28.5,7zM21,7.4l-2.2,-4.8l-2.2,4.8l-4.8,2.2l4.8,2.2l2.2,4.8l2.2,-4.8l4.8,-2.2L21,7.4zM28.5,12.2l-1.1,2.4L25,15.6l2.4,1.1l1.1,2.4l1.1,-2.4l2.4,-1.1l-2.4,-1.1L28.5,12.2z"/>
|
||||
</vector>
|
@@ -1,28 +0,0 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="32.0"
|
||||
android:viewportHeight="32.0"
|
||||
android:autoMirrored="true">
|
||||
<path
|
||||
android:fillColor="@color/material_grey_600"
|
||||
android:pathData="M20,20.2V24H6V5.3h8.7l2.4,-4H7.6c-2.2,0 -4,1.8 -4,4v21.3c0,2.2 1.8,4 4,4h10.7c2.2,0 4,-1.8 4,-4V14.9L20,20.2zM15.6,28h-5.3v-1.3h5.3V28z"/>
|
||||
<path
|
||||
android:fillColor="@color/material_grey_600"
|
||||
android:pathData="M28.5,7l1.1,-2.4L32,3.5l-2.4,-1.1L28.5,0l-1.1,2.4L25,3.5l2.4,1.1L28.5,7zM21,7.4l-2.2,-4.8l-2.2,4.8l-4.8,2.2l4.8,2.2l2.2,4.8l2.2,-4.8l4.8,-2.2L21,7.4zM28.5,12.2l-1.1,2.4L25,15.6l2.4,1.1l1.1,2.4l1.1,-2.4l2.4,-1.1l-2.4,-1.1L28.5,12.2z"/>
|
||||
</vector>
|
52
res/xml/gestures.xml
Normal file
52
res/xml/gestures.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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"
|
||||
android:title="@string/gesture_preference_title" >
|
||||
|
||||
<Preference
|
||||
android:key="gesture_assist_input_summary"
|
||||
android:title="@string/assist_gesture_title"
|
||||
android:fragment="com.android.settings.gestures.AssistGestureSettings" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_swipe_down_fingerprint_input_summary"
|
||||
android:title="@string/fingerprint_swipe_for_notifications_title"
|
||||
android:fragment="com.android.settings.gestures.SwipeToNotificationSettings" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_double_tap_power_input_summary"
|
||||
android:title="@string/double_tap_power_for_camera_title"
|
||||
android:fragment="com.android.settings.gestures.DoubleTapPowerSettings" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_double_twist_input_summary"
|
||||
android:title="@string/double_twist_for_camera_mode_title"
|
||||
android:fragment="com.android.settings.gestures.DoubleTwistGestureSettings" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_double_tap_screen_input_summary"
|
||||
android:title="@string/ambient_display_title"
|
||||
android:fragment="com.android.settings.gestures.DoubleTapScreenSettings" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_pick_up_input_summary"
|
||||
android:title="@string/ambient_display_pickup_title"
|
||||
android:fragment="com.android.settings.gestures.PickupGestureSettings" />
|
||||
|
||||
</PreferenceScreen>
|
@@ -18,7 +18,7 @@
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
||||
android:title="@string/language_input_gesture_title" >
|
||||
android:title="@string/language_settings" >
|
||||
|
||||
<Preference
|
||||
android:key="phone_language"
|
||||
@@ -62,43 +62,6 @@
|
||||
android:title="@string/user_dict_settings_title"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="gesture_settings_category"
|
||||
android:title="@string/gesture_preference_title"
|
||||
settings:keywords="@string/keywords_gesture">
|
||||
|
||||
<Preference
|
||||
android:key="gesture_assist_input_summary"
|
||||
android:title="@string/assist_gesture_title"
|
||||
android:fragment="com.android.settings.gestures.AssistGestureSettings" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_swipe_down_fingerprint_input_summary"
|
||||
android:title="@string/fingerprint_swipe_for_notifications_title"
|
||||
android:fragment="com.android.settings.gestures.SwipeToNotificationSettings" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_double_tap_screen_input_summary"
|
||||
android:title="@string/ambient_display_title"
|
||||
android:fragment="com.android.settings.gestures.DoubleTapScreenSettings" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_pick_up_input_summary"
|
||||
android:title="@string/ambient_display_pickup_title"
|
||||
android:fragment="com.android.settings.gestures.PickupGestureSettings" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_double_tap_power_input_summary"
|
||||
android:title="@string/double_tap_power_for_camera_title"
|
||||
android:fragment="com.android.settings.gestures.DoubleTapPowerSettings" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_double_twist_input_summary"
|
||||
android:title="@string/double_twist_for_camera_mode_title"
|
||||
android:fragment="com.android.settings.gestures.DoubleTwistGestureSettings" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory>
|
||||
|
||||
<com.android.settings.PointerSpeedPreference
|
||||
|
@@ -18,6 +18,13 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/header_category_system">
|
||||
|
||||
<Preference
|
||||
android:key="gesture_settings"
|
||||
android:title="@string/gesture_preference_title"
|
||||
android:icon="@drawable/ic_settings_gestures"
|
||||
android:order="-250"
|
||||
android:fragment="com.android.settings.gestures.GestureSettings" />
|
||||
|
||||
<!-- Backup -->
|
||||
<Preference
|
||||
android:key="backup_settings"
|
||||
|
123
src/com/android/settings/gestures/GestureSettings.java
Normal file
123
src/com/android/settings/gestures/GestureSettings.java
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* 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.os.UserHandle;
|
||||
import android.provider.SearchIndexableResource;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
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.List;
|
||||
|
||||
public class GestureSettings extends DashboardFragment {
|
||||
|
||||
private static final String TAG = "GestureSettings";
|
||||
|
||||
private static final String KEY_ASSIST = "gesture_assist_input_summary";
|
||||
private static final String KEY_SWIPE_DOWN = "gesture_swipe_down_fingerprint_input_summary";
|
||||
private static final String KEY_DOUBLE_TAP_POWER = "gesture_double_tap_power_input_summary";
|
||||
private static final String KEY_DOUBLE_TWIST = "gesture_double_twist_input_summary";
|
||||
private static final String KEY_DOUBLE_TAP_SCREEN = "gesture_double_tap_screen_input_summary";
|
||||
private static final String KEY_PICK_UP = "gesture_pick_up_input_summary";
|
||||
|
||||
private AmbientDisplayConfiguration mAmbientDisplayConfig;
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.SETTINGS_GESTURES;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLogTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.gestures;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
|
||||
if (mAmbientDisplayConfig == null) {
|
||||
mAmbientDisplayConfig = new AmbientDisplayConfiguration(context);
|
||||
}
|
||||
|
||||
return buildPreferenceControllers(context, getLifecycle(), mAmbientDisplayConfig);
|
||||
}
|
||||
|
||||
static List<AbstractPreferenceController> buildPreferenceControllers(
|
||||
@NonNull Context context, @Nullable Lifecycle lifecycle,
|
||||
@NonNull AmbientDisplayConfiguration ambientDisplayConfiguration) {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(new AssistGesturePreferenceController(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));
|
||||
return controllers;
|
||||
}
|
||||
|
||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||
Context context, boolean enabled) {
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.gestures;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> getPreferenceControllers(
|
||||
Context context) {
|
||||
return buildPreferenceControllers(context, null,
|
||||
new AmbientDisplayConfiguration(context));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
// Duplicates in summary and details pages.
|
||||
keys.add(KEY_ASSIST);
|
||||
keys.add(KEY_SWIPE_DOWN);
|
||||
keys.add(KEY_DOUBLE_TAP_POWER);
|
||||
keys.add(KEY_DOUBLE_TWIST);
|
||||
keys.add(KEY_DOUBLE_TAP_SCREEN);
|
||||
keys.add(KEY_PICK_UP);
|
||||
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
}
|
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* 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.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.support.v7.preference.Preference;
|
||||
|
||||
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GesturesSettingPreferenceController extends AbstractPreferenceController
|
||||
implements PreferenceControllerMixin {
|
||||
|
||||
private static final String KEY_GESTURES_SETTINGS = "gesture_settings";
|
||||
|
||||
private final AssistGestureFeatureProvider mFeatureProvider;
|
||||
private List<AbstractPreferenceController> mGestureControllers;
|
||||
|
||||
public GesturesSettingPreferenceController(Context context) {
|
||||
super(context);
|
||||
mFeatureProvider = FeatureFactory.getFactory(context).getAssistGestureFeatureProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
if (mGestureControllers == null) {
|
||||
mGestureControllers = GestureSettings.buildPreferenceControllers(mContext,
|
||||
null /* lifecycle */, new AmbientDisplayConfiguration(mContext));
|
||||
}
|
||||
boolean isAvailable = false;
|
||||
for (AbstractPreferenceController controller : mGestureControllers) {
|
||||
isAvailable = isAvailable || controller.isAvailable();
|
||||
}
|
||||
return isAvailable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return KEY_GESTURES_SETTINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
if (!mFeatureProvider.isSensorAvailable(mContext)) {
|
||||
preference.setSummary("");
|
||||
}
|
||||
final ContentResolver contentResolver = mContext.getContentResolver();
|
||||
final boolean assistGestureEnabled = Settings.Secure.getInt(
|
||||
contentResolver, Settings.Secure.ASSIST_GESTURE_ENABLED, 1) != 0;
|
||||
final boolean assistGestureSilenceEnabled = Settings.Secure.getInt(
|
||||
contentResolver, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 1) != 0;
|
||||
final String summary;
|
||||
if (mFeatureProvider.isSupported(mContext) && assistGestureEnabled) {
|
||||
summary = mContext.getString(
|
||||
R.string.language_input_gesture_summary_on_with_assist);
|
||||
} else if (assistGestureSilenceEnabled) {
|
||||
summary = mContext.getString(
|
||||
R.string.language_input_gesture_summary_on_non_assist);
|
||||
} else {
|
||||
summary = mContext.getString(R.string.language_input_gesture_summary_off);
|
||||
}
|
||||
preference.setSummary(summary);
|
||||
}
|
||||
|
||||
}
|
@@ -21,35 +21,24 @@ import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.SearchIndexableResource;
|
||||
import android.provider.Settings;
|
||||
import android.speech.tts.TtsEngines;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.text.TextUtils;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.applications.defaultapps.DefaultAutofillPreferenceController;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.dashboard.SummaryLoader;
|
||||
import com.android.settings.gestures.AssistGestureFeatureProvider;
|
||||
import com.android.settings.gestures.AssistGesturePreferenceController;
|
||||
import com.android.settings.gestures.DoubleTapPowerPreferenceController;
|
||||
import com.android.settings.gestures.DoubleTapScreenPreferenceController;
|
||||
import com.android.settings.gestures.DoubleTwistPreferenceController;
|
||||
import com.android.settings.gestures.PickupGesturePreferenceController;
|
||||
import com.android.settings.gestures.SwipeToNotificationPreferenceController;
|
||||
import com.android.settings.inputmethod.GameControllerPreferenceController;
|
||||
import com.android.settings.inputmethod.PhysicalKeyboardPreferenceController;
|
||||
import com.android.settings.inputmethod.SpellCheckerPreferenceController;
|
||||
import com.android.settings.inputmethod.VirtualKeyboardPreferenceController;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
@@ -63,14 +52,6 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
||||
private static final String TAG = "LangAndInputSettings";
|
||||
|
||||
private static final String KEY_TEXT_TO_SPEECH = "tts_settings_summary";
|
||||
private static final String KEY_ASSIST = "gesture_assist_input_summary";
|
||||
private static final String KEY_SWIPE_DOWN = "gesture_swipe_down_fingerprint_input_summary";
|
||||
private static final String KEY_DOUBLE_TAP_POWER = "gesture_double_tap_power_input_summary";
|
||||
private static final String KEY_DOUBLE_TWIST = "gesture_double_twist_input_summary";
|
||||
private static final String KEY_DOUBLE_TAP_SCREEN = "gesture_double_tap_screen_input_summary";
|
||||
private static final String KEY_PICK_UP = "gesture_pick_up_input_summary";
|
||||
|
||||
private AmbientDisplayConfiguration mAmbientDisplayConfig;
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
@@ -99,7 +80,7 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
activity.setTitle(R.string.language_input_gesture_title);
|
||||
activity.setTitle(R.string.language_settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,16 +90,11 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
|
||||
if (mAmbientDisplayConfig == null) {
|
||||
mAmbientDisplayConfig = new AmbientDisplayConfiguration(context);
|
||||
}
|
||||
|
||||
return buildPreferenceControllers(context, getLifecycle(), mAmbientDisplayConfig);
|
||||
return buildPreferenceControllers(context, getLifecycle());
|
||||
}
|
||||
|
||||
private static List<AbstractPreferenceController> buildPreferenceControllers(@NonNull Context context,
|
||||
@Nullable Lifecycle lifecycle,
|
||||
@NonNull AmbientDisplayConfiguration ambientDisplayConfiguration) {
|
||||
private static List<AbstractPreferenceController> buildPreferenceControllers(
|
||||
@NonNull Context context, @Nullable Lifecycle lifecycle) {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
// Language
|
||||
controllers.add(new PhoneLanguagePreferenceController(context));
|
||||
@@ -135,79 +111,41 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
||||
}
|
||||
|
||||
controllers.add(gameControllerPreferenceController);
|
||||
// Gestures
|
||||
controllers.add(new AssistGesturePreferenceController(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 DefaultAutofillPreferenceController(context));
|
||||
return controllers;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void setAmbientDisplayConfig(AmbientDisplayConfiguration ambientConfig) {
|
||||
mAmbientDisplayConfig = ambientConfig;
|
||||
}
|
||||
|
||||
private static class SummaryProvider implements SummaryLoader.SummaryProvider {
|
||||
|
||||
private final Context mContext;
|
||||
private final SummaryLoader mSummaryLoader;
|
||||
private final AssistGestureFeatureProvider mFeatureProvider;
|
||||
|
||||
public SummaryProvider(Context context, SummaryLoader summaryLoader) {
|
||||
mContext = context;
|
||||
mSummaryLoader = summaryLoader;
|
||||
mFeatureProvider = FeatureFactory.getFactory(context).getAssistGestureFeatureProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListening(boolean listening) {
|
||||
final ContentResolver contentResolver = mContext.getContentResolver();
|
||||
if (listening) {
|
||||
if (mFeatureProvider.isSensorAvailable(mContext)) {
|
||||
final boolean assistGestureEnabled = Settings.Secure.getInt(
|
||||
contentResolver, Settings.Secure.ASSIST_GESTURE_ENABLED, 1) != 0;
|
||||
final boolean assistGestureSilenceEnabled = Settings.Secure.getInt(
|
||||
contentResolver, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED,
|
||||
1) != 0;
|
||||
String summary;
|
||||
if (mFeatureProvider.isSupported(mContext) && assistGestureEnabled) {
|
||||
summary = mContext.getString(
|
||||
R.string.language_input_gesture_summary_on_with_assist);
|
||||
} else if (assistGestureSilenceEnabled) {
|
||||
summary = mContext.getString(
|
||||
R.string.language_input_gesture_summary_on_non_assist);
|
||||
} else {
|
||||
summary = mContext.getString(R.string.language_input_gesture_summary_off);
|
||||
}
|
||||
mSummaryLoader.setSummary(this, summary);
|
||||
} else {
|
||||
final String flattenComponent = Settings.Secure.getString(
|
||||
contentResolver, Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
if (!TextUtils.isEmpty(flattenComponent)) {
|
||||
final PackageManager packageManage = mContext.getPackageManager();
|
||||
final String pkg = ComponentName.unflattenFromString(flattenComponent)
|
||||
final String flattenComponent = Settings.Secure.getString(
|
||||
contentResolver, Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
if (!TextUtils.isEmpty(flattenComponent)) {
|
||||
final PackageManager packageManage = mContext.getPackageManager();
|
||||
final String pkg = ComponentName.unflattenFromString(flattenComponent)
|
||||
.getPackageName();
|
||||
final InputMethodManager imm = (InputMethodManager)
|
||||
final InputMethodManager imm = (InputMethodManager)
|
||||
mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
final List<InputMethodInfo> imis = imm.getInputMethodList();
|
||||
for (InputMethodInfo imi : imis) {
|
||||
if (TextUtils.equals(imi.getPackageName(), pkg)) {
|
||||
mSummaryLoader.setSummary(this, imi.loadLabel(packageManage));
|
||||
return;
|
||||
}
|
||||
final List<InputMethodInfo> imis = imm.getInputMethodList();
|
||||
for (InputMethodInfo imi : imis) {
|
||||
if (TextUtils.equals(imi.getPackageName(), pkg)) {
|
||||
mSummaryLoader.setSummary(this, imi.loadLabel(packageManage));
|
||||
return;
|
||||
}
|
||||
}
|
||||
mSummaryLoader.setSummary(this, "");
|
||||
}
|
||||
mSummaryLoader.setSummary(this, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -226,9 +164,9 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
|
||||
return buildPreferenceControllers(context, null,
|
||||
new AmbientDisplayConfiguration(context));
|
||||
public List<AbstractPreferenceController> getPreferenceControllers(
|
||||
Context context) {
|
||||
return buildPreferenceControllers(context, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -236,12 +174,6 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
||||
List<String> keys = super.getNonIndexableKeys(context);
|
||||
// Duplicates in summary and details pages.
|
||||
keys.add(KEY_TEXT_TO_SPEECH);
|
||||
keys.add(KEY_ASSIST);
|
||||
keys.add(KEY_SWIPE_DOWN);
|
||||
keys.add(KEY_DOUBLE_TAP_POWER);
|
||||
keys.add(KEY_DOUBLE_TWIST);
|
||||
keys.add(KEY_DOUBLE_TAP_SCREEN);
|
||||
keys.add(KEY_PICK_UP);
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
@@ -58,6 +58,7 @@ import com.android.settings.gestures.AssistGestureSettings;
|
||||
import com.android.settings.gestures.DoubleTapPowerSettings;
|
||||
import com.android.settings.gestures.DoubleTapScreenSettings;
|
||||
import com.android.settings.gestures.DoubleTwistGestureSettings;
|
||||
import com.android.settings.gestures.GestureSettings;
|
||||
import com.android.settings.gestures.PickupGestureSettings;
|
||||
import com.android.settings.gestures.SwipeToNotificationSettings;
|
||||
import com.android.settings.inputmethod.AvailableVirtualKeyboardFragment;
|
||||
@@ -167,6 +168,7 @@ public final class SearchIndexableResources {
|
||||
addIndex(DoubleTwistGestureSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_gestures);
|
||||
addIndex(SwipeToNotificationSettings.class, NO_DATA_RES_ID,
|
||||
R.drawable.ic_settings_gestures);
|
||||
addIndex(GestureSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_gestures);
|
||||
addIndex(LanguageAndInputSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_language);
|
||||
addIndex(LocationSettings.class, R.xml.location_settings, R.drawable.ic_settings_location);
|
||||
addIndex(ScanningSettings.class, R.xml.location_scanning, R.drawable.ic_settings_location);
|
||||
|
@@ -25,6 +25,7 @@ import com.android.settings.backup.BackupSettingsActivityPreferenceController;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController;
|
||||
import com.android.settings.deviceinfo.SystemUpdatePreferenceController;
|
||||
import com.android.settings.gestures.GesturesSettingPreferenceController;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.search.Indexable;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
@@ -69,6 +70,7 @@ public class SystemDashboardFragment extends DashboardFragment {
|
||||
controllers.add(new SystemUpdatePreferenceController(context, UserManager.get(context)));
|
||||
controllers.add(new AdditionalSystemUpdatePreferenceController(context));
|
||||
controllers.add(new BackupSettingsActivityPreferenceController(context));
|
||||
controllers.add(new GesturesSettingPreferenceController(context));
|
||||
return controllers;
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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 static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.support.v7.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.testutils.shadow.ShadowSecureSettings;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
|
||||
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.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public class GesturesSettingsPreferenceControllerTest {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Activity mActivity;
|
||||
@Mock
|
||||
private Preference mPreference;
|
||||
|
||||
private GesturesSettingPreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
FakeFeatureFactory.setupForTest(mActivity);
|
||||
mController = new GesturesSettingPreferenceController(mActivity);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAvailable_hasGesture_shouldReturnTrue() {
|
||||
final List<AbstractPreferenceController> mControllers = new ArrayList<>();
|
||||
mControllers.add(new AbstractPreferenceController(RuntimeEnvironment.application) {
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return "test_key";
|
||||
}
|
||||
});
|
||||
ReflectionHelpers.setField(mController, "mGestureControllers", mControllers);
|
||||
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAvailable_noGesture_shouldReturnFalse() {
|
||||
ReflectionHelpers.setField(mController, "mGestureControllers",
|
||||
new ArrayList<AbstractPreferenceController>());
|
||||
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = {ShadowSecureSettings.class})
|
||||
public void updateState_assistSupported_shouldSetToAssistGestureStatus() {
|
||||
final FakeFeatureFactory featureFactory =
|
||||
(FakeFeatureFactory) FakeFeatureFactory.getFactory(mActivity);
|
||||
when(featureFactory.assistGestureFeatureProvider.isSupported(any(Context.class)))
|
||||
.thenReturn(true);
|
||||
when(featureFactory.assistGestureFeatureProvider.isSensorAvailable(any(Context.class)))
|
||||
.thenReturn(true);
|
||||
|
||||
final ContentResolver cr = mActivity.getContentResolver();
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_ENABLED, 0);
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 0);
|
||||
mController.updateState(mPreference);
|
||||
verify(mActivity).getString(R.string.language_input_gesture_summary_off);
|
||||
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_ENABLED, 1);
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 0);
|
||||
mController.updateState(mPreference);
|
||||
verify(mActivity).getString(R.string.language_input_gesture_summary_on_with_assist);
|
||||
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_ENABLED, 0);
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 1);
|
||||
mController.updateState(mPreference);
|
||||
verify(mActivity).getString(R.string.language_input_gesture_summary_on_non_assist);
|
||||
}
|
||||
|
||||
}
|
@@ -41,11 +41,9 @@ import android.view.inputmethod.InputMethodInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.view.textservice.TextServicesManager;
|
||||
|
||||
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.dashboard.SummaryLoader;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.testutils.XmlTestUtils;
|
||||
import com.android.settings.testutils.shadow.ShadowSecureSettings;
|
||||
@@ -88,7 +86,6 @@ public class LanguageAndInputSettingsTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
FakeFeatureFactory.setupForTest(mActivity);
|
||||
when(mActivity.getSystemService(Context.USER_SERVICE)).thenReturn(mock(UserManager.class));
|
||||
when(mActivity.getSystemService(Context.INPUT_SERVICE))
|
||||
.thenReturn(mock(InputManager.class));
|
||||
@@ -157,39 +154,6 @@ public class LanguageAndInputSettingsTest {
|
||||
verify(loader).setSummary(provider, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = {
|
||||
ShadowSecureSettings.class,
|
||||
})
|
||||
public void testSummary_assistSupported_shouldSetToAssistGestureStatus() {
|
||||
final FakeFeatureFactory featureFactory =
|
||||
(FakeFeatureFactory) FakeFeatureFactory.getFactory(mActivity);
|
||||
when(featureFactory.assistGestureFeatureProvider.isSupported(any(Context.class)))
|
||||
.thenReturn(true);
|
||||
when(featureFactory.assistGestureFeatureProvider.isSensorAvailable(any(Context.class)))
|
||||
.thenReturn(true);
|
||||
|
||||
final SummaryLoader loader = mock(SummaryLoader.class);
|
||||
SummaryLoader.SummaryProvider provider = mFragment.SUMMARY_PROVIDER_FACTORY
|
||||
.createSummaryProvider(mActivity, loader);
|
||||
|
||||
final ContentResolver cr = mActivity.getContentResolver();
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_ENABLED, 0);
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 0);
|
||||
provider.setListening(true);
|
||||
verify(mActivity).getString(R.string.language_input_gesture_summary_off);
|
||||
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_ENABLED, 1);
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 0);
|
||||
provider.setListening(true);
|
||||
verify(mActivity).getString(R.string.language_input_gesture_summary_on_with_assist);
|
||||
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_ENABLED, 0);
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 1);
|
||||
provider.setListening(true);
|
||||
verify(mActivity).getString(R.string.language_input_gesture_summary_on_non_assist);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonIndexableKeys_existInXmlLayout() {
|
||||
final Context context = spy(RuntimeEnvironment.application);
|
||||
@@ -236,7 +200,6 @@ public class LanguageAndInputSettingsTest {
|
||||
public TestFragment(Context context) {
|
||||
mContext = context;
|
||||
mLifecycle = mock(Lifecycle.class);
|
||||
setAmbientDisplayConfig(mock(AmbientDisplayConfiguration.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -16,14 +16,23 @@
|
||||
|
||||
package com.android.settings.system;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.UserManager;
|
||||
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.testutils.XmlTestUtils;
|
||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||
import com.android.settings.testutils.shadow.ShadowUserManager;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
@@ -31,19 +40,25 @@ import org.robolectric.annotation.Config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
|
||||
shadows = {
|
||||
ShadowUserManager.class
|
||||
ShadowUserManager.class,
|
||||
SettingsShadowResources.class,
|
||||
})
|
||||
public class SystemDashboardFragmentTest {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
SettingsShadowResources.overrideResource(
|
||||
com.android.internal.R.bool.config_supportSystemNavigationKeys, true);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
SettingsShadowResources.reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonIndexableKeys_existInXmlLayout() {
|
||||
final Context context = spy(RuntimeEnvironment.application);
|
||||
|
Reference in New Issue
Block a user