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

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

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) { private void acquireWakeLock(long id) {
synchronized (mWakeLocks) { synchronized (mWakeLocks) {
Long lock = mWakeLocks.get(id); 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) { static public void runAwake(long id) {
SyncManager ssm = INSTANCE; SyncManager ssm = INSTANCE;
if (ssm != null) { if (ssm != null) {