summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTa-wei Yen <twyen@google.com>2017-01-11 01:17:11 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-01-11 01:17:11 +0000
commitf205f0e5cf5351447d13e553efa3cb93640e5eb6 (patch)
tree49bf685f39f0ab7c4c175fd970974a002e7d4f4c
parent1509f29d3ffd47379d2fc626363fda9632fab73f (diff)
parente4f651b96552f9abc39e035c87547492c2b2682e (diff)
downloadandroid_packages_services_Telephony-f205f0e5cf5351447d13e553efa3cb93640e5eb6.tar.gz
android_packages_services_Telephony-f205f0e5cf5351447d13e553efa3cb93640e5eb6.tar.bz2
android_packages_services_Telephony-f205f0e5cf5351447d13e553efa3cb93640e5eb6.zip
Merge "Preserve PIN_NOT_SET state when reactivating on VVM3" into nyc-mr2-dev
-rw-r--r--src/com/android/phone/vvm/omtp/protocol/Vvm3EventHandler.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/com/android/phone/vvm/omtp/protocol/Vvm3EventHandler.java b/src/com/android/phone/vvm/omtp/protocol/Vvm3EventHandler.java
index d95879f93..524c96d4c 100644
--- a/src/com/android/phone/vvm/omtp/protocol/Vvm3EventHandler.java
+++ b/src/com/android/phone/vvm/omtp/protocol/Vvm3EventHandler.java
@@ -18,13 +18,17 @@ package com.android.phone.vvm.omtp.protocol;
import android.annotation.IntDef;
import android.content.Context;
+import android.provider.VoicemailContract.Status;
+import android.telecom.PhoneAccountHandle;
import android.util.Log;
+
import com.android.phone.VoicemailStatus;
import com.android.phone.settings.VoicemailChangePinActivity;
import com.android.phone.vvm.omtp.DefaultOmtpEventHandler;
import com.android.phone.vvm.omtp.OmtpEvents;
import com.android.phone.vvm.omtp.OmtpEvents.Type;
import com.android.phone.vvm.omtp.OmtpVvmCarrierConfigHelper;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -113,19 +117,22 @@ public class Vvm3EventHandler {
OmtpEvents event) {
switch (event) {
case CONFIG_REQUEST_STATUS_SUCCESS:
- if (status.getPhoneAccountHandle() == null) {
- // This should never happen.
- Log.e(TAG, "status editor has null phone account handle");
- return true;
- }
-
- if (!VoicemailChangePinActivity
- .isDefaultOldPinSet(context, status.getPhoneAccountHandle())) {
+ if (!isPinRandomized(context, status.getPhoneAccountHandle())) {
return false;
} else {
postError(status, PIN_NOT_SET);
}
break;
+ case CONFIG_ACTIVATING_SUBSEQUENT:
+ if (isPinRandomized(context, status.getPhoneAccountHandle())) {
+ status.setConfigurationState(PIN_NOT_SET);
+ } else {
+ status.setConfigurationState(Status.CONFIGURATION_STATE_OK);
+ }
+ status
+ .setNotificationChannelState(Status.NOTIFICATION_CHANNEL_STATE_OK)
+ .setDataChannelState(Status.DATA_CHANNEL_STATE_OK).apply();
+ break;
case CONFIG_DEFAULT_PIN_REPLACED:
postError(status, PIN_NOT_SET);
break;
@@ -269,4 +276,13 @@ public class Vvm3EventHandler {
}
editor.apply();
}
+
+ private static boolean isPinRandomized(Context context, PhoneAccountHandle phoneAccountHandle) {
+ if (phoneAccountHandle == null) {
+ // This should never happen.
+ Log.e(TAG, "status editor has null phone account handle");
+ return false;
+ }
+ return VoicemailChangePinActivity.isDefaultOldPinSet(context, phoneAccountHandle);
+ }
}