diff options
Diffstat (limited to 'java/com/android/voicemail/impl/VvmPhoneStateListener.java')
-rw-r--r-- | java/com/android/voicemail/impl/VvmPhoneStateListener.java | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/java/com/android/voicemail/impl/VvmPhoneStateListener.java b/java/com/android/voicemail/impl/VvmPhoneStateListener.java index 914120b69..a9082e895 100644 --- a/java/com/android/voicemail/impl/VvmPhoneStateListener.java +++ b/java/com/android/voicemail/impl/VvmPhoneStateListener.java @@ -31,73 +31,73 @@ public class VvmPhoneStateListener extends PhoneStateListener { private static final String TAG = "VvmPhoneStateListener"; - private PhoneAccountHandle mPhoneAccount; - private Context mContext; - private int mPreviousState = -1; + private PhoneAccountHandle phoneAccount; + private Context context; + private int previousState = -1; public VvmPhoneStateListener(Context context, PhoneAccountHandle accountHandle) { // TODO(twyen): a bug too much trouble to call super constructor through reflection, // just use non-phoneAccountHandle version for now. super(); - mContext = context; - mPhoneAccount = accountHandle; + this.context = context; + phoneAccount = accountHandle; } @Override public void onServiceStateChanged(ServiceState serviceState) { - if (mPhoneAccount == null) { + if (phoneAccount == null) { VvmLog.e( TAG, "onServiceStateChanged on phoneAccount " - + mPhoneAccount + + phoneAccount + " with invalid phoneAccountHandle, ignoring"); return; } int state = serviceState.getState(); - if (state == mPreviousState + if (state == previousState || (state != ServiceState.STATE_IN_SERVICE - && mPreviousState != ServiceState.STATE_IN_SERVICE)) { + && previousState != ServiceState.STATE_IN_SERVICE)) { // Only interested in state changes or transitioning into or out of "in service". // Otherwise just quit. - mPreviousState = state; + previousState = state; return; } - OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(mContext, mPhoneAccount); + OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(context, phoneAccount); if (state == ServiceState.STATE_IN_SERVICE) { VoicemailStatusQueryHelper voicemailStatusQueryHelper = - new VoicemailStatusQueryHelper(mContext); - if (voicemailStatusQueryHelper.isVoicemailSourceConfigured(mPhoneAccount)) { - if (!voicemailStatusQueryHelper.isNotificationsChannelActive(mPhoneAccount)) { - VvmLog.v(TAG, "Notifications channel is active for " + mPhoneAccount); + new VoicemailStatusQueryHelper(context); + if (voicemailStatusQueryHelper.isVoicemailSourceConfigured(phoneAccount)) { + if (!voicemailStatusQueryHelper.isNotificationsChannelActive(phoneAccount)) { + VvmLog.v(TAG, "Notifications channel is active for " + phoneAccount); helper.handleEvent( - VoicemailStatus.edit(mContext, mPhoneAccount), OmtpEvents.NOTIFICATION_IN_SERVICE); + VoicemailStatus.edit(context, phoneAccount), OmtpEvents.NOTIFICATION_IN_SERVICE); } } - if (VvmAccountManager.isAccountActivated(mContext, mPhoneAccount)) { - VvmLog.v(TAG, "Signal returned: requesting resync for " + mPhoneAccount); + if (VvmAccountManager.isAccountActivated(context, phoneAccount)) { + VvmLog.v(TAG, "Signal returned: requesting resync for " + phoneAccount); // If the source is already registered, run a full sync in case something was missed // while signal was down. - SyncTask.start(mContext, mPhoneAccount); + SyncTask.start(context, phoneAccount); } else { - VvmLog.v(TAG, "Signal returned: reattempting activation for " + mPhoneAccount); + VvmLog.v(TAG, "Signal returned: reattempting activation for " + phoneAccount); // Otherwise initiate an activation because this means that an OMTP source was // recognized but either the activation text was not successfully sent or a response // was not received. helper.startActivation(); } } else { - VvmLog.v(TAG, "Notifications channel is inactive for " + mPhoneAccount); + VvmLog.v(TAG, "Notifications channel is inactive for " + phoneAccount); - if (!VvmAccountManager.isAccountActivated(mContext, mPhoneAccount)) { + if (!VvmAccountManager.isAccountActivated(context, phoneAccount)) { return; } helper.handleEvent( - VoicemailStatus.edit(mContext, mPhoneAccount), OmtpEvents.NOTIFICATION_SERVICE_LOST); + VoicemailStatus.edit(context, phoneAccount), OmtpEvents.NOTIFICATION_SERVICE_LOST); } - mPreviousState = state; + previousState = state; } } |