Merge "Add PingDuration to the Account table" into jb-ub-mail-ur10
This commit is contained in:
commit
b4d4729fa2
@ -121,6 +121,7 @@ public final class Account extends EmailContent implements AccountColumns, Parce
|
||||
public String mSecuritySyncKey;
|
||||
public String mSignature;
|
||||
public long mPolicyKey;
|
||||
public long mPingDuration;
|
||||
|
||||
// Convenience for creating/working with an account
|
||||
public transient HostAuth mHostAuthRecv;
|
||||
@ -144,7 +145,8 @@ public final class Account extends EmailContent implements AccountColumns, Parce
|
||||
public static final int CONTENT_NEW_MESSAGE_COUNT_COLUMN = 12;
|
||||
public static final int CONTENT_SECURITY_SYNC_KEY_COLUMN = 13;
|
||||
public static final int CONTENT_SIGNATURE_COLUMN = 14;
|
||||
public static final int CONTENT_POLICY_KEY = 15;
|
||||
public static final int CONTENT_POLICY_KEY_COLUMN = 15;
|
||||
public static final int CONTENT_PING_DURATION_COLUMN = 16;
|
||||
|
||||
public static final String[] CONTENT_PROJECTION = new String[] {
|
||||
RECORD_ID, AccountColumns.DISPLAY_NAME,
|
||||
@ -154,7 +156,7 @@ public final class Account extends EmailContent implements AccountColumns, Parce
|
||||
AccountColumns.COMPATIBILITY_UUID, AccountColumns.SENDER_NAME,
|
||||
AccountColumns.PROTOCOL_VERSION,
|
||||
AccountColumns.NEW_MESSAGE_COUNT, AccountColumns.SECURITY_SYNC_KEY,
|
||||
AccountColumns.SIGNATURE, AccountColumns.POLICY_KEY
|
||||
AccountColumns.SIGNATURE, AccountColumns.POLICY_KEY, AccountColumns.PING_DURATION
|
||||
};
|
||||
|
||||
public static final int CONTENT_MAILBOX_TYPE_COLUMN = 1;
|
||||
@ -248,7 +250,8 @@ public final class Account extends EmailContent implements AccountColumns, Parce
|
||||
mNewMessageCount = cursor.getInt(CONTENT_NEW_MESSAGE_COUNT_COLUMN);
|
||||
mSecuritySyncKey = cursor.getString(CONTENT_SECURITY_SYNC_KEY_COLUMN);
|
||||
mSignature = cursor.getString(CONTENT_SIGNATURE_COLUMN);
|
||||
mPolicyKey = cursor.getLong(CONTENT_POLICY_KEY);
|
||||
mPolicyKey = cursor.getLong(CONTENT_POLICY_KEY_COLUMN);
|
||||
mPingDuration = cursor.getLong(CONTENT_PING_DURATION_COLUMN);
|
||||
}
|
||||
|
||||
private static long getId(Uri u) {
|
||||
@ -347,6 +350,20 @@ public final class Account extends EmailContent implements AccountColumns, Parce
|
||||
mSyncLookback = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current ping duration.
|
||||
*/
|
||||
public long getPingDuration() {
|
||||
return mPingDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ping duration. Be sure to call save() to commit to database.
|
||||
*/
|
||||
public void setPingDuration(long value) {
|
||||
mPingDuration = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the flags for this account
|
||||
*/
|
||||
@ -762,6 +779,7 @@ public final class Account extends EmailContent implements AccountColumns, Parce
|
||||
values.put(AccountColumns.SECURITY_SYNC_KEY, mSecuritySyncKey);
|
||||
values.put(AccountColumns.SIGNATURE, mSignature);
|
||||
values.put(AccountColumns.POLICY_KEY, mPolicyKey);
|
||||
values.put(AccountColumns.PING_DURATION, mPingDuration);
|
||||
return values;
|
||||
}
|
||||
|
||||
|
@ -1575,6 +1575,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";
|
||||
// Current duration of the Exchange ping
|
||||
public static final String PING_DURATION = "pingDuration";
|
||||
}
|
||||
|
||||
public interface QuickResponseColumns {
|
||||
|
@ -147,8 +147,9 @@ public final class DBHelper {
|
||||
// syncs along with the account).
|
||||
// Version 113: Restore message_count to being useful.
|
||||
// Version 114: Add lastFullSyncTime column
|
||||
// Version 115: Add pingDuration column
|
||||
|
||||
public static final int DATABASE_VERSION = 114;
|
||||
public static final int DATABASE_VERSION = 115;
|
||||
|
||||
// Any changes to the database format *must* include update-in-place code.
|
||||
// Original version: 2
|
||||
@ -344,7 +345,8 @@ public final class DBHelper {
|
||||
+ AccountColumns.SECURITY_FLAGS + " integer, "
|
||||
+ AccountColumns.SECURITY_SYNC_KEY + " text, "
|
||||
+ AccountColumns.SIGNATURE + " text, "
|
||||
+ AccountColumns.POLICY_KEY + " integer"
|
||||
+ AccountColumns.POLICY_KEY + " integer, "
|
||||
+ AccountColumns.PING_DURATION + " integer"
|
||||
+ ");";
|
||||
db.execSQL("create table " + Account.TABLE_NAME + s);
|
||||
// Deleting an account deletes associated Mailboxes and HostAuth's
|
||||
@ -1064,10 +1066,23 @@ public final class DBHelper {
|
||||
try {
|
||||
db.execSQL("alter table " + Mailbox.TABLE_NAME
|
||||
+ " add column " + MailboxColumns.LAST_FULL_SYNC_TIME +" integer" + ";");
|
||||
ContentValues cv = new ContentValues();
|
||||
final ContentValues cv = new ContentValues(1);
|
||||
cv.put(MailboxColumns.LAST_FULL_SYNC_TIME, 0);
|
||||
db.update(Mailbox.TABLE_NAME, cv, null, null);
|
||||
} catch (SQLException e) {
|
||||
} catch (final SQLException e) {
|
||||
// Shouldn't be needed unless we're debugging and interrupt the process
|
||||
LogUtils.w(TAG, "Exception upgrading EmailProvider.db from v113 to v114", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (oldVersion <= 114) {
|
||||
try {
|
||||
db.execSQL("alter table " + Account.TABLE_NAME
|
||||
+ " add column " + AccountColumns.PING_DURATION +" integer" + ";");
|
||||
final ContentValues cv = new ContentValues(1);
|
||||
cv.put(AccountColumns.PING_DURATION, 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 v113 to v114", e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user