Lines Matching refs:wakeLock
267 private final ArrayList<WakeLock> mWakeLocks = new ArrayList<WakeLock>();
1046 WakeLock wakeLock;
1050 wakeLock = mWakeLocks.get(index);
1051 if (!wakeLock.hasSameProperties(flags, tag, ws, uid, pid)) {
1053 notifyWakeLockChangingLocked(wakeLock, flags, tag, packageName,
1055 wakeLock.updateProperties(flags, tag, packageName, ws, historyTag, uid, pid);
1066 wakeLock = new WakeLock(lock, flags, tag, packageName, ws, historyTag, uid, pid,
1069 lock.linkToDeath(wakeLock, 0);
1073 mWakeLocks.add(wakeLock);
1074 setWakeLockDisabledStateLocked(wakeLock);
1078 applyWakeLockFlagsOnAcquireLocked(wakeLock, uid);
1087 notifyWakeLockAcquiredLocked(wakeLock);
1093 private static boolean isScreenLock(final WakeLock wakeLock) {
1094 switch (wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK) {
1103 private void applyWakeLockFlagsOnAcquireLocked(WakeLock wakeLock, int uid) {
1104 if ((wakeLock.mFlags & PowerManager.ACQUIRE_CAUSES_WAKEUP) != 0
1105 && isScreenLock(wakeLock)) {
1108 if (wakeLock.mWorkSource != null && wakeLock.mWorkSource.getName(0) != null) {
1109 opPackageName = wakeLock.mWorkSource.getName(0);
1110 opUid = wakeLock.mWorkSource.get(0);
1112 opPackageName = wakeLock.mPackageName;
1113 opUid = wakeLock.mWorkSource != null ? wakeLock.mWorkSource.get(0)
1114 : wakeLock.mOwnerUid;
1116 wakeUpNoUpdateLocked(SystemClock.uptimeMillis(), wakeLock.mTag, opUid,
1132 WakeLock wakeLock = mWakeLocks.get(index);
1135 + " [" + wakeLock.mTag + "], flags=0x" + Integer.toHexString(flags));
1142 wakeLock.mLock.unlinkToDeath(wakeLock, 0);
1143 removeWakeLockLocked(wakeLock, index);
1147 private void handleWakeLockDeath(WakeLock wakeLock) {
1150 Slog.d(TAG, "handleWakeLockDeath: lock=" + Objects.hashCode(wakeLock.mLock)
1151 + " [" + wakeLock.mTag + "]");
1154 int index = mWakeLocks.indexOf(wakeLock);
1159 removeWakeLockLocked(wakeLock, index);
1163 private void removeWakeLockLocked(WakeLock wakeLock, int index) {
1165 UidState state = wakeLock.mUidState;
1171 notifyWakeLockReleasedLocked(wakeLock);
1173 applyWakeLockFlagsOnReleaseLocked(wakeLock);
1178 private void applyWakeLockFlagsOnReleaseLocked(WakeLock wakeLock) {
1179 if ((wakeLock.mFlags & PowerManager.ON_AFTER_RELEASE) != 0
1180 && isScreenLock(wakeLock)) {
1184 wakeLock.mOwnerUid);
1201 WakeLock wakeLock = mWakeLocks.get(index);
1204 + " [" + wakeLock.mTag + "], ws=" + ws);
1207 if (!wakeLock.hasSameWorkSource(ws)) {
1208 notifyWakeLockChangingLocked(wakeLock, wakeLock.mFlags, wakeLock.mTag,
1209 wakeLock.mPackageName, wakeLock.mOwnerUid, wakeLock.mOwnerPid,
1211 wakeLock.mHistoryTag = historyTag;
1212 wakeLock.updateWorkSource(ws);
1227 private void notifyWakeLockAcquiredLocked(WakeLock wakeLock) {
1228 if (mSystemReady && !wakeLock.mDisabled) {
1229 wakeLock.mNotifiedAcquired = true;
1230 mNotifier.onWakeLockAcquired(wakeLock.mFlags, wakeLock.mTag, wakeLock.mPackageName,
1231 wakeLock.mOwnerUid, wakeLock.mOwnerPid, wakeLock.mWorkSource,
1232 wakeLock.mHistoryTag);
1233 restartNofifyLongTimerLocked(wakeLock);
1244 private void restartNofifyLongTimerLocked(WakeLock wakeLock) {
1245 wakeLock.mAcquireTime = SystemClock.uptimeMillis();
1246 if ((wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK)
1248 enqueueNotifyLongMsgLocked(wakeLock.mAcquireTime + MIN_LONG_WAKE_CHECK_INTERVAL);
1252 private void notifyWakeLockLongStartedLocked(WakeLock wakeLock) {
1253 if (mSystemReady && !wakeLock.mDisabled) {
1254 wakeLock.mNotifiedLong = true;
1255 mNotifier.onLongPartialWakeLockStart(wakeLock.mTag, wakeLock.mOwnerUid,
1256 wakeLock.mWorkSource, wakeLock.mHistoryTag);
1260 private void notifyWakeLockLongFinishedLocked(WakeLock wakeLock) {
1261 if (wakeLock.mNotifiedLong) {
1262 wakeLock.mNotifiedLong = false;
1263 mNotifier.onLongPartialWakeLockFinish(wakeLock.mTag, wakeLock.mOwnerUid,
1264 wakeLock.mWorkSource, wakeLock.mHistoryTag);
1268 private void notifyWakeLockChangingLocked(WakeLock wakeLock, int flags, String tag,
1270 if (mSystemReady && wakeLock.mNotifiedAcquired) {
1271 mNotifier.onWakeLockChanging(wakeLock.mFlags, wakeLock.mTag, wakeLock.mPackageName,
1272 wakeLock.mOwnerUid, wakeLock.mOwnerPid, wakeLock.mWorkSource,
1273 wakeLock.mHistoryTag, flags, tag, packageName, uid, pid, ws, historyTag);
1274 notifyWakeLockLongFinishedLocked(wakeLock);
1276 // acquiring the new ones... we do this because otherwise once a wakelock
1279 restartNofifyLongTimerLocked(wakeLock);
1283 private void notifyWakeLockReleasedLocked(WakeLock wakeLock) {
1284 if (mSystemReady && wakeLock.mNotifiedAcquired) {
1285 wakeLock.mNotifiedAcquired = false;
1286 wakeLock.mAcquireTime = 0;
1287 mNotifier.onWakeLockReleased(wakeLock.mFlags, wakeLock.mTag,
1288 wakeLock.mPackageName, wakeLock.mOwnerUid, wakeLock.mOwnerPid,
1289 wakeLock.mWorkSource, wakeLock.mHistoryTag);
1290 notifyWakeLockLongFinishedLocked(wakeLock);
1498 final WakeLock wakeLock = mWakeLocks.get(i);
1499 switch (wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK) {
1825 final WakeLock wakeLock = mWakeLocks.get(i);
1826 switch (wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK) {
1828 if (!wakeLock.mDisabled) {
1895 final WakeLock wakeLock = mWakeLocks.get(i);
1896 if ((wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK)
1898 if (wakeLock.mNotifiedAcquired && !wakeLock.mNotifiedLong) {
1899 if (wakeLock.mAcquireTime < when) {
1901 notifyWakeLockLongStartedLocked(wakeLock);
1904 long checkTime = wakeLock.mAcquireTime + MIN_LONG_WAKE_CHECK_INTERVAL;
2945 final WakeLock wakeLock = mWakeLocks.get(i);
2946 if ((wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK)
2948 if (setWakeLockDisabledStateLocked(wakeLock)) {
2950 if (wakeLock.mDisabled) {
2952 notifyWakeLockReleasedLocked(wakeLock);
2954 notifyWakeLockAcquiredLocked(wakeLock);
2965 private boolean setWakeLockDisabledStateLocked(WakeLock wakeLock) {
2966 if ((wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK)
2969 final int appid = UserHandle.getAppId(wakeLock.mOwnerUid);
2973 disabled = !wakeLock.mUidState.mActive &&
2974 wakeLock.mUidState.mProcState
2976 wakeLock.mUidState.mProcState > ActivityManager.PROCESS_STATE_RECEIVER;
2981 final UidState state = wakeLock.mUidState;
2990 if (wakeLock.mDisabled != disabled) {
2991 wakeLock.mDisabled = disabled;
3368 for (WakeLock wl : mWakeLocks) {
3723 for (WakeLock wl : mWakeLocks) {
3863 private final class WakeLock implements IBinder.DeathRecipient {
3878 public WakeLock(IBinder lock, int flags, String tag, String packageName,