summaryrefslogtreecommitdiff
path: root/java/com/android/voicemail/impl/imap
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-05-04 08:23:17 -0700
committerEric Erfanian <erfanian@google.com>2017-05-04 14:04:39 -0700
commit10b34a5ebf12e97ecba0caf3c8e30b476b038a96 (patch)
tree3a325b0effac02fbd228b8ddf2f96589e5df72cd /java/com/android/voicemail/impl/imap
parent8369df095a73a77b3715f8ae7ba06089cebca4ce (diff)
Update Dialer to V10 RC16
This release was created following the instructions at: go/dialer-aosp-release Subsequent dialer releases will follow as O bugs are fixed, until we reach our final RC. Version: 10 Candidate: RC16 Branch: dialer-android_release_branch/153304843.1 dialer-android/dialer-android_20170416.00/dialer-android_20170416.00_RC16 This release contains the following bug fixes since RC00: Bug: 37324705 35304403 36067503 35304446 33203808 37280992 37346084 35766990 37481880 37424493 36470282 37347691 37519015 37168472 35805360 37545472 27704934 36515614 35766990 37577470 34739750 35801628 36788693 35264204 36708536 37628370 36904650 37314436 37642171 37530847 37637799 37666625 37548549 37648036 37636412 37323529 37630507 35919141 37198343 37548572 36178218 37640315 37663896 37720467 37275944 37710497 31634477 37744796 37348506 37744796 37568534 37672424 34872683 34873026 37681461 34873295 37748373 37526812 37618638 37663896 37536088 37727455 37165687 36651204 36900708 37323529 36902926 37256480 37328353 37432034 37436952 34093562 37720889 37321935 37780300 37781115 37755902 36588206 34258266 37290464 37698062 37618638 37473004 37432034 37918676 37870494 37722091 Test: make, on device Change-Id: I99e1a484ccd578c1f8a13e7a6a4b4952f0791297
Diffstat (limited to 'java/com/android/voicemail/impl/imap')
-rw-r--r--java/com/android/voicemail/impl/imap/ImapHelper.java63
1 files changed, 30 insertions, 33 deletions
diff --git a/java/com/android/voicemail/impl/imap/ImapHelper.java b/java/com/android/voicemail/impl/imap/ImapHelper.java
index 6aa415811..f1bc8b221 100644
--- a/java/com/android/voicemail/impl/imap/ImapHelper.java
+++ b/java/com/android/voicemail/impl/imap/ImapHelper.java
@@ -19,7 +19,7 @@ import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkInfo;
-import android.provider.VoicemailContract;
+import android.support.annotation.Nullable;
import android.telecom.PhoneAccountHandle;
import android.util.Base64;
import com.android.voicemail.impl.OmtpConstants;
@@ -44,6 +44,7 @@ import com.android.voicemail.impl.mail.TempDirectory;
import com.android.voicemail.impl.mail.internet.MimeMessage;
import com.android.voicemail.impl.mail.store.ImapConnection;
import com.android.voicemail.impl.mail.store.ImapFolder;
+import com.android.voicemail.impl.mail.store.ImapFolder.Quota;
import com.android.voicemail.impl.mail.store.ImapStore;
import com.android.voicemail.impl.mail.store.imap.ImapConstants;
import com.android.voicemail.impl.mail.store.imap.ImapResponse;
@@ -73,11 +74,6 @@ public class ImapHelper implements Closeable {
private final Editor mStatus;
VisualVoicemailPreferences mPrefs;
- private static final String PREF_KEY_QUOTA_OCCUPIED = "quota_occupied_";
- private static final String PREF_KEY_QUOTA_TOTAL = "quota_total_";
-
- private int mQuotaOccupied;
- private int mQuotaTotal;
private final OmtpVvmCarrierConfigHelper mConfig;
@@ -90,10 +86,7 @@ public class ImapHelper implements Closeable {
}
public ImapHelper(
- Context context,
- PhoneAccountHandle phoneAccount,
- Network network,
- Editor status)
+ Context context, PhoneAccountHandle phoneAccount, Network network, Editor status)
throws InitializingException {
this(
context,
@@ -139,10 +132,6 @@ public class ImapHelper implements Closeable {
LogUtils.w(TAG, "Could not parse port number");
throw new InitializingException("cannot initialize ImapHelper:" + e.toString());
}
-
- mQuotaOccupied =
- mPrefs.getInt(PREF_KEY_QUOTA_OCCUPIED, VoicemailContract.Status.QUOTA_UNAVAILABLE);
- mQuotaTotal = mPrefs.getInt(PREF_KEY_QUOTA_TOTAL, VoicemailContract.Status.QUOTA_UNAVAILABLE);
}
@Override
@@ -475,12 +464,22 @@ public class ImapHelper implements Closeable {
}
}
- public int getOccuupiedQuota() {
- return mQuotaOccupied;
- }
-
- public int getTotalQuota() {
- return mQuotaTotal;
+ @Nullable
+ public Quota getQuota() {
+ try {
+ mFolder = openImapFolder(ImapFolder.MODE_READ_ONLY);
+ if (mFolder == null) {
+ // This means we were unable to successfully open the folder.
+ LogUtils.e(TAG, "Unable to open folder");
+ return null;
+ }
+ return mFolder.getQuota();
+ } catch (MessagingException e) {
+ LogUtils.e(TAG, e, "Messaging Exception");
+ return null;
+ } finally {
+ closeImapFolder();
+ }
}
private void updateQuota(ImapFolder folder) throws MessagingException {
@@ -489,21 +488,19 @@ public class ImapHelper implements Closeable {
private void setQuota(ImapFolder.Quota quota) {
if (quota == null) {
+ LogUtils.i(TAG, "quota was null");
return;
}
- if (quota.occupied == mQuotaOccupied && quota.total == mQuotaTotal) {
- VvmLog.v(TAG, "Quota hasn't changed");
- return;
- }
- mQuotaOccupied = quota.occupied;
- mQuotaTotal = quota.total;
- VoicemailStatus.edit(mContext, mPhoneAccount).setQuota(mQuotaOccupied, mQuotaTotal).apply();
- mPrefs
- .edit()
- .putInt(PREF_KEY_QUOTA_OCCUPIED, mQuotaOccupied)
- .putInt(PREF_KEY_QUOTA_TOTAL, mQuotaTotal)
- .apply();
- VvmLog.v(TAG, "Quota changed to " + mQuotaOccupied + "/" + mQuotaTotal);
+
+ LogUtils.i(
+ TAG,
+ "Updating Voicemail status table with"
+ + " quota occupied: "
+ + quota.occupied
+ + " new quota total:"
+ + quota.total);
+ VoicemailStatus.edit(mContext, mPhoneAccount).setQuota(quota.occupied, quota.total).apply();
+ LogUtils.i(TAG, "Updated quota occupied and total");
}
/**