Fix strict mode violation in maybeStartExchangeServiceThread

Bug: 3133688
Change-Id: I94d0b6269c6ebffa54f4a0b29689004feccb01d6
This commit is contained in:
Marc Blank 2010-10-26 12:24:32 -07:00
parent 53e9f81822
commit 0e1ffb033a
1 changed files with 21 additions and 8 deletions

View File

@ -1785,16 +1785,29 @@ public class ExchangeService extends Service implements Runnable {
}
void maybeStartExchangeServiceThread() {
// Start our thread...
// See if there are any EAS accounts; otherwise, just go away
if (EmailContent.count(this, HostAuth.CONTENT_URI, WHERE_PROTOCOL_EAS, null) > 0) {
if (sServiceThread == null || !sServiceThread.isAlive()) {
log(sServiceThread == null ? "Starting thread..." : "Restarting thread...");
sServiceThread = new Thread(this, "ExchangeService");
INSTANCE = this;
sServiceThread.start();
synchronized (sSyncLock) {
// Start our thread...
// See if there are any EAS accounts; otherwise, just go away
if (sServiceThread != null || sServiceThread.isAlive()) {
return;
}
}
final ExchangeService service = this;
Utility.runAsync(new Runnable() {
@Override
public void run() {
synchronized (sSyncLock) {
if (EmailContent.count(service, HostAuth.CONTENT_URI,
WHERE_PROTOCOL_EAS, null) > 0) {
log(sServiceThread == null ? "Starting thread..."
: "Restarting thread...");
sServiceThread = new Thread(this, "ExchangeService");
INSTANCE = service;
sServiceThread.start();
}
}
}
});
}
/**