am 8d971dbc: Remove inappropriate references to INSTANCE in SyncManager

Merge commit '8d971dbc9c86873a21aa79dfb955313b1230c74a'

* commit '8d971dbc9c86873a21aa79dfb955313b1230c74a':
  Remove inappropriate references to INSTANCE in SyncManager
This commit is contained in:
Marc Blank 2009-08-17 11:12:42 -07:00 committed by Android Git Automerger
commit a182b1970d

View File

@ -757,14 +757,13 @@ public class SyncManager extends Service implements Runnable {
Boolean lock = mWakeLocks.get(id); Boolean lock = mWakeLocks.get(id);
if (lock == null) { if (lock == null) {
if (id > 0) { if (id > 0) {
//INSTANCE.log("+WakeLock requested for " + alarmOwner(id)); //log("+WakeLock requested for " + alarmOwner(id));
} }
if (mWakeLock == null) { if (mWakeLock == null) {
PowerManager pm = (PowerManager)INSTANCE PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
.getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MAIL_SERVICE"); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MAIL_SERVICE");
mWakeLock.acquire(); mWakeLock.acquire();
INSTANCE.log("+WAKE LOCK ACQUIRED"); log("+WAKE LOCK ACQUIRED");
} }
mWakeLocks.put(id, true); mWakeLocks.put(id, true);
//logLocks("Post-acquire of WakeLock for " + alarmOwner(id) + ": "); //logLocks("Post-acquire of WakeLock for " + alarmOwner(id) + ": ");
@ -777,7 +776,7 @@ public class SyncManager extends Service implements Runnable {
Boolean lock = mWakeLocks.get(id); Boolean lock = mWakeLocks.get(id);
if (lock != null) { if (lock != null) {
if (id > 0) { if (id > 0) {
//INSTANCE.log("+WakeLock not needed for " + alarmOwner(id)); //log("+WakeLock not needed for " + alarmOwner(id));
} }
mWakeLocks.remove(id); mWakeLocks.remove(id);
if (mWakeLocks.isEmpty()) { if (mWakeLocks.isEmpty()) {
@ -785,7 +784,7 @@ public class SyncManager extends Service implements Runnable {
mWakeLock.release(); mWakeLock.release();
} }
mWakeLock = null; mWakeLock = null;
INSTANCE.log("+WAKE LOCK RELEASED"); log("+WAKE LOCK RELEASED");
} else { } else {
//logLocks("Post-release of WakeLock for " + alarmOwner(id) + ": "); //logLocks("Post-release of WakeLock for " + alarmOwner(id) + ": ");
} }
@ -824,7 +823,7 @@ public class SyncManager extends Service implements Runnable {
AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE); AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + millis, pi); alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + millis, pi);
//INSTANCE.log("+Alarm set for " + alarmOwner(id) + ", " + millis/1000 + "s"); //log("+Alarm set for " + alarmOwner(id) + ", " + millis/1000 + "s");
} }
} }
} }
@ -1025,7 +1024,7 @@ public class SyncManager extends Service implements Runnable {
mNextWaitReason = "Heartbeat"; mNextWaitReason = "Heartbeat";
long nextWait = checkMailboxes(); long nextWait = checkMailboxes();
try { try {
synchronized (INSTANCE) { synchronized (this) {
if (nextWait < 0) { if (nextWait < 0) {
log("Negative wait? Setting to 1s"); log("Negative wait? Setting to 1s");
nextWait = 1*SECONDS; nextWait = 1*SECONDS;
@ -1036,7 +1035,7 @@ public class SyncManager extends Service implements Runnable {
if (nextWait != SYNC_MANAGER_HEARTBEAT_TIME) { if (nextWait != SYNC_MANAGER_HEARTBEAT_TIME) {
log("Next awake in " + (nextWait / 1000) + "s: " + mNextWaitReason); log("Next awake in " + (nextWait / 1000) + "s: " + mNextWaitReason);
} }
INSTANCE.wait(nextWait); wait(nextWait);
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
// Needs to be caught, but causes no problem // Needs to be caught, but causes no problem
@ -1062,7 +1061,7 @@ public class SyncManager extends Service implements Runnable {
ArrayList<Long> deletedMailboxes = new ArrayList<Long>(); ArrayList<Long> deletedMailboxes = new ArrayList<Long>();
synchronized (sSyncToken) { synchronized (sSyncToken) {
for (long mailboxId: mServiceMap.keySet()) { for (long mailboxId: mServiceMap.keySet()) {
Mailbox m = Mailbox.restoreMailboxWithId(INSTANCE, mailboxId); Mailbox m = Mailbox.restoreMailboxWithId(this, mailboxId);
if (m == null) { if (m == null) {
deletedMailboxes.add(mailboxId); deletedMailboxes.add(mailboxId);
} }