From d8046e520a866b9948ee9ba47cf642b441ca8e23 Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Thu, 6 Apr 2017 09:41:50 -0700 Subject: Update AOSP Dialer source from internal google3 repository at cl/152373142. Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/151342913 (3/27/2017) to cl/152373142 (4/06/2017). This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Our current goal is to do frequent drops (daily if possible) and eventually switched to an automated process. Change-Id: I2fbc88cf6867b90ac8b65f75e5e34468988c7217 --- .../voicemail/impl/sync/OmtpVvmSyncService.java | 29 ++++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java') diff --git a/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java b/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java index 25325eeb7..83a3960dd 100644 --- a/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java +++ b/java/com/android/voicemail/impl/sync/OmtpVvmSyncService.java @@ -24,9 +24,9 @@ import android.support.v4.os.BuildCompat; import android.telecom.PhoneAccountHandle; import android.text.TextUtils; import android.util.ArrayMap; -import com.android.dialer.common.ConfigProviderBindings; import com.android.dialer.logging.Logger; import com.android.dialer.logging.nano.DialerImpression; +import com.android.voicemail.VoicemailComponent; import com.android.voicemail.impl.ActivationTask; import com.android.voicemail.impl.Assert; import com.android.voicemail.impl.OmtpEvents; @@ -153,9 +153,7 @@ public class OmtpVvmSyncService { private void autoDeleteAndArchiveVM( ImapHelper imapHelper, PhoneAccountHandle phoneAccountHandle) { - if (ConfigProviderBindings.get(mContext) - .getBoolean(VisualVoicemailSettingsUtil.ALLOW_VOICEMAIL_ARCHIVE, true) - && isArchiveEnabled(mContext, phoneAccountHandle)) { + if (isArchiveAllowedAndEnabled(mContext, phoneAccountHandle)) { if ((float) imapHelper.getOccuupiedQuota() / (float) imapHelper.getTotalQuota() > AUTO_DELETE_ARCHIVE_VM_THRESHOLD) { deleteAndArchiveVM(imapHelper); @@ -166,14 +164,29 @@ public class OmtpVvmSyncService { VvmLog.i(TAG, "no need to archive and auto delete VM, quota below threshold"); } } else { - VvmLog.i(TAG, "autoDeleteAndArchiveVM is turned off"); + VvmLog.i(TAG, "isArchiveAllowedAndEnabled is false"); Logger.get(mContext).logImpression(DialerImpression.Type.VVM_ARCHIVE_AUTO_DELETE_TURNED_OFF); } } - private static boolean isArchiveEnabled(Context context, PhoneAccountHandle phoneAccountHandle) { - return VisualVoicemailSettingsUtil.isArchiveEnabled(context, phoneAccountHandle) - && VisualVoicemailSettingsUtil.isEnabled(context, phoneAccountHandle); + private static boolean isArchiveAllowedAndEnabled( + Context context, PhoneAccountHandle phoneAccountHandle) { + + if (!VoicemailComponent.get(context) + .getVoicemailClient() + .isVoicemailArchiveAvailable(context)) { + VvmLog.i("isArchiveAllowedAndEnabled", "voicemail archive is not available"); + return false; + } + if (!VisualVoicemailSettingsUtil.isArchiveEnabled(context, phoneAccountHandle)) { + VvmLog.i("isArchiveAllowedAndEnabled", "voicemail archive is turned off"); + return false; + } + if (!VisualVoicemailSettingsUtil.isEnabled(context, phoneAccountHandle)) { + VvmLog.i("isArchiveAllowedAndEnabled", "voicemail is turned off"); + return false; + } + return true; } private void deleteAndArchiveVM(ImapHelper imapHelper) { -- cgit v1.2.3