Merge change 8002
* changes: Prevent EAS startup race condition while debugging
This commit is contained in:
commit
986a3b5f03
|
@ -59,7 +59,8 @@ public class EmailProvider extends ContentProvider {
|
|||
// Obviously, we'll handle upgrades differently once things are a bit stable
|
||||
// version 15: changed Address.pack() format.
|
||||
// version 16: added protocolVersion column to Account
|
||||
public static final int DATABASE_VERSION = 16;
|
||||
// version 17: prevent duplication of mailboxes with the same serverId
|
||||
public static final int DATABASE_VERSION = 17;
|
||||
public static final int BODY_DATABASE_VERSION = 1;
|
||||
|
||||
public static final String EMAIL_AUTHORITY = "com.android.email.provider";
|
||||
|
@ -369,7 +370,7 @@ public class EmailProvider extends ContentProvider {
|
|||
static void createMailboxTable(SQLiteDatabase db) {
|
||||
String s = " (" + EmailContent.RECORD_ID + " integer primary key autoincrement, "
|
||||
+ MailboxColumns.DISPLAY_NAME + " text, "
|
||||
+ MailboxColumns.SERVER_ID + " text, "
|
||||
+ MailboxColumns.SERVER_ID + " text unique on conflict replace, "
|
||||
+ MailboxColumns.PARENT_SERVER_ID + " text, "
|
||||
+ MailboxColumns.ACCOUNT_KEY + " integer, "
|
||||
+ MailboxColumns.TYPE + " integer, "
|
||||
|
|
|
@ -192,6 +192,18 @@ public class EmailServiceProxy implements IEmailService {
|
|||
});
|
||||
}
|
||||
|
||||
public void setLogging(final boolean on) throws RemoteException {
|
||||
setTask(new Runnable () {
|
||||
public void run() {
|
||||
try {
|
||||
mService.setLogging(on);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void loadMore(long messageId, IEmailServiceCallback cb) throws RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
@ -212,4 +224,5 @@ public class EmailServiceProxy implements IEmailService {
|
|||
public IBinder asBinder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -800,6 +800,9 @@ public class EasSyncService extends InteractiveSyncService {
|
|||
mUserName = ha.mLogin;
|
||||
mPassword = ha.mPassword;
|
||||
|
||||
// Make sure account and mailbox are always the latest from the database
|
||||
mAccount = Account.restoreAccountWithId(mContext, mAccount.mId);
|
||||
mMailbox = Mailbox.restoreMailboxWithId(mContext, mMailbox.mId);
|
||||
try {
|
||||
if (mMailbox.mServerId.equals(Eas.ACCOUNT_MAILBOX)) {
|
||||
runMain();
|
||||
|
|
|
@ -34,4 +34,6 @@ interface IEmailService {
|
|||
boolean createFolder(long accountId, String name);
|
||||
boolean deleteFolder(long accountId, String name);
|
||||
boolean renameFolder(long accountId, String oldName, String newName);
|
||||
|
||||
void setLogging(boolean on);
|
||||
}
|
|
@ -44,7 +44,6 @@ import android.net.NetworkInfo;
|
|||
import android.net.Uri;
|
||||
import android.net.NetworkInfo.State;
|
||||
import android.os.Bundle;
|
||||
import android.os.Debug;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.PowerManager;
|
||||
|
@ -147,6 +146,10 @@ public class SyncManager extends Service implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
public void setLogging(boolean on) throws RemoteException {
|
||||
Eas.USER_DEBUG = on;
|
||||
}
|
||||
|
||||
public void loadMore(long messageId, IEmailServiceCallback cb) throws RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
@ -371,10 +374,10 @@ public class SyncManager extends Service implements Runnable {
|
|||
// Start our thread...
|
||||
if (mServiceThread == null || !mServiceThread.isAlive()) {
|
||||
log(mServiceThread == null ? "Starting thread..." : "Restarting thread...");
|
||||
mServiceThread = new Thread(this, "<MailService>");
|
||||
mServiceThread = new Thread(this, "SyncManager");
|
||||
mServiceThread.start();
|
||||
} else {
|
||||
log("Attempt to start MailService though already started before?");
|
||||
log("Attempt to start SyncManager though already started before?");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -591,7 +594,12 @@ public class SyncManager extends Service implements Runnable {
|
|||
public void run() {
|
||||
mStop = false;
|
||||
|
||||
//Debug.waitForDebugger(); // DON'T CHECK IN WITH THIS
|
||||
// if (Debug.isDebuggerConnected()) {
|
||||
// try {
|
||||
// Thread.sleep(10000L);
|
||||
// } catch (InterruptedException e) {
|
||||
// }
|
||||
// }
|
||||
|
||||
runAwake(-1);
|
||||
|
||||
|
@ -881,13 +889,14 @@ public class SyncManager extends Service implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wake up SyncManager to check for mailboxes needing service
|
||||
*/
|
||||
static public void kick() {
|
||||
if (INSTANCE == null) {
|
||||
return;
|
||||
}
|
||||
synchronized (INSTANCE) {
|
||||
INSTANCE.log("We've been kicked!");
|
||||
INSTANCE.notify();
|
||||
if (INSTANCE != null) {
|
||||
synchronized (INSTANCE) {
|
||||
INSTANCE.notify();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -911,6 +920,12 @@ public class SyncManager extends Service implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sent by services indicating that their thread is finished; action depends on the exitStatus
|
||||
* of the service.
|
||||
*
|
||||
* @param svc the service that is finished
|
||||
*/
|
||||
static public void done(AbstractSyncService svc) {
|
||||
long mailboxId = svc.mMailboxId;
|
||||
HashMap<Long, SyncError> errorMap = INSTANCE.mSyncErrorMap;
|
||||
|
|
|
@ -147,7 +147,6 @@ public class EasFolderSyncParser extends EasParser {
|
|||
} else
|
||||
skipTag();
|
||||
}
|
||||
|
||||
mAccount.saveOrUpdate(mContext);
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue