Add a way to check whether we have a wakelock.
Bug: 8640907 Change-Id: I886af09d20dab195a9bbd38082a02d29e8b864e7
This commit is contained in:
parent
87d5fd399f
commit
7539508bfc
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user