diff options
author | Susheel Yadagiri <syadagir@codeaurora.org> | 2015-10-28 16:42:37 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-12-07 22:35:27 -0800 |
commit | 17746e4b4d1847a177b73c15c347bd43b4c1aaad (patch) | |
tree | 0d89d99a808ed5c27761df8834c4120541090d0a /services | |
parent | 0a8e142de7c27a394b2480fdb1512f1a5d9f8742 (diff) | |
download | frameworks_base-17746e4b4d1847a177b73c15c347bd43b4c1aaad.zip frameworks_base-17746e4b4d1847a177b73c15c347bd43b4c1aaad.tar.gz frameworks_base-17746e4b4d1847a177b73c15c347bd43b4c1aaad.tar.bz2 |
Update the uid correctly.
use the pending intent to find out the uid rather than
from binder which is calling the api. If other alarms
get updated internally due to this call from the app, other
alarms will have invalid uid.
Update the worksource correctly with the next alarm that
will be processed, The blocked UID alarm processing will be delayed,
if we set that as the worksource that will not be correct.
During Alarm delivery also do a check if wake lock needs to be released.
As the UID might have been blocked already.
Change-Id: I954f09b87d73387e1a7afd862638d8a0e2a88a53
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/AlarmManagerService.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java index 8607a40..27858cb 100644 --- a/services/core/java/com/android/server/AlarmManagerService.java +++ b/services/core/java/com/android/server/AlarmManagerService.java @@ -2090,7 +2090,7 @@ class AlarmManagerService extends SystemService { workSource = _ws; flags = _flags; alarmClock = _info; - uid = _uid; + uid = operation.getCreatorUid(); pid = Binder.getCallingPid(); } @@ -2245,6 +2245,12 @@ class AlarmManagerService extends SystemService { mInFlight.add(inflight); mBroadcastRefCount++; mTriggeredUids.add(new Integer(alarm.uid)); + if (checkReleaseWakeLock()) { + if (mWakeLock.isHeld()) { + mWakeLock.release(); + if (localLOGV) Slog.v(TAG, "AM WakeLock Released Internally deliverAlarms"); + } + } if (allowWhileIdle) { // Record the last time this uid handled an ALLOW_WHILE_IDLE alarm. @@ -2713,8 +2719,12 @@ class AlarmManagerService extends SystemService { } } else { // the next of our alarms is now in flight. reattribute the wakelock. + InFlight inFlight = null; if (mInFlight.size() > 0) { - InFlight inFlight = mInFlight.get(0); + for(int index = 0; index < mInFlight.size(); index++){ + inFlight = mInFlight.get(index); + if(!mBlockedUids.contains(inFlight.mUid)) break; + } setWakelockWorkSource(inFlight.mPendingIntent, inFlight.mWorkSource, inFlight.mAlarmType, inFlight.mTag, false); } else { |