Merge "Add fingerprint illustration image" into oc-mr1-dev
diff --git a/res/layout/choose_lock_password.xml b/res/layout/choose_lock_password.xml
index fb938c9..f1b631e 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">
<LinearLayout
style="@style/SuwContentFrame"
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 1a8f3de..2610e08 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -25,7 +25,6 @@
<style name="GlifTheme" parent="SuwThemeGlif">
<!-- For all Alert Dialogs -->
<item name="android:alertDialogTheme">@style/ThemeOverlay.AlertDialog</item>
- <item name="android:colorPrimary">@color/suw_color_accent_dark</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
<item name="*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item>
<item name="fingerprint_layout_theme">@style/FingerprintLayoutTheme</item>
@@ -46,7 +45,6 @@
<style name="GlifTheme.Light" parent="SuwThemeGlif.Light">
<!-- For all Alert Dialogs -->
<item name="android:alertDialogTheme">@style/ThemeOverlay.AlertDialog</item>
- <item name="android:colorPrimary">@color/suw_color_accent_light</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
<item name="*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item>
<item name="fingerprint_layout_theme">@style/FingerprintLayoutTheme</item>
@@ -66,7 +64,6 @@
<style name="GlifV2Theme" parent="SuwThemeGlifV2">
<!-- For all Alert Dialogs -->
<item name="android:alertDialogTheme">@style/ThemeOverlay.AlertDialog</item>
- <item name="android:colorPrimary">@color/suw_color_accent_dark</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
<item name="*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item>
<item name="fingerprint_layout_theme">@style/FingerprintLayoutTheme</item>
@@ -87,7 +84,6 @@
<style name="GlifV2Theme.Light" parent="SuwThemeGlifV2.Light">
<!-- For all Alert Dialogs -->
<item name="android:alertDialogTheme">@style/ThemeOverlay.AlertDialog</item>
- <item name="android:colorPrimary">@color/suw_color_accent_light</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
<item name="*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item>
<item name="fingerprint_layout_theme">@style/FingerprintLayoutTheme</item>
diff --git a/res/xml/security_settings_password_sub.xml b/res/xml/security_settings_password_sub.xml
index 46c4999..c0287c0 100644
--- a/res/xml/security_settings_password_sub.xml
+++ b/res/xml/security_settings_password_sub.xml
@@ -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>
diff --git a/res/xml/security_settings_pin_sub.xml b/res/xml/security_settings_pin_sub.xml
index 46c4999..c0287c0 100644
--- a/res/xml/security_settings_pin_sub.xml
+++ b/res/xml/security_settings_pin_sub.xml
@@ -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>
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
index f95ce46..1aac0ff 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
@@ -25,6 +25,7 @@
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.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;
@@ -186,6 +188,19 @@
}
/**
+ * 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.
*/
private AlertDialog createUserEntryDialog() {
@@ -196,7 +211,9 @@
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/nfc/NfcPaymentPreference.java b/src/com/android/settings/nfc/NfcPaymentPreference.java
index 239377d..a3f7466 100644
--- a/src/com/android/settings/nfc/NfcPaymentPreference.java
+++ b/src/com/android/settings/nfc/NfcPaymentPreference.java
@@ -18,6 +18,7 @@
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 @@
if (!appInfo.isDefault) {
mPaymentBackend.setDefaultPaymentApp(appInfo.componentName);
}
- getDialog().dismiss();
+ Dialog dialog = getDialog();
+ if (dialog != null)
+ dialog.dismiss();
}
}
}
diff --git a/src/com/android/settings/password/ChooseLockGeneric.java b/src/com/android/settings/password/ChooseLockGeneric.java
index 4d20bcf..5126727 100644
--- a/src/com/android/settings/password/ChooseLockGeneric.java
+++ b/src/com/android/settings/password/ChooseLockGeneric.java
@@ -219,7 +219,7 @@
mManagedPasswordProvider = ManagedLockPasswordProvider.get(getActivity(), mUserId);
if (mPasswordConfirmed) {
- updatePreferencesOrFinish();
+ updatePreferencesOrFinish(savedInstanceState != null);
if (mForChangeCredRequiredForBoot) {
maybeEnableEncryption(mLockPatternUtils.getKeyguardStoredPasswordQuality(
mUserId), false);
@@ -234,7 +234,7 @@
|| !helper.launchConfirmationActivity(CONFIRM_EXISTING_REQUEST,
getString(R.string.unlock_set_unlock_launch_picker_title), true, mUserId)) {
mPasswordConfirmed = true; // no password set, so no need to confirm
- updatePreferencesOrFinish();
+ updatePreferencesOrFinish(savedInstanceState != null);
} else {
mWaitingForConfirmation = true;
}
@@ -332,7 +332,7 @@
if (requestCode == CONFIRM_EXISTING_REQUEST && resultCode == Activity.RESULT_OK) {
mPasswordConfirmed = true;
mUserPassword = data.getStringExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD);
- updatePreferencesOrFinish();
+ updatePreferencesOrFinish(false /* isRecreatingActivity */);
if (mForChangeCredRequiredForBoot) {
if (!TextUtils.isEmpty(mUserPassword)) {
maybeEnableEncryption(
@@ -395,7 +395,7 @@
outState.putBoolean(ENCRYPT_REQUESTED_DISABLED, mEncryptionRequestDisabled);
}
- private void updatePreferencesOrFinish() {
+ private void updatePreferencesOrFinish(boolean isRecreatingActivity) {
Intent intent = getActivity().getIntent();
int quality = intent.getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY, -1);
if (quality == -1) {
@@ -413,7 +413,8 @@
updatePreferenceText();
updateCurrentPreference();
updatePreferenceSummaryIfNeeded();
- } else {
+ } else if (!isRecreatingActivity) {
+ // Don't start the activity again if we are recreated for configuration change
updateUnlockMethodAndFinish(quality, false, true /* chooseLockSkipped */);
}
}
diff --git a/src/com/android/settings/password/ChooseLockPassword.java b/src/com/android/settings/password/ChooseLockPassword.java
index 972ebdd..d890956 100644
--- a/src/com/android/settings/password/ChooseLockPassword.java
+++ b/src/com/android/settings/password/ChooseLockPassword.java
@@ -162,7 +162,7 @@
.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/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java
index 7a6ae79..fba11de 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.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.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 @@
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);