b/9564335. Add support for a maxAttachmentSize column in the Account

table and connect the data to the Settings object in the existing
location (SettingsColumns.MAX_ATTACHMENT_SIZE).

Change-Id: Iaf48995757511e1dfb65aa35ff6d81bbc47187bd

Conflicts:
	src/com/android/email/provider/DBHelper.java
This commit is contained in:
Anthony Lee 2014-03-06 15:27:54 -08:00 committed by Yu Ping Hu
parent 8103f960d0
commit eba80c114e
4 changed files with 24 additions and 3 deletions

View File

@ -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;

View File

@ -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";
}

View File

@ -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

View File

@ -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);