release-request-38d4765e-6779-4912-a79f-25f77b8184a7-for-git_pi-release-4288638 snap-temp-L71800000095143664
Change-Id: If392efd80000847c8d4cc50f16dd239039796c93
This commit is contained in:
BIN
res/drawable-nodpi/fingerprint_enroll_introduction.png
Normal file
BIN
res/drawable-nodpi/fingerprint_enroll_introduction.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
@@ -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">
|
||||
|
||||
<LinearLayout
|
||||
style="@style/SuwContentFrame"
|
||||
|
||||
@@ -45,6 +45,20 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<com.android.setupwizardlib.view.FillContentLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
style="@style/SuwContentIllustration"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/fingerprint_enroll_introduction" />
|
||||
|
||||
</com.android.setupwizardlib.view.FillContentLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.setupwizardlib.GlifLayout>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<com.android.settings.TimeoutListPreference
|
||||
android:key="lock_after_timeout"
|
||||
android:title="@string/lock_after_timeout"
|
||||
android:summary="@string/lock_after_timeout_summary"
|
||||
android:summary="@string/summary_placeholder"
|
||||
android:entries="@array/lock_after_timeout_entries"
|
||||
android:entryValues="@array/lock_after_timeout_values" />
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="owner_info_settings"
|
||||
android:title="@string/owner_info_settings_title"
|
||||
android:summary="@string/owner_info_settings_summary" />
|
||||
android:title="@string/owner_info_settings_title" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<com.android.settings.TimeoutListPreference
|
||||
android:key="lock_after_timeout"
|
||||
android:title="@string/lock_after_timeout"
|
||||
android:summary="@string/lock_after_timeout_summary"
|
||||
android:summary="@string/summary_placeholder"
|
||||
android:entries="@array/lock_after_timeout_entries"
|
||||
android:entryValues="@array/lock_after_timeout_values" />
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
<com.android.settingslib.RestrictedPreference
|
||||
android:key="owner_info_settings"
|
||||
android:title="@string/owner_info_settings_title"
|
||||
android:summary="@string/owner_info_settings_summary" />
|
||||
android:title="@string/owner_info_settings_title" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/tts_settings_title">
|
||||
android:title="@string/tts_engine_preference_title">
|
||||
|
||||
<PreferenceCategory android:key="tts_engine_preference_category"/>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -249,6 +249,10 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
||||
final String uri = tile.metaData.getString(META_DATA_PREFERENCE_ICON_URI);
|
||||
final Pair<String, Integer> 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()))
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<AbstractPreferenceController> getPreferenceControllers(Context context) {
|
||||
public List<AbstractPreferenceController> getPreferenceControllers(
|
||||
Context context) {
|
||||
return buildPreferenceControllers(context, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> 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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<String> 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<SearchIndexableResource> getXmlResourcesToIndex(
|
||||
Context context, boolean enabled) {
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.tts_settings;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
keys.add("tts_engine_preference");
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -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<SearchIndexableResource> 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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<String> 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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user