diff --git a/emailcommon/src/com/android/emailcommon/provider/Account.java b/emailcommon/src/com/android/emailcommon/provider/Account.java index 7e228fc04..c35009d34 100755 --- a/emailcommon/src/com/android/emailcommon/provider/Account.java +++ b/emailcommon/src/com/android/emailcommon/provider/Account.java @@ -165,6 +165,7 @@ public final class Account extends EmailContent implements AccountColumns, Parce public static final int CONTENT_SIGNATURE_COLUMN = 15; public static final int CONTENT_POLICY_KEY_COLUMN = 16; public static final int CONTENT_PING_DURATION_COLUMN = 17; + public static final int CONTENT_MAX_ATTACHMENT_SIZE_COLUMN = 18; public static final String[] CONTENT_PROJECTION = new String[] { RECORD_ID, AccountColumns.DISPLAY_NAME, @@ -174,7 +175,8 @@ public final class Account extends EmailContent implements AccountColumns, Parce AccountColumns.COMPATIBILITY_UUID, AccountColumns.SENDER_NAME, AccountColumns.RINGTONE_URI, AccountColumns.PROTOCOL_VERSION, AccountColumns.NEW_MESSAGE_COUNT, AccountColumns.SECURITY_SYNC_KEY, - AccountColumns.SIGNATURE, AccountColumns.POLICY_KEY, AccountColumns.PING_DURATION + AccountColumns.SIGNATURE, AccountColumns.POLICY_KEY, AccountColumns.PING_DURATION, + AccountColumns.MAX_ATTACHMENT_SIZE }; public static final int CONTENT_MAILBOX_TYPE_COLUMN = 1; diff --git a/emailcommon/src/com/android/emailcommon/provider/EmailContent.java b/emailcommon/src/com/android/emailcommon/provider/EmailContent.java index 84ec28a91..7550c0825 100755 --- a/emailcommon/src/com/android/emailcommon/provider/EmailContent.java +++ b/emailcommon/src/com/android/emailcommon/provider/EmailContent.java @@ -1749,6 +1749,8 @@ public abstract class EmailContent { public static final String SIGNATURE = "signature"; // A foreign key into the Policy table public static final String POLICY_KEY = "policyKey"; + // Max upload attachment size. + public static final String MAX_ATTACHMENT_SIZE = "maxAttachmentSize"; // Current duration of the Exchange ping public static final String PING_DURATION = "pingDuration"; } diff --git a/src/com/android/email/provider/DBHelper.java b/src/com/android/email/provider/DBHelper.java index ca5b9e9ad..b5f9404ec 100644 --- a/src/com/android/email/provider/DBHelper.java +++ b/src/com/android/email/provider/DBHelper.java @@ -173,8 +173,9 @@ public final class DBHelper { // Version 122: Need to update Message_Updates and Message_Deletes to match previous. // Version 123: Changed the duplicateMesage deletion trigger to ignore accounts that aren't // exchange accounts. - // Version 124: Add credentials table for OAuth. - public static final int DATABASE_VERSION = 124; + // Version 124: Added MAX_ATTACHMENT_SIZE to the account table + // Version 125: Add credentials table for OAuth. + public static final int DATABASE_VERSION = 125; // Any changes to the database format *must* include update-in-place code. // Original version: 2 @@ -503,6 +504,7 @@ public final class DBHelper { + AccountColumns.SECURITY_SYNC_KEY + " text, " + AccountColumns.SIGNATURE + " text, " + AccountColumns.POLICY_KEY + " integer, " + + AccountColumns.MAX_ATTACHMENT_SIZE + " integer, " + AccountColumns.PING_DURATION + " integer" + ");"; db.execSQL("create table " + Account.TABLE_NAME + s); @@ -1343,6 +1345,19 @@ public final class DBHelper { } if (oldVersion <= 123) { + try { + db.execSQL("alter table " + Account.TABLE_NAME + + " add column " + AccountColumns.MAX_ATTACHMENT_SIZE +" integer" + ";"); + final ContentValues cv = new ContentValues(1); + cv.put(AccountColumns.MAX_ATTACHMENT_SIZE, 0); + db.update(Account.TABLE_NAME, cv, null, null); + } catch (final SQLException e) { + // Shouldn't be needed unless we're debugging and interrupt the process + LogUtils.w(TAG, "Exception upgrading EmailProvider.db from v123 to v124", e); + } + } + + if (oldVersion <= 124) { createCredentialsTable(db); // Add the credentialKey column, and set it to -1 for all pre-existing hostAuths. db.execSQL("alter table " + HostAuth.TABLE_NAME diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 8ee4094e2..6084dffa5 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -2507,6 +2507,8 @@ public class EmailProvider extends ContentProvider { .add(UIProvider.AccountColumns.SettingsColumns.CONFIRM_ARCHIVE, "0") .add(UIProvider.AccountColumns.SettingsColumns.CONVERSATION_VIEW_MODE, Integer.toString(UIProvider.ConversationViewMode.UNDEFINED)) + .add(UIProvider.AccountColumns.SettingsColumns.MAX_ATTACHMENT_SIZE, + AccountColumns.MAX_ATTACHMENT_SIZE) .add(UIProvider.AccountColumns.SettingsColumns.VEILED_ADDRESS_PATTERN, null); final String feedbackUri = context.getString(R.string.email_feedback_uri);