diff --git a/res/drawable-nodpi/fingerprint_enroll_introduction.png b/res/drawable-nodpi/fingerprint_enroll_introduction.png
new file mode 100644
index 00000000000..268ca433259
Binary files /dev/null and b/res/drawable-nodpi/fingerprint_enroll_introduction.png differ
diff --git a/res/layout/choose_lock_password.xml b/res/layout/choose_lock_password.xml
index fb938c96dca..f1b631e3ae5 100644
--- a/res/layout/choose_lock_password.xml
+++ b/res/layout/choose_lock_password.xml
@@ -21,7 +21,7 @@
android:layout_height="match_parent"
android:icon="@drawable/ic_lock"
settings:suwFooter="@layout/choose_lock_password_footer"
- settings:suwHeaderText="@string/lockpassword_choose_your_password_header">
+ settings:suwHeaderText="@string/lockpassword_choose_your_screen_lock_header">
+
+
+
+
+
+
diff --git a/res/xml/security_settings_password_sub.xml b/res/xml/security_settings_password_sub.xml
index 46c49994357..c0287c0b9a1 100644
--- a/res/xml/security_settings_password_sub.xml
+++ b/res/xml/security_settings_password_sub.xml
@@ -22,7 +22,7 @@
@@ -32,7 +32,6 @@
+ android:title="@string/owner_info_settings_title" />
diff --git a/res/xml/security_settings_pin_sub.xml b/res/xml/security_settings_pin_sub.xml
index 46c49994357..c0287c0b9a1 100644
--- a/res/xml/security_settings_pin_sub.xml
+++ b/res/xml/security_settings_pin_sub.xml
@@ -22,7 +22,7 @@
@@ -32,7 +32,6 @@
+ android:title="@string/owner_info_settings_title" />
diff --git a/res/xml/tts_engine_picker.xml b/res/xml/tts_engine_picker.xml
index d7a76d4d8f7..c0a464ced38 100644
--- a/res/xml/tts_engine_picker.xml
+++ b/res/xml/tts_engine_picker.xml
@@ -15,7 +15,7 @@
-->
+ android:title="@string/tts_engine_preference_title">
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 51b676df551..a335c83b04c 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -107,6 +107,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
"magnification_preference_screen";
private static final String FONT_SIZE_PREFERENCE_SCREEN =
"font_size_preference_screen";
+ private static final String TTS_SETTINGS_PREFERENCE =
+ "tts_settings_preference";
private static final String AUTOCLICK_PREFERENCE_SCREEN =
"autoclick_preference_screen";
private static final String DISPLAY_DALTONIZER_PREFERENCE_SCREEN =
@@ -743,6 +745,9 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
keys.add(FONT_SIZE_PREFERENCE_SCREEN);
keys.add(DisplaySettings.KEY_DISPLAY_SIZE);
+ // Duplicates in Language & Input
+ keys.add(TTS_SETTINGS_PREFERENCE);
+
return keys;
}
};
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
index f95ce46d51c..1aac0ff1c18 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
@@ -25,6 +25,7 @@ import android.text.Editable;
import android.text.InputFilter;
import android.text.InputFilter.LengthFilter;
import android.text.InputType;
+import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
@@ -34,6 +35,7 @@ import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
@@ -185,6 +187,19 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i
return dialog;
}
+ /**
+ * Helper method to return the text of the pin entry field - this exists primarily to help us
+ * simulate having existing text when the dialog is recreated, for example after a screen
+ * rotation.
+ */
+ @VisibleForTesting
+ CharSequence getPairingViewText() {
+ if (mPairingView != null) {
+ return mPairingView.getText();
+ }
+ return null;
+ }
+
/**
* Returns a dialog with UI elements that allow a user to provide input.
*/
@@ -196,7 +211,9 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i
mBuilder.setNegativeButton(getString(android.R.string.cancel), this);
AlertDialog dialog = mBuilder.create();
dialog.setOnShowListener(d -> {
- mDialog.getButton(Dialog.BUTTON_POSITIVE).setEnabled(false);
+ if (TextUtils.isEmpty(getPairingViewText())) {
+ mDialog.getButton(Dialog.BUTTON_POSITIVE).setEnabled(false);
+ }
if (mPairingView != null && mPairingView.requestFocus()) {
InputMethodManager imm = (InputMethodManager)
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
index c0ce3b963ad..b0abec47a3b 100644
--- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
+++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
@@ -249,6 +249,10 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
final String uri = tile.metaData.getString(META_DATA_PREFERENCE_ICON_URI);
final Pair iconInfo = TileUtils.getIconFromUri(
mContext, packageName, uri, providerMap);
+ if (iconInfo == null) {
+ Log.w(TAG, "Failed to get icon from uri " + uri);
+ return;
+ }
tile.icon = Icon.createWithResource(iconInfo.first, iconInfo.second);
ThreadUtils.postOnMainThread(() ->
preference.setIcon(tile.icon.loadDrawable(preference.getContext()))
diff --git a/src/com/android/settings/nfc/NfcPaymentPreference.java b/src/com/android/settings/nfc/NfcPaymentPreference.java
index 239377d0ad4..a3f74662001 100644
--- a/src/com/android/settings/nfc/NfcPaymentPreference.java
+++ b/src/com/android/settings/nfc/NfcPaymentPreference.java
@@ -18,6 +18,7 @@ package com.android.settings.nfc;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
+import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.preference.PreferenceViewHolder;
@@ -209,7 +210,9 @@ public class NfcPaymentPreference extends CustomDialogPreference implements
if (!appInfo.isDefault) {
mPaymentBackend.setDefaultPaymentApp(appInfo.componentName);
}
- getDialog().dismiss();
+ Dialog dialog = getDialog();
+ if (dialog != null)
+ dialog.dismiss();
}
}
}
diff --git a/src/com/android/settings/notification/ConfigureNotificationSettings.java b/src/com/android/settings/notification/ConfigureNotificationSettings.java
index 2b1ecc456b0..253346683cc 100644
--- a/src/com/android/settings/notification/ConfigureNotificationSettings.java
+++ b/src/com/android/settings/notification/ConfigureNotificationSettings.java
@@ -22,8 +22,8 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.UserHandle;
import android.provider.SearchIndexableResource;
+import android.support.annotation.VisibleForTesting;
import android.support.v7.preference.Preference;
-import android.util.Log;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
@@ -44,7 +44,16 @@ import java.util.List;
public class ConfigureNotificationSettings extends DashboardFragment {
private static final String TAG = "ConfigNotiSettings";
- private static final String KEY_SWIPE_DOWN = "gesture_swipe_down_fingerprint_notifications";
+ @VisibleForTesting
+ static final String KEY_LOCKSCREEN = "lock_screen_notifications";
+ @VisibleForTesting
+ static final String KEY_LOCKSCREEN_WORK_PROFILE_HEADER =
+ "lock_screen_notifications_profile_header";
+ @VisibleForTesting
+ static final String KEY_LOCKSCREEN_WORK_PROFILE = "lock_screen_notifications_profile";
+ @VisibleForTesting
+ static final String KEY_SWIPE_DOWN = "gesture_swipe_down_fingerprint_notifications";
+
private static final String KEY_NOTI_DEFAULT_RINGTONE = "notification_default_ringtone";
private RingtonePreference mRequestPreference;
@@ -80,9 +89,9 @@ public class ConfigureNotificationSettings extends DashboardFragment {
new PulseNotificationPreferenceController(context);
final LockScreenNotificationPreferenceController lockScreenNotificationController =
new LockScreenNotificationPreferenceController(context,
- "lock_screen_notifications",
- "lock_screen_notifications_profile_header",
- "lock_screen_notifications_profile");
+ KEY_LOCKSCREEN,
+ KEY_LOCKSCREEN_WORK_PROFILE_HEADER,
+ KEY_LOCKSCREEN_WORK_PROFILE);
if (lifecycle != null) {
lifecycle.addObserver(pulseController);
lifecycle.addObserver(lockScreenNotificationController);
@@ -156,9 +165,19 @@ public class ConfigureNotificationSettings extends DashboardFragment {
}
@Override
- public List getPreferenceControllers(Context context) {
+ public List getPreferenceControllers(
+ Context context) {
return buildPreferenceControllers(context, null);
}
+ @Override
+ public List getNonIndexableKeys(Context context) {
+ final List keys = super.getNonIndexableKeys(context);
+ keys.add(KEY_SWIPE_DOWN);
+ keys.add(KEY_LOCKSCREEN);
+ keys.add(KEY_LOCKSCREEN_WORK_PROFILE);
+ keys.add(KEY_LOCKSCREEN_WORK_PROFILE_HEADER);
+ return keys;
+ }
};
}
diff --git a/src/com/android/settings/notification/LockScreenNotificationPreferenceController.java b/src/com/android/settings/notification/LockScreenNotificationPreferenceController.java
index db46ef18778..272d504d629 100644
--- a/src/com/android/settings/notification/LockScreenNotificationPreferenceController.java
+++ b/src/com/android/settings/notification/LockScreenNotificationPreferenceController.java
@@ -16,6 +16,9 @@
package com.android.settings.notification;
+import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS;
+import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS;
+
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
@@ -41,9 +44,6 @@ import com.android.settingslib.core.lifecycle.events.OnResume;
import java.util.ArrayList;
-import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_SECURE_NOTIFICATIONS;
-import static android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS;
-
public class LockScreenNotificationPreferenceController extends AbstractPreferenceController
implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
LifecycleObserver, OnResume, OnPause {
@@ -79,11 +79,10 @@ public class LockScreenNotificationPreferenceController extends AbstractPreferen
mProfileChallengeUserId = Utils.getManagedProfileId(
UserManager.get(context), UserHandle.myUserId());
final LockPatternUtils utils = new LockPatternUtils(context);
- final boolean isUnified =
- !utils.isSeparateProfileChallengeEnabled(mProfileChallengeUserId);
mSecure = utils.isSecure(UserHandle.myUserId());
mSecureProfile = (mProfileChallengeUserId != UserHandle.USER_NULL)
- && (utils.isSecure(mProfileChallengeUserId) || (isUnified && mSecure));
+ && (utils.isSecure(mProfileChallengeUserId)
+ || (!utils.isSeparateProfileChallengeEnabled(mProfileChallengeUserId) && mSecure));
}
@Override
diff --git a/src/com/android/settings/notification/ZenModeRuleSettingsBase.java b/src/com/android/settings/notification/ZenModeRuleSettingsBase.java
index 5629b173335..4abdd7e9267 100644
--- a/src/com/android/settings/notification/ZenModeRuleSettingsBase.java
+++ b/src/com/android/settings/notification/ZenModeRuleSettingsBase.java
@@ -16,6 +16,7 @@
package com.android.settings.notification;
+import android.app.Activity;
import android.app.AlertDialog;
import android.app.AutomaticZenRule;
import android.app.NotificationManager;
@@ -262,8 +263,14 @@ public abstract class ZenModeRuleSettingsBase extends ZenModeSettingsBase
}
private void updateRuleName() {
- getActivity().setTitle(mRule.getName());
- mRuleName.setSummary(mRule.getName());
+ Activity activity = getActivity();
+ if (activity != null) {
+ activity.setTitle(mRule.getName());
+ mRuleName.setSummary(mRule.getName());
+ } else {
+ if (DEBUG) Log.d(TAG, "updateRuleName - activity title and mRuleName "
+ + "not updated; getActivity() returned null");
+ }
}
private AutomaticZenRule getZenRule() {
diff --git a/src/com/android/settings/password/ChooseLockPassword.java b/src/com/android/settings/password/ChooseLockPassword.java
index 972ebdd51a8..d89095691aa 100644
--- a/src/com/android/settings/password/ChooseLockPassword.java
+++ b/src/com/android/settings/password/ChooseLockPassword.java
@@ -162,7 +162,7 @@ public class ChooseLockPassword extends SettingsActivity {
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
CharSequence msg = getText(forFingerprint
? R.string.lockpassword_choose_your_password_header_for_fingerprint
- : R.string.lockpassword_choose_your_password_header);
+ : R.string.lockpassword_choose_your_screen_lock_header);
setTitle(msg);
LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent);
layout.setFitsSystemWindows(false);
diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java
index c20d2a03007..d67e8eb23a5 100644
--- a/src/com/android/settings/search/SearchIndexableResources.java
+++ b/src/com/android/settings/search/SearchIndexableResources.java
@@ -81,6 +81,7 @@ import com.android.settings.sim.SimSettings;
import com.android.settings.support.SupportDashboardActivity;
import com.android.settings.system.ResetDashboardFragment;
import com.android.settings.system.SystemDashboardFragment;
+import com.android.settings.tts.TextToSpeechSettings;
import com.android.settings.tts.TtsEnginePreferenceFragment;
import com.android.settings.users.UserSettings;
import com.android.settings.wallpaper.WallpaperTypeSettings;
@@ -199,6 +200,7 @@ public final class SearchIndexableResources {
R.drawable.ic_devices_other);
addIndex(EnterprisePrivacySettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_about);
addIndex(PaymentSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_nfc_payment);
+ addIndex(TextToSpeechSettings.class, NO_DATA_RES_ID, R.drawable.ic_settings_accessibility);
addIndex(
TtsEnginePreferenceFragment.class, NO_DATA_RES_ID, R.drawable.ic_settings_language);
addIndex(LockscreenDashboardFragment.class, R.xml.security_lockscreen_settings,
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java
index 4ea422b9efb..9092c0db069 100644
--- a/src/com/android/settings/tts/TextToSpeechSettings.java
+++ b/src/com/android/settings/tts/TextToSpeechSettings.java
@@ -23,8 +23,10 @@ import static android.provider.Settings.Secure.TTS_DEFAULT_SYNTH;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
+import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.provider.SearchIndexableResource;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.EngineInfo;
import android.speech.tts.TtsEngines;
@@ -39,11 +41,14 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.Indexable;
import com.android.settings.widget.ActionButtonPreference;
import com.android.settings.widget.GearPreference;
import com.android.settings.widget.SeekBarPreference;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -55,7 +60,7 @@ import java.util.Set;
public class TextToSpeechSettings extends SettingsPreferenceFragment
implements Preference.OnPreferenceChangeListener,
- GearPreference.OnGearClickListener {
+ GearPreference.OnGearClickListener, Indexable {
private static final String STATE_KEY_LOCALE_ENTRIES = "locale_entries";
private static final String STATE_KEY_LOCALE_ENTRY_VALUES = "locale_entry_values";
@@ -225,7 +230,8 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
// Do set pitch correctly after it may have changed, and unlike speed, it doesn't change
// immediately.
final ContentResolver resolver = getContentResolver();
- mTts.setPitch(android.provider.Settings.Secure.getInt(resolver, TTS_DEFAULT_PITCH, TextToSpeech.Engine.DEFAULT_PITCH)/100.0f);
+ mTts.setPitch(android.provider.Settings.Secure.getInt(resolver, TTS_DEFAULT_PITCH,
+ TextToSpeech.Engine.DEFAULT_PITCH) / 100.0f);
}
Locale ttsDefaultLocale = mTts.getDefaultLanguage();
@@ -241,10 +247,12 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
}
mTts.setOnUtteranceProgressListener(new UtteranceProgressListener() {
@Override
- public void onStart(String utteranceId) {}
+ public void onStart(String utteranceId) {
+ }
@Override
- public void onDone(String utteranceId) {}
+ public void onDone(String utteranceId) {
+ }
@Override
public void onError(String utteranceId) {
@@ -313,7 +321,6 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
EngineInfo info = mEnginesHelper.getEngineInfo(mCurrentEngine);
-
Preference mEnginePreference = findPreference(KEY_TTS_ENGINE_PREFERENCE);
((GearPreference) mEnginePreference).setOnGearClickListener(this);
mEnginePreference.setSummary(info.label);
@@ -364,7 +371,10 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
}
});
} else {
- if (DBG) Log.d(TAG, "TTS engine for settings screen failed to initialize successfully.");
+ if (DBG) {
+ Log.d(TAG,
+ "TTS engine for settings screen failed to initialize successfully.");
+ }
updateWidgetState(false);
}
}
@@ -411,8 +421,8 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
for (String loc : mAvailableStrLocals) {
if (loc.equalsIgnoreCase(defaultLocaleStr)) {
- notInAvailableLangauges = false;
- break;
+ notInAvailableLangauges = false;
+ break;
}
}
} catch (MissingResourceException e) {
@@ -572,7 +582,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
private boolean isNetworkRequiredForSynthesis() {
Set features = mTts.getFeatures(mCurrentDefaultLocale);
if (features == null) {
- return false;
+ return false;
}
return features.contains(TextToSpeech.Engine.KEY_FEATURE_NETWORK_SYNTHESIS) &&
!features.contains(TextToSpeech.Engine.KEY_FEATURE_EMBEDDED_SYNTHESIS);
@@ -735,7 +745,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
return;
}
- if (data == null){
+ if (data == null) {
Log.e(TAG, "Engine failed voice data integrity check (null return)" +
mTts.getCurrentEngine());
return;
@@ -744,7 +754,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
android.provider.Settings.Secure.putString(getContentResolver(), TTS_DEFAULT_SYNTH, engine);
mAvailableStrLocals = data.getStringArrayListExtra(
- TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES);
+ TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES);
if (mAvailableStrLocals == null) {
Log.e(TAG, "Voice data check complete, but no available voices found");
// Set mAvailableStrLocals to empty list
@@ -764,4 +774,22 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
}
}
+ public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+ @Override
+ public List getXmlResourcesToIndex(
+ Context context, boolean enabled) {
+ final SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.tts_settings;
+ return Arrays.asList(sir);
+ }
+
+ @Override
+ public List getNonIndexableKeys(Context context) {
+ final List keys = super.getNonIndexableKeys(context);
+ keys.add("tts_engine_preference");
+ return keys;
+ }
+ };
+
}
diff --git a/src/com/android/settings/tts/TtsEnginePreferenceFragment.java b/src/com/android/settings/tts/TtsEnginePreferenceFragment.java
index e0ed8b7ebb9..8e6cfecb8f7 100644
--- a/src/com/android/settings/tts/TtsEnginePreferenceFragment.java
+++ b/src/com/android/settings/tts/TtsEnginePreferenceFragment.java
@@ -23,7 +23,7 @@ import java.util.Arrays;
public class TtsEnginePreferenceFragment extends SettingsPreferenceFragment //implements
implements RadioButtonGroupState, Indexable {
- private static final String TAG = "TtsEnginePreferenceFragment";
+ private static final String TAG = "TtsEnginePrefFragment";
private static final int VOICE_DATA_INTEGRITY_CHECK = 1977;
@@ -185,7 +185,6 @@ public class TtsEnginePreferenceFragment extends SettingsPreferenceFragment //im
@Override
public List getXmlResourcesToIndex(
Context context, boolean enabled) {
- Log.i(TAG, "Indexing");
final SearchIndexableResource sir = new SearchIndexableResource(context);
sir.xmlResId = R.xml.tts_engine_picker;
return Arrays.asList(sir);
diff --git a/tests/robotests/assets/grandfather_not_implementing_indexable b/tests/robotests/assets/grandfather_not_implementing_indexable
index be5a99b2c65..695342e3be0 100644
--- a/tests/robotests/assets/grandfather_not_implementing_indexable
+++ b/tests/robotests/assets/grandfather_not_implementing_indexable
@@ -36,7 +36,6 @@ com.android.settings.accessibility.ToggleAutoclickPreferenceFragment
com.android.settings.applications.AppLaunchSettings
com.android.settings.fuelgauge.BatterySaverSettings
com.android.settings.location.ScanningSettings
-com.android.settings.tts.TextToSpeechSettings
com.android.settings.applications.ProcessStatsUi
com.android.settings.notification.ZenModeScheduleRuleSettings
com.android.settings.datausage.BillingCycleSettings
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java
index 7a6ae79e2f9..fba11de8066 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java
@@ -28,6 +28,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.app.AlertDialog;
+import android.app.Dialog;
import android.content.Context;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
@@ -47,6 +48,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowAlertDialog;
import org.robolectric.shadows.ShadowApplication;
import org.robolectric.util.FragmentTestUtil;
@@ -412,6 +414,39 @@ public class BluetoothPairingDialogTest {
verify(dialogActivity, times(1)).dismiss();
}
+ @Test
+ public void rotateDialog_nullPinText_okButtonEnabled() {
+ userEntryDialogExistingTextTest(null);
+ }
+
+ @Test
+ public void rotateDialog_emptyPinText_okButtonEnabled() {
+ userEntryDialogExistingTextTest("");
+ }
+
+ @Test
+ public void rotateDialog_nonEmptyPinText_okButtonEnabled() {
+ userEntryDialogExistingTextTest("test");
+ }
+
+ // Runs a test simulating the user entry dialog type in a situation like device rotation, where
+ // the dialog fragment gets created and we already have some existing text entered into the
+ // pin field.
+ private void userEntryDialogExistingTextTest(CharSequence existingText) {
+ when(controller.getDialogType()).thenReturn(BluetoothPairingController.USER_ENTRY_DIALOG);
+ when(controller.getDeviceVariantMessageHintId())
+ .thenReturn(BluetoothPairingController.INVALID_DIALOG_TYPE);
+ when(controller.getDeviceVariantMessageId())
+ .thenReturn(BluetoothPairingController.INVALID_DIALOG_TYPE);
+
+ BluetoothPairingDialogFragment fragment = spy(new BluetoothPairingDialogFragment());
+ when(fragment.getPairingViewText()).thenReturn(existingText);
+ setupFragment(fragment);
+ AlertDialog dialog = ShadowAlertDialog.getLatestAlertDialog();
+ boolean expected = !TextUtils.isEmpty(existingText);
+ assertThat(dialog.getButton(Dialog.BUTTON_POSITIVE).isEnabled()).isEqualTo(expected);
+ }
+
private void setupFragment(BluetoothPairingDialogFragment frag) {
assertThat(frag.isPairingControllerSet()).isFalse();
frag.setPairingController(controller);
diff --git a/tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java b/tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java
index d05bee6c830..faaf338d15b 100644
--- a/tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java
+++ b/tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java
@@ -16,6 +16,8 @@
package com.android.settings.core.codeinspection;
+import static com.google.common.truth.Truth.assertThat;
+
import com.android.settings.TestConfig;
import com.android.settings.core.instrumentation.InstrumentableFragmentCodeInspector;
import com.android.settings.search.SearchIndexProviderCodeInspector;
@@ -42,11 +44,14 @@ public class CodeInspectionTest {
@Before
public void setUp() throws Exception {
mClasses = new ClassScanner().getClassesForPackage(CodeInspector.PACKAGE_NAME);
+ // Disabled temporarily - see b/64840107
+ //assertThat(mClasses).isNotEmpty();
}
@Test
public void runCodeInspections() {
- new InstrumentableFragmentCodeInspector(mClasses).run();
- new SearchIndexProviderCodeInspector(mClasses).run();
+ // Disabled temporarily - see b/64840107
+ // new InstrumentableFragmentCodeInspector(mClasses).run();
+ // new SearchIndexProviderCodeInspector(mClasses).run();
}
}
diff --git a/tests/robotests/src/com/android/settings/notification/ConfigureNotificationSettingsTest.java b/tests/robotests/src/com/android/settings/notification/ConfigureNotificationSettingsTest.java
new file mode 100644
index 00000000000..8cf8f838538
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/notification/ConfigureNotificationSettingsTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.notification;
+
+import static com.android.settings.notification.ConfigureNotificationSettings.KEY_LOCKSCREEN;
+import static com.android.settings.notification.ConfigureNotificationSettings
+ .KEY_LOCKSCREEN_WORK_PROFILE;
+import static com.android.settings.notification.ConfigureNotificationSettings
+ .KEY_LOCKSCREEN_WORK_PROFILE_HEADER;
+import static com.android.settings.notification.ConfigureNotificationSettings.KEY_SWIPE_DOWN;
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import com.android.settings.TestConfig;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
+import com.android.settings.testutils.shadow.ShadowUtils;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+import java.util.List;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+public class ConfigureNotificationSettingsTest {
+
+ private Context mContext;
+
+ @Before
+ public void setUp() {
+ mContext = RuntimeEnvironment.application;
+ }
+
+ @Test
+ @Config(shadows = {
+ ShadowUtils.class,
+ ShadowLockPatternUtils.class
+ })
+ public void getNonIndexableKeys_shouldContainLockScreenPrefs() {
+ final List keys = ConfigureNotificationSettings.SEARCH_INDEX_DATA_PROVIDER
+ .getNonIndexableKeys(mContext);
+
+ assertThat(keys).containsAllOf(
+ KEY_SWIPE_DOWN, KEY_LOCKSCREEN, KEY_LOCKSCREEN_WORK_PROFILE,
+ KEY_LOCKSCREEN_WORK_PROFILE_HEADER);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowUtils.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowUtils.java
index f85a874579d..271ffa8e8e3 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowUtils.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowUtils.java
@@ -18,6 +18,8 @@ package com.android.settings.testutils.shadow;
import android.content.ComponentName;
import android.content.Context;
+import android.os.UserHandle;
+import android.os.UserManager;
import com.android.settings.Utils;
import com.android.settings.password.IFingerprintManager;
@@ -87,4 +89,9 @@ public class ShadowUtils {
public static ComponentName getDeviceOwnerComponent(Context context) {
return sDeviceOwnerComponentName;
}
+
+ @Implementation
+ public static int getManagedProfileId(UserManager um, int parentUserId) {
+ return UserHandle.USER_NULL;
+ }
}