Merge "Update string for battery seekbar" into pi-dev
diff --git a/res/values-sw400dp/config.xml b/res/values-sw320dp/config.xml
similarity index 100%
rename from res/values-sw400dp/config.xml
rename to res/values-sw320dp/config.xml
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2167e8b..fe1786f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -401,6 +401,10 @@
<!-- Summary of checkbox for disabling Bluetooth inband ringing in Development Settings -->
<string name="bluetooth_disable_inband_ringing_summary">Don’t play custom phone ringtones on Bluetooth headsets</string>
+ <!-- Title for Bluetooth device group with media capability group [CHAR LIMIT=none]-->
+ <string name="connected_device_available_media_title">Available media devices</string>
+ <!-- Title for Bluetooth device group with media capability group [CHAR LIMIT=none]-->
+ <string name="connected_device_available_call_title">Available call devices</string>
<!-- Title for connected device group [CHAR LIMIT=none]-->
<string name="connected_device_connected_title">Currently connected</string>
<!-- Title for connected device group [CHAR LIMIT=none]-->
@@ -411,6 +415,8 @@
<string name="connected_device_add_device_summary">Bluetooth will turn on to enable pairing</string>
<!-- Title for other connection preferences [CHAR LIMIT=none]-->
<string name="connected_device_connections_title">Connection preferences</string>
+ <!-- Title for Bluetooth preference to open paired but no connection list [CHAR LIMIT=none]-->
+ <string name="connected_device_previously_connected_title">Previously connected devices</string>
<!-- Date & time settings screen title -->
<string name="date_and_time">Date & time</string>
@@ -8368,8 +8374,6 @@
<string name="system_alert_window_access_title">Display over other apps</string>
<!-- Label for setting which controls whether app can display over other apps [CHAR LIMIT=45] -->
<string name="permit_draw_overlay">Allow display over other apps</string>
- <!-- Link to the apps page for SYSTEM_ALERT_WINDOW settings [CHAR LIMIT=45] -->
- <string name="app_overlay_permission_preference">App display on top permission</string>
<!-- Description of allowing overlay setting [CHAR LIMIT=NONE] -->
<string name="allow_overlay_description">Allow this app to display on top of other apps you\u2019re using. It may interfere with your use of those apps or change the way they seem to appear or behave.</string>
@@ -8411,8 +8415,6 @@
<string name="write_settings_title">Can modify system settings</string>
<!-- Main settings screen item's title to go into the write system settings screen [CHAR LIMIT=30] -->
<string name="write_system_settings">Modify system settings</string>
- <!-- Link to the apps page for WRITE_SETTINGS settings [CHAR LIMIT=52] -->
- <string name="write_settings_preference">App modify system settings permission</string>
<!-- Label for setting which controls whether app can write system settings [CHAR LIMIT=45] -->
<string name="permit_write_settings">Allow modifying system settings</string>
<!-- Description of the write system settings [CHAR LIMIT=NONE] -->
@@ -8893,6 +8895,9 @@
<!-- [CHAR LIMIT=30] Title for dialog for setting to control the default spell checker -->
<string name="choose_spell_checker">Choose spell checker</string>
+ <!-- [CHAR LIMIT=45] Title for the master switch for spell checker, turning off will disable entire spell check feature. -->
+ <string name="spell_checker_master_switch_title">Use spell checker</string>
+
<!-- [CHAR LIMIT=30] Label for the placeholder of the current spell checker name. Used when no spell checker is currently selected. -->
<string name="spell_checker_not_selected">Not selected</string>
diff --git a/res/xml/app_ops_permissions_details.xml b/res/xml/app_ops_permissions_details.xml
index 743090f..cb8711c 100644
--- a/res/xml/app_ops_permissions_details.xml
+++ b/res/xml/app_ops_permissions_details.xml
@@ -21,9 +21,6 @@
android:key="app_ops_settings_switch" />
<Preference
- android:key="app_ops_settings_preference" />
-
- <Preference
android:key="app_ops_settings_description"
android:selectable="false" />
diff --git a/res/xml/draw_overlay_permissions_details.xml b/res/xml/draw_overlay_permissions_details.xml
index 699086f..3e7bec5 100644
--- a/res/xml/draw_overlay_permissions_details.xml
+++ b/res/xml/draw_overlay_permissions_details.xml
@@ -23,10 +23,6 @@
android:title="@string/permit_draw_overlay"/>
<Preference
- android:key="app_ops_settings_preference"
- android:title="@string/app_overlay_permission_preference"/>
-
- <Preference
android:summary="@string/allow_overlay_description"
android:selectable="false"/>
diff --git a/res/xml/write_system_settings_permissions_details.xml b/res/xml/write_system_settings_permissions_details.xml
index 39d69833..82a6931 100644
--- a/res/xml/write_system_settings_permissions_details.xml
+++ b/res/xml/write_system_settings_permissions_details.xml
@@ -23,10 +23,6 @@
android:title="@string/permit_write_settings"/>
<Preference
- android:key="app_ops_settings_preference"
- android:title="@string/write_settings_preference"/>
-
- <Preference
android:summary="@string/write_settings_description"
android:selectable="false"/>
diff --git a/src/com/android/settings/applications/UsageAccessDetails.java b/src/com/android/settings/applications/UsageAccessDetails.java
index c172137..fdb20c9 100644
--- a/src/com/android/settings/applications/UsageAccessDetails.java
+++ b/src/com/android/settings/applications/UsageAccessDetails.java
@@ -45,7 +45,6 @@
private static final String KEY_APP_OPS_PREFERENCE_SCREEN = "app_ops_preference_screen";
private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch";
- private static final String KEY_APP_OPS_SETTINGS_PREFS = "app_ops_settings_preference";
private static final String KEY_APP_OPS_SETTINGS_DESC = "app_ops_settings_description";
// Use a bridge to get the usage stats but don't initialize it to connect with all state.
@@ -53,7 +52,6 @@
private AppStateUsageBridge mUsageBridge;
private AppOpsManager mAppOpsManager;
private SwitchPreference mSwitchPref;
- private Preference mUsagePrefs;
private Preference mUsageDesc;
private Intent mSettingsIntent;
private UsageState mUsageState;
@@ -70,16 +68,13 @@
addPreferencesFromResource(R.xml.app_ops_permissions_details);
mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
- mUsagePrefs = findPreference(KEY_APP_OPS_SETTINGS_PREFS);
mUsageDesc = findPreference(KEY_APP_OPS_SETTINGS_DESC);
getPreferenceScreen().setTitle(R.string.usage_access);
mSwitchPref.setTitle(R.string.permit_usage_access);
- mUsagePrefs.setTitle(R.string.app_usage_preference);
mUsageDesc.setSummary(R.string.usage_access_description);
mSwitchPref.setOnPreferenceChangeListener(this);
- mUsagePrefs.setOnPreferenceClickListener(this);
mSettingsIntent = new Intent(Intent.ACTION_MAIN)
.addCategory(Settings.INTENT_CATEGORY_USAGE_ACCESS_CONFIG)
@@ -88,16 +83,6 @@
@Override
public boolean onPreferenceClick(Preference preference) {
- if (preference == mUsagePrefs) {
- if (mSettingsIntent != null) {
- try {
- getActivity().startActivityAsUser(mSettingsIntent, new UserHandle(mUserId));
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, "Unable to launch app usage access settings " + mSettingsIntent, e);
- }
- }
- return true;
- }
return false;
}
@@ -150,14 +135,10 @@
boolean hasAccess = mUsageState.isPermissible();
mSwitchPref.setChecked(hasAccess);
mSwitchPref.setEnabled(mUsageState.permissionDeclared);
- mUsagePrefs.setEnabled(hasAccess);
ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent,
PackageManager.GET_META_DATA, mUserId);
if (resolveInfo != null) {
- if (findPreference(KEY_APP_OPS_SETTINGS_PREFS) == null) {
- getPreferenceScreen().addPreference(mUsagePrefs);
- }
Bundle metaData = resolveInfo.activityInfo.metaData;
mSettingsIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName,
resolveInfo.activityInfo.name));
@@ -166,10 +147,6 @@
mSwitchPref.setSummary(
metaData.getString(Settings.METADATA_USAGE_ACCESS_REASON));
}
- } else {
- if (findPreference(KEY_APP_OPS_SETTINGS_PREFS) != null) {
- getPreferenceScreen().removePreference(mUsagePrefs);
- }
}
return true;
diff --git a/src/com/android/settings/applications/appinfo/DrawOverlayDetails.java b/src/com/android/settings/applications/appinfo/DrawOverlayDetails.java
index 5cdc47e..bff6669 100644
--- a/src/com/android/settings/applications/appinfo/DrawOverlayDetails.java
+++ b/src/com/android/settings/applications/appinfo/DrawOverlayDetails.java
@@ -49,7 +49,6 @@
OnPreferenceClickListener {
private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch";
- private static final String KEY_APP_OPS_SETTINGS_PREFS = "app_ops_settings_preference";
private static final String LOG_TAG = "DrawOverlayDetails";
private static final int [] APP_OPS_OP_CODE = {
@@ -61,7 +60,6 @@
private AppStateOverlayBridge mOverlayBridge;
private AppOpsManager mAppOpsManager;
private SwitchPreference mSwitchPref;
- private Preference mOverlayPrefs;
private Intent mSettingsIntent;
private OverlayState mOverlayState;
@@ -76,11 +74,9 @@
// find preferences
addPreferencesFromResource(R.xml.draw_overlay_permissions_details);
mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
- mOverlayPrefs = findPreference(KEY_APP_OPS_SETTINGS_PREFS);
// install event listeners
mSwitchPref.setOnPreferenceChangeListener(this);
- mOverlayPrefs.setOnPreferenceClickListener(this);
mSettingsIntent = new Intent(Intent.ACTION_MAIN)
.setAction(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
@@ -109,17 +105,6 @@
@Override
public boolean onPreferenceClick(Preference preference) {
- if (preference == mOverlayPrefs) {
- if (mSettingsIntent != null) {
- try {
- getActivity().startActivityAsUser(mSettingsIntent, new UserHandle(mUserId));
- } catch (ActivityNotFoundException e) {
- Log.w(LOG_TAG, "Unable to launch app draw overlay settings " + mSettingsIntent,
- e);
- }
- }
- return true;
- }
return false;
}
@@ -159,15 +144,9 @@
mSwitchPref.setChecked(isAllowed);
// you cannot ask a user to grant you a permission you did not have!
mSwitchPref.setEnabled(mOverlayState.permissionDeclared && mOverlayState.controlEnabled);
- mOverlayPrefs.setEnabled(isAllowed);
ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent,
PackageManager.GET_META_DATA, mUserId);
- if (resolveInfo == null) {
- if (findPreference(KEY_APP_OPS_SETTINGS_PREFS) != null) {
- getPreferenceScreen().removePreference(mOverlayPrefs);
- }
- }
return true;
}
diff --git a/src/com/android/settings/applications/appinfo/WriteSettingsDetails.java b/src/com/android/settings/applications/appinfo/WriteSettingsDetails.java
index a65de32..b77fbcb 100644
--- a/src/com/android/settings/applications/appinfo/WriteSettingsDetails.java
+++ b/src/com/android/settings/applications/appinfo/WriteSettingsDetails.java
@@ -45,7 +45,6 @@
private static final String KEY_APP_OPS_PREFERENCE_SCREEN = "app_ops_preference_screen";
private static final String KEY_APP_OPS_SETTINGS_SWITCH = "app_ops_settings_switch";
- private static final String KEY_APP_OPS_SETTINGS_PREFS = "app_ops_settings_preference";
private static final String LOG_TAG = "WriteSettingsDetails";
private static final int [] APP_OPS_OP_CODE = {
@@ -57,7 +56,6 @@
private AppStateWriteSettingsBridge mAppBridge;
private AppOpsManager mAppOpsManager;
private SwitchPreference mSwitchPref;
- private Preference mWriteSettingsPrefs;
private Intent mSettingsIntent;
private WriteSettingsState mWriteSettingsState;
@@ -71,10 +69,8 @@
addPreferencesFromResource(R.xml.write_system_settings_permissions_details);
mSwitchPref = (SwitchPreference) findPreference(KEY_APP_OPS_SETTINGS_SWITCH);
- mWriteSettingsPrefs = findPreference(KEY_APP_OPS_SETTINGS_PREFS);
mSwitchPref.setOnPreferenceChangeListener(this);
- mWriteSettingsPrefs.setOnPreferenceClickListener(this);
mSettingsIntent = new Intent(Intent.ACTION_MAIN)
.addCategory(Settings.INTENT_CATEGORY_USAGE_ACCESS_CONFIG)
@@ -83,16 +79,6 @@
@Override
public boolean onPreferenceClick(Preference preference) {
- if (preference == mWriteSettingsPrefs) {
- if (mSettingsIntent != null) {
- try {
- getActivity().startActivityAsUser(mSettingsIntent, new UserHandle(mUserId));
- } catch (ActivityNotFoundException e) {
- Log.w(LOG_TAG, "Unable to launch write system settings " + mSettingsIntent, e);
- }
- }
- return true;
- }
return false;
}
@@ -142,15 +128,9 @@
mSwitchPref.setChecked(canWrite);
// you can't ask a user for a permission you didn't even declare!
mSwitchPref.setEnabled(mWriteSettingsState.permissionDeclared);
- mWriteSettingsPrefs.setEnabled(canWrite);
ResolveInfo resolveInfo = mPm.resolveActivityAsUser(mSettingsIntent,
PackageManager.GET_META_DATA, mUserId);
- if (resolveInfo == null) {
- if (getPreferenceScreen().findPreference(KEY_APP_OPS_SETTINGS_PREFS) != null) {
- getPreferenceScreen().removePreference(mWriteSettingsPrefs);
- }
- }
return true;
}
diff --git a/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceController.java b/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceController.java
index 6f37797..02409b2 100644
--- a/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceController.java
+++ b/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceController.java
@@ -91,6 +91,9 @@
@Override
protected Intent getSettingIntent(DefaultAppInfo info) {
+ if (info == null) {
+ return null;
+ }
final String packageName;
if (info.componentName != null) {
packageName = info.componentName.getPackageName();
diff --git a/src/com/android/settings/fuelgauge/BatteryUtils.java b/src/com/android/settings/fuelgauge/BatteryUtils.java
index 2b79855..3c493b9 100644
--- a/src/com/android/settings/fuelgauge/BatteryUtils.java
+++ b/src/com/android/settings/fuelgauge/BatteryUtils.java
@@ -397,7 +397,7 @@
public void setForceAppStandby(int uid, String packageName,
int mode) {
- final boolean isPreOApp = isLegacyApp(packageName);
+ final boolean isPreOApp = isPreOApp(packageName);
if (isPreOApp) {
// Control whether app could run in the background if it is pre O app
mAppOpsManager.setMode(AppOpsManager.OP_RUN_IN_BACKGROUND, uid, packageName, mode);
@@ -483,7 +483,7 @@
return 0;
}
- public boolean isLegacyApp(final String packageName) {
+ public boolean isPreOApp(final String packageName) {
try {
ApplicationInfo info = mPackageManager.getApplicationInfo(packageName,
PackageManager.GET_META_DATA);
diff --git a/src/com/android/settings/fuelgauge/batterytip/AnomalyDetectionJobService.java b/src/com/android/settings/fuelgauge/batterytip/AnomalyDetectionJobService.java
index 5d0e71d..c2af02a 100644
--- a/src/com/android/settings/fuelgauge/batterytip/AnomalyDetectionJobService.java
+++ b/src/com/android/settings/fuelgauge/batterytip/AnomalyDetectionJobService.java
@@ -127,7 +127,7 @@
&& !isSystemUid(uid)) {
if (anomalyType == StatsManagerConfig.AnomalyType.EXCESSIVE_BG) {
// TODO(b/72385333): check battery percentage draining in batterystats
- if (batteryUtils.isLegacyApp(packageName) && batteryUtils.isAppHeavilyUsed(
+ if (batteryUtils.isPreOApp(packageName) && batteryUtils.isAppHeavilyUsed(
batteryStatsHelper, userManager, uid,
policy.excessiveBgDrainPercentage)) {
Log.e(TAG, "Excessive detected uid=" + uid);
diff --git a/src/com/android/settings/inputmethod/SpellCheckersSettings.java b/src/com/android/settings/inputmethod/SpellCheckersSettings.java
index 3a3f443..5231021 100644
--- a/src/com/android/settings/inputmethod/SpellCheckersSettings.java
+++ b/src/com/android/settings/inputmethod/SpellCheckersSettings.java
@@ -92,7 +92,10 @@
@Override
public void onResume() {
super.onResume();
- mSwitchBar = ((SettingsActivity)getActivity()).getSwitchBar();
+ mSwitchBar = ((SettingsActivity) getActivity()).getSwitchBar();
+ mSwitchBar.setSwitchBarText(
+ R.string.spell_checker_master_switch_title,
+ R.string.spell_checker_master_switch_title);
mSwitchBar.show();
mSwitchBar.addOnSwitchChangeListener(this);
updatePreferenceScreen();
@@ -131,7 +134,7 @@
final Preference preference = screen.getPreference(index);
preference.setEnabled(isSpellCheckerEnabled);
if (preference instanceof SpellCheckerPreference) {
- final SpellCheckerPreference pref = (SpellCheckerPreference)preference;
+ final SpellCheckerPreference pref = (SpellCheckerPreference) preference;
pref.setSelected(mCurrentSci);
}
}
@@ -173,8 +176,13 @@
}
}
- private static int convertSubtypeIndexToDialogItemId(final int index) { return index + 1; }
- private static int convertDialogItemIdToSubtypeIndex(final int item) { return item - 1; }
+ private static int convertSubtypeIndexToDialogItemId(final int index) {
+ return index + 1;
+ }
+
+ private static int convertDialogItemIdToSubtypeIndex(final int item) {
+ return item - 1;
+ }
private void showChooseLanguageDialog() {
if (mDialog != null && mDialog.isShowing()) {
@@ -191,7 +199,7 @@
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.phone_language);
final int subtypeCount = currentSci.getSubtypeCount();
- final CharSequence[] items = new CharSequence[subtypeCount + 1 /* default */ ];
+ final CharSequence[] items = new CharSequence[subtypeCount + 1 /* default */];
items[ITEM_ID_USE_SYSTEM_LANGUAGE] = getSpellCheckerSubtypeLabel(currentSci, null);
int checkedItemId = ITEM_ID_USE_SYSTEM_LANGUAGE;
for (int index = 0; index < subtypeCount; ++index) {
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceControllerTest.java
index 2aa2fa6..a9cfa01 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceControllerTest.java
@@ -89,6 +89,13 @@
}
@Test
+ public void getDefaultApp_noDefaultHome_shouldReturnNull() {
+ when(mPackageManager.getHomeActivities(anyList())).thenReturn(null);
+
+ assertThat(mController.getDefaultAppInfo()).isNull();
+ }
+
+ @Test
public void updateState_noDefaultApp_shouldAskPackageManagerForOnlyApp() {
when(mPackageManager.getHomeActivities(anyList())).thenReturn(null);
mController.updateState(mock(Preference.class));
@@ -152,4 +159,11 @@
.thenReturn(Arrays.asList(mock(ResolveInfo.class), mock(ResolveInfo.class)));
assertThat(mController.getSettingIntent(mController.getDefaultAppInfo())).isNull();
}
+
+ @Test
+ public void testGetSettingIntent_noDefauldHome_shouldReturnNull() {
+ when(mPackageManager.getHomeActivities(anyList())).thenReturn(null);
+ assertThat(mController.getSettingIntent(mController.getDefaultAppInfo())).isNull();
+ }
+
}
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryUtilsTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryUtilsTest.java
index 6518b8e..8b1076d 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryUtilsTest.java
@@ -516,12 +516,12 @@
@Test
public void testIsLegacyApp_SdkLowerThanO_ReturnTrue() {
- assertThat(mBatteryUtils.isLegacyApp(LOW_SDK_PACKAGE)).isTrue();
+ assertThat(mBatteryUtils.isPreOApp(LOW_SDK_PACKAGE)).isTrue();
}
@Test
public void testIsLegacyApp_SdkLargerOrEqualThanO_ReturnFalse() {
- assertThat(mBatteryUtils.isLegacyApp(HIGH_SDK_PACKAGE)).isFalse();
+ assertThat(mBatteryUtils.isPreOApp(HIGH_SDK_PACKAGE)).isFalse();
}
@Test
diff --git a/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java b/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java
index c63f1c2..e07351c 100644
--- a/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java
+++ b/tests/robotests/src/com/android/settings/password/ChooseLockPatternTest.java
@@ -107,6 +107,7 @@
assertThat(drawable.getCreatedFromResId()).isEqualTo(R.drawable.ic_fingerprint_header);
}
+ @Config(qualifiers = "sw300dp")
@Test
public void smallScreens_shouldHideIcon() {
ChooseLockPattern activity = createActivity(true);
diff --git a/tests/robotests/src/com/android/settings/password/SetupChooseLockPatternTest.java b/tests/robotests/src/com/android/settings/password/SetupChooseLockPatternTest.java
index ab08a90..a98db11 100644
--- a/tests/robotests/src/com/android/settings/password/SetupChooseLockPatternTest.java
+++ b/tests/robotests/src/com/android/settings/password/SetupChooseLockPatternTest.java
@@ -17,6 +17,7 @@
package com.android.settings.password;
import static com.google.common.truth.Truth.assertThat;
+
import static org.robolectric.RuntimeEnvironment.application;
import android.app.Activity;
@@ -46,10 +47,6 @@
import org.robolectric.shadows.ShadowAlertDialog;
import org.robolectric.shadows.ShadowPackageManager;
import org.robolectric.util.ReflectionHelpers;
-import org.robolectric.util.ReflectionHelpers.ClassParameter;
-
-import java.util.Collections;
-import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(shadows = {
@@ -89,7 +86,6 @@
assertThat(componentEnabled).isEqualTo(PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
}
- @Config(qualifiers = "sw400dp")
@Test
public void selectPattern_shouldHideOptionsButton() {
Button button = mActivity.findViewById(R.id.screen_lock_options);
@@ -114,6 +110,7 @@
assertThat(count).named("List items shown").isEqualTo(3);
}
+ @Config(qualifiers = "sw300dp")
@Test
public void smallScreens_shouldHideScreenLockOptions() {
Button button = mActivity.findViewById(R.id.screen_lock_options);
diff --git a/tests/uitests/AndroidTest.xml b/tests/uitests/AndroidTest.xml
index fbeea2d..4f9e377 100644
--- a/tests/uitests/AndroidTest.xml
+++ b/tests/uitests/AndroidTest.xml
@@ -14,11 +14,13 @@
limitations under the License.
-->
<configuration description="Run Android Settings Functional UI Tests.">
- <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-suite-tag" value="apct-instrumentation" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
<option name="test-file-name" value="SettingsUITests.apk" />
</target_preparer>
- <option name="test-suite-tag" value="apct" />
<option name="test-tag" value="SettingsUITests" />
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="com.android.settings.ui" />
diff --git a/tests/uitests/src/com/android/settings/ui/inputmethods/SpellCheckerSettingsUITest.java b/tests/uitests/src/com/android/settings/ui/inputmethods/SpellCheckerSettingsUITest.java
new file mode 100644
index 0000000..78c6f8c
--- /dev/null
+++ b/tests/uitests/src/com/android/settings/ui/inputmethods/SpellCheckerSettingsUITest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2018 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.ui.inputmethods;
+
+import static com.android.settings.ui.testutils.SettingsTestUtils.TIMEOUT;
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.Instrumentation;
+import android.content.Intent;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+import android.support.test.uiautomator.By;
+import android.support.test.uiautomator.UiDevice;
+import android.support.test.uiautomator.UiObject2;
+import android.support.test.uiautomator.Until;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class SpellCheckerSettingsUITest {
+
+ private Instrumentation mInstrumentation;
+ private Intent mIntent;
+ private UiDevice mUiDevice;
+
+ @Before
+ public void setUp() {
+ mInstrumentation = InstrumentationRegistry.getInstrumentation();
+ mUiDevice = UiDevice.getInstance(mInstrumentation);
+ mIntent = new Intent().setClassName("com.android.settings",
+ "com.android.settings.Settings$SpellCheckersSettingsActivity")
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ }
+
+ @Test
+ public void launchSettings_hasSwitchBar() {
+ mInstrumentation.getContext().startActivity(mIntent);
+ final UiObject2 switchBar =
+ mUiDevice.wait(Until.findObject(By.text("Use spell checker")), TIMEOUT);
+
+ assertThat(switchBar).isNotNull();
+ }
+}
diff --git a/tests/unit/AndroidTest.xml b/tests/unit/AndroidTest.xml
index b74c1e3..34be41f 100644
--- a/tests/unit/AndroidTest.xml
+++ b/tests/unit/AndroidTest.xml
@@ -14,11 +14,13 @@
limitations under the License.
-->
<configuration description="Runs Settings Test Cases.">
- <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-suite-tag" value="apct-instrumentation" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
<option name="test-file-name" value="SettingsUnitTests.apk" />
</target_preparer>
- <option name="test-suite-tag" value="apct" />
<option name="test-tag" value="SettingsUnitTests" />
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="com.android.settings.tests.unit" />