Merge "Email: remove unused strings and resources."
diff --git a/Android.mk b/Android.mk
index 484e621..794feec 100644
--- a/Android.mk
+++ b/Android.mk
@@ -28,9 +28,6 @@
 
 LOCAL_PACKAGE_NAME := Email
 
-LOCAL_PROGUARD_ENABLED := full
-LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard.flags
-
 include $(BUILD_PACKAGE)
 
 # additionally, build unit tests in a separate .apk
diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java
index f60bc39..1bd379b 100644
--- a/src/com/android/exchange/SyncManager.java
+++ b/src/com/android/exchange/SyncManager.java
@@ -201,7 +201,7 @@
     private HashMap<Long, CalendarObserver> mCalendarObservers =
         new HashMap<Long, CalendarObserver>();
 
-    /*package*/ ContentResolver mResolver;
+    private ContentResolver mResolver;
 
     // The singleton SyncManager object, with its thread and stop flag
     protected static SyncManager INSTANCE;
diff --git a/src/com/android/exchange/adapter/CalendarSyncAdapter.java b/src/com/android/exchange/adapter/CalendarSyncAdapter.java
index 6bc04ae..d0652f7 100644
--- a/src/com/android/exchange/adapter/CalendarSyncAdapter.java
+++ b/src/com/android/exchange/adapter/CalendarSyncAdapter.java
@@ -36,7 +36,6 @@
 import android.database.Cursor;
 import android.net.Uri;
 import android.os.RemoteException;
-import android.pim.DateException;
 import android.provider.Calendar;
 import android.provider.SyncStateContract;
 import android.provider.Calendar.Attendees;
@@ -51,6 +50,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.GregorianCalendar;
 import java.util.StringTokenizer;
@@ -989,7 +989,7 @@
             Duration duration = new Duration();
             try {
                 duration.parse(entityValues.getAsString(Events.DURATION));
-            } catch (DateException e) {
+            } catch (ParseException e) {
                 // Can't do much about this; use the default (1 hour)
             }
             s.data(Tags.CALENDAR_END_TIME,
diff --git a/src/com/android/exchange/adapter/EmailSyncAdapter.java b/src/com/android/exchange/adapter/EmailSyncAdapter.java
index 84e845e..61d7d9b 100644
--- a/src/com/android/exchange/adapter/EmailSyncAdapter.java
+++ b/src/com/android/exchange/adapter/EmailSyncAdapter.java
@@ -161,9 +161,9 @@
                     case Tags.EMAIL_MESSAGE_CLASS:
                         String messageClass = getValue();
                         if (messageClass.equals("IPM.Schedule.Meeting.Request")) {
-                            msg.mFlags |= Message.FLAG_MEETING_INVITE;
+                            msg.mFlags |= Message.FLAG_INCOMING_MEETING_INVITE;
                         } else if (messageClass.equals("IPM.Schedule.Meeting.Canceled")) {
-                            msg.mFlags |= Message.FLAG_MEETING_CANCEL_NOTICE;
+                            msg.mFlags |= Message.FLAG_INCOMING_MEETING_CANCEL;
                         }
                         break;
                     case Tags.EMAIL_MEETING_REQUEST:
diff --git a/src/com/android/exchange/utility/CalendarUtilities.java b/src/com/android/exchange/utility/CalendarUtilities.java
index 4ae2e46..5b4112d 100644
--- a/src/com/android/exchange/utility/CalendarUtilities.java
+++ b/src/com/android/exchange/utility/CalendarUtilities.java
@@ -24,13 +24,12 @@
 import com.android.exchange.adapter.Serializer;
 import com.android.exchange.adapter.Tags;
 
-import org.bouncycastle.util.encoders.Base64;
-
 import android.content.ContentValues;
 import android.net.Uri;
 import android.provider.Calendar.Calendars;
 import android.text.format.Time;
 import android.util.Log;
+import android.util.base64.Base64;
 
 import java.io.IOException;
 import java.util.Calendar;
@@ -330,8 +329,7 @@
                 setLong(tziBytes, MSFT_TIME_ZONE_DAYLIGHT_BIAS_OFFSET, - dstOffset / MINUTES);
             }
         }
