am 7539508b: Add a way to check whether we have a wakelock.

* commit '7539508bfc315fb3fce10d57da27762dab4d2bd4':
  Add a way to check whether we have a wakelock.
This commit is contained in:
Yu Ping Hu 2013-04-19 08:46:52 -07:00 committed by Android Git Automerger
commit d26ec600f1

View File

@ -980,6 +980,12 @@ public abstract class SyncManager extends Service implements Runnable {
}
}
private boolean hasWakeLock(long id) {
synchronized (mWakeLocks) {
return mWakeLocks.get(id) != null;
}
}
private void acquireWakeLock(long id) {
synchronized (mWakeLocks) {
Long lock = mWakeLocks.get(id);
@ -1075,6 +1081,14 @@ public abstract class SyncManager extends Service implements Runnable {
}
}
static public boolean isHoldingWakeLock(long id) {
SyncManager ssm = INSTANCE;
if (ssm != null) {
return ssm.hasWakeLock(id);
}
return false;
}
static public void runAwake(long id) {
SyncManager ssm = INSTANCE;
if (ssm != null) {