diff options
author | Ta-wei Yen <twyen@google.com> | 2016-07-12 15:16:15 -0700 |
---|---|---|
committer | Ta-wei Yen <twyen@google.com> | 2016-07-12 15:16:15 -0700 |
commit | a96501cff3ca998bb705b49feede6af28a53189d (patch) | |
tree | 945aeb17cbaf6f614a5bc098516ddb720ffe8fb6 /tests | |
parent | 19ac71d04272951270d282c6d28d926a49598742 (diff) | |
download | android_packages_services_Telephony-a96501cff3ca998bb705b49feede6af28a53189d.tar.gz android_packages_services_Telephony-a96501cff3ca998bb705b49feede6af28a53189d.tar.bz2 android_packages_services_Telephony-a96501cff3ca998bb705b49feede6af28a53189d.zip |
Implement UI for changing voicemail PIN
The temporary dialog for chagin PIN is replaced.
The setting still reside in Dialer->settings->call->voicemail
https://screenshot.googleplex.com/gKzDdP9DnHH
To change the PIN, the user must enter their old PIN first.
https://screenshot.googleplex.com/jMBcrkiJquJ
Which will be checked with the server.
https://screenshot.googleplex.com/38iz4wOySF9
https://screenshot.googleplex.com/mxjnXgSWNAH
After the old PIN is confirmed, the user then proceed to enter the new
PIN.
The length requirement from the server will be enforced.
https://screenshot.googleplex.com/d7cigtR08di
https://screenshot.googleplex.com/0MVVzViuArP
https://screenshot.googleplex.com/mwnRda213HO
The user then must confirm their new PIN
https://screenshot.googleplex.com/4R9T5m3sPp4
https://screenshot.googleplex.com/GHmqSDxPr1z
The change will be commited to the server
https://screenshot.googleplex.com/38iz4wOySF9
If it succeeded, the user will return to the setting screen, and a
toast will be shown.
https://screenshot.googleplex.com/a7qPxQOvPJm
else an error message will be shown, and the user will return to the
enter new PIN step.
If the default PIN was set by the OMTP client before, the user will be
asked to "Set PIN" instead
https://screenshot.googleplex.com/RPYRxqOFSkw
The default PIN will be validated first
https://screenshot.googleplex.com/bYZcROA560B
If the server rejects the default PIN, The flow will continue as the
regular change PIN process. Else the enter old pin step is by passed
and the user will go to the enter new PIN step directly.
If other error happens in this step, a message will be shown
https://screenshot.googleplex.com/YRKLo5VmGzL
and the user will then return to the settings screen
+ All phone account dependent storaged is moved to
VisualVoicemailPreferences.
- Retry in OmtpSyncService is removed. It was never ran, and a new retry
mechanism will be added later.
Fixes: 29082418
Fixes: 29102412
Fixes: 29903609
Change-Id: I28dcc08113120abedd907fa8faffd3eb00bd87b4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/phone/vvm/omtp/StatusMessageTest.java | 3 | ||||
-rw-r--r-- | tests/src/com/android/phone/vvm/omtp/VisualVoicemailPreferencesTest.java | 81 |
2 files changed, 84 insertions, 0 deletions
diff --git a/tests/src/com/android/phone/vvm/omtp/StatusMessageTest.java b/tests/src/com/android/phone/vvm/omtp/StatusMessageTest.java index fd3aa2c52..707463a70 100644 --- a/tests/src/com/android/phone/vvm/omtp/StatusMessageTest.java +++ b/tests/src/com/android/phone/vvm/omtp/StatusMessageTest.java @@ -40,6 +40,7 @@ public class StatusMessageTest extends TestCase { bundle.putString(OmtpConstants.SMTP_PORT, "s1234"); bundle.putString(OmtpConstants.SMTP_USER_NAME, "susername"); bundle.putString(OmtpConstants.SMTP_PASSWORD, "spassword"); + bundle.putString(OmtpConstants.TUI_PASSWORD_LENGTH, "4-7"); StatusMessage message = new StatusMessage(bundle); assertEquals("status", message.getProvisioningStatus()); @@ -54,6 +55,7 @@ public class StatusMessageTest extends TestCase { assertEquals("s1234", message.getSmtpPort()); assertEquals("susername", message.getSmtpUserName()); assertEquals("spassword", message.getSmtpPassword()); + assertEquals("4-7", message.getTuiPasswordLength()); } public void testSyncMessage_EmptyBundle() { @@ -70,5 +72,6 @@ public class StatusMessageTest extends TestCase { assertEquals("", message.getSmtpPort()); assertEquals("", message.getSmtpUserName()); assertEquals("", message.getSmtpPassword()); + assertEquals("", message.getTuiPasswordLength()); } } diff --git a/tests/src/com/android/phone/vvm/omtp/VisualVoicemailPreferencesTest.java b/tests/src/com/android/phone/vvm/omtp/VisualVoicemailPreferencesTest.java new file mode 100644 index 000000000..1ae789908 --- /dev/null +++ b/tests/src/com/android/phone/vvm/omtp/VisualVoicemailPreferencesTest.java @@ -0,0 +1,81 @@ +package com.android.phone.vvm.omtp; + +import android.content.ComponentName; +import android.telecom.PhoneAccountHandle; +import android.test.AndroidTestCase; +import android.util.ArraySet; + +import java.util.Arrays; + +public class VisualVoicemailPreferencesTest extends AndroidTestCase { + + public void testWriteRead() { + VisualVoicemailPreferences preferences = new VisualVoicemailPreferences(getContext(), + createFakeHandle("testWriteRead")); + preferences.edit() + .putBoolean("boolean", true) + .putFloat("float", 0.5f) + .putInt("int", 123) + .putLong("long", 456) + .putString("string", "foo") + .putStringSet("stringset", new ArraySet<>(Arrays.asList("bar", "baz"))) + .apply(); + + assertTrue(preferences.contains("boolean")); + assertTrue(preferences.contains("float")); + assertTrue(preferences.contains("int")); + assertTrue(preferences.contains("long")); + assertTrue(preferences.contains("string")); + assertTrue(preferences.contains("stringset")); + + assertEquals(true, preferences.getBoolean("boolean", false)); + assertEquals(0.5f, preferences.getFloat("float", 0)); + assertEquals(123, preferences.getInt("int", 0)); + assertEquals(456, preferences.getLong("long", 0)); + assertEquals("foo", preferences.getString("string", null)); + assertEquals(new ArraySet<>(Arrays.asList("bar", "baz")), + preferences.getStringSet("stringset", null)); + } + + public void testReadDefault() { + VisualVoicemailPreferences preferences = new VisualVoicemailPreferences(getContext(), + createFakeHandle("testReadDefault")); + + assertFalse(preferences.contains("boolean")); + assertFalse(preferences.contains("float")); + assertFalse(preferences.contains("int")); + assertFalse(preferences.contains("long")); + assertFalse(preferences.contains("string")); + assertFalse(preferences.contains("stringset")); + + assertEquals(true, preferences.getBoolean("boolean", true)); + assertEquals(2.5f, preferences.getFloat("float", 2.5f)); + assertEquals(321, preferences.getInt("int", 321)); + assertEquals(654, preferences.getLong("long", 654)); + assertEquals("foo2", preferences.getString("string", "foo2")); + assertEquals(new ArraySet<>(Arrays.asList("bar2", "baz2")), + preferences.getStringSet( + "stringset", new ArraySet<>(Arrays.asList("bar2", "baz2")))); + } + + public void testReadDefaultNull() { + VisualVoicemailPreferences preferences = new VisualVoicemailPreferences(getContext(), + createFakeHandle("testReadDefaultNull")); + assertNull(preferences.getString("string", null)); + assertNull(preferences.getStringSet("stringset", null)); + } + + public void testDifferentHandle() { + VisualVoicemailPreferences preferences1 = new VisualVoicemailPreferences(getContext(), + createFakeHandle("testDifferentHandle1")); + VisualVoicemailPreferences preferences2 = new VisualVoicemailPreferences(getContext(), + createFakeHandle("testDifferentHandle1")); + + preferences1.edit().putString("string", "foo"); + assertFalse(preferences2.contains("string")); + } + + private PhoneAccountHandle createFakeHandle(String id) { + return new PhoneAccountHandle(new ComponentName(getContext(), this.getClass()), id); + } +} |