-        // TODO Use a more efficient Base64 API
-        byte[] tziEncodedBytes = Base64.encode(tziBytes);
+        byte[] tziEncodedBytes = Base64.encode(tziBytes, Base64.NO_WRAP);
         tziString = new String(tziEncodedBytes);
         if (Eas.USER_LOG) {
             Log.d(TAG, "Calculated TZI String for " + tz.getDisplayName() + " in " +
@@ -376,7 +374,7 @@
         // TODO Remove after we're comfortable with performance
         long time = System.currentTimeMillis();
         // First, we need to decode the base64 string
-        byte[] timeZoneBytes = Base64.decode(timeZoneString);
+        byte[] timeZoneBytes = Base64.decode(timeZoneString, Base64.DEFAULT);
 
         // Then, we get the bias (similar to a rawOffset); for TimeZone, we need ms
         // but EAS gives us minutes, so do the conversion.  Note that EAS is the bias that's added
diff --git a/src/com/android/exchange/utility/Duration.java b/src/com/android/exchange/utility/Duration.java
index 0ec867c..f6e6525 100644
--- a/src/com/android/exchange/utility/Duration.java
+++ b/src/com/android/exchange/utility/Duration.java
@@ -15,8 +15,7 @@
 
 package com.android.exchange.utility;
 
-import android.pim.DateException;
-
+import java.text.ParseException;
 import java.util.Calendar;
 
 /**
@@ -39,7 +38,7 @@
      * Parse according to RFC2445 ss4.3.6.  (It's actually a little loose with
      * its parsing, for better or for worse)
      */
-    public void parse(String str) throws DateException {
+    public void parse(String str) throws ParseException {
         sign = 1;
         weeks = 0;
         days = 0;
@@ -69,9 +68,9 @@
 
         c = str.charAt(index);
         if (c != 'P') {
-            throw new DateException (
+            throw new ParseException (
                     "Duration.parse(str='" + str + "') expected 'P' at index="
-                    + index);
+                    + index, index);
         }
         index++;
 
@@ -98,9 +97,9 @@
                 n = 0;
             } else if (c == 'T') {
             } else {
-                throw new DateException (
+                throw new ParseException (
                         "Duration.parse(str='" + str + "') unexpected char '"
-                        + c + "' at index=" + index);
+                        + c + "' at index=" + index, index);
             }
         }
     }
diff --git a/tests/Android.mk b/tests/Android.mk
index 9dc3686..819e0b5 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -33,6 +33,4 @@
 
 LOCAL_SDK_VERSION := current
 
-LOCAL_PROGUARD_ENABLED := full
-
 include $(BUILD_PACKAGE)
diff --git a/tests/src/com/android/exchange/SyncManagerAccountTests.java b/tests/src/com/android/exchange/SyncManagerAccountTests.java
index 6dce513..9cd6215 100644
--- a/tests/src/com/android/exchange/SyncManagerAccountTests.java
+++ b/tests/src/com/android/exchange/SyncManagerAccountTests.java
@@ -222,10 +222,8 @@
         assertEquals(2, accountManagerAccounts.length);
 
         // Run the reconciler
-        SyncManager syncManager = new SyncManager();
         ContentResolver resolver = mMockContext.getContentResolver();
-        syncManager.mResolver = resolver;
-        syncManager.reconcileAccountsWithAccountManager(context,
+        SyncManager.reconcileAccountsWithAccountManager(context,
                 makeSyncManagerAccountList(), accountManagerAccounts, true, resolver);
 
         // There should now be only two EmailProvider accounts
@@ -238,7 +236,7 @@
         assertEquals(1, EmailContent.count(mMockContext, Account.CONTENT_URI, null, null));
 
         // Run the reconciler
-        syncManager.reconcileAccountsWithAccountManager(context,
+        SyncManager.reconcileAccountsWithAccountManager(context,
                 makeSyncManagerAccountList(), accountManagerAccounts, true, resolver);
 
         // There should now be only one AccountManager account