summaryrefslogtreecommitdiffstats
path: root/services/usage
Commit message (Collapse)AuthorAgeFilesLines
* DO NOT MERGE ANYWHERE: Hack to get devices booting again.Jeff Sharkey2016-02-241-1/+13
| | | | | | | | | If we try scheduling a pass before the system is ready, record a pending event and dispatch once we're actually ready. Bug: 26863668 Change-Id: I028285383c8bbe8b653aeaa7544eefe3d41277bc (cherry picked from commit 538c11cf2175d4e30337e8776401bfede85866be)
* DO NOT MERGE ANYWHERE: Don't change screen on time on time changesAdam Lesinski2016-02-242-39/+56
| | | | | | | | | | | | | | | Screen on time should be measured in elapsed realtime, not wallclock. Cause a checkIdleStates to occur when reloading stats (on rollover and on time change). When time changes occur in the negative direction, the new stats file we create can overlap the previous one with regards to its end timestamp. Use the begin timestamp to determine which of the latest stats to merge. (b/22716352) Bug: 26488100 Change-Id: If31b29bbbee9e98401205b5e26bce86e181286e7
* DO NOT MERGE Check apps idle states on time changesAmith Yamasani2016-02-241-1/+2
| | | | | | | | | | | And ensure that the listeners are informed of app standby transitions that might occur during time changes. Fix for apps that sometimes don't have network access until reboot. Bug: 26488100 Change-Id: Ic342c188a6cd19faee88f50b2c6a342a6968cb23 (cherry picked from commit c465e71cdc401e1565c29a895a5c6d366ba5344c)
* DO NOT MERGE ANYWHERE: UsageStats: Use new settings key idle_duration2 for ↵Adam Lesinski2016-02-242-3/+17
| | | | | | | | | | | app idle Ignores the old, re-appropriated key "idle_duration" which is now set to a high value in order to force disable app idle on devices with bug b/26355386 Bug:26355386 Change-Id: Iff9de843ad6e547d29c1583687fc7f7ce7e15090
* DO NOT MERGE ANYWHERE: UsageStats: Fix issue where initializing data for ↵Adam Lesinski2016-02-242-35/+41
| | | | | | | | | | | | | | first time would cause crash With the updated rolling window of stats for app idleness, we need to make sure it is populated before we initialize some defaults. Now that we look at older entries to figure out idleness, if those entries are in the future (due to time change), set them to the current screen on time. Bug:26504153 Change-Id: Ia22add0e8eaf0f137002bbe3e91d747fef5b7d69
* DO NOT MERGE ANYWHERE: UsageStatsService: Fix app idle issue at rollover timeAdam Lesinski2016-02-241-4/+81
| | | | | | | | | | | | | App Idle queries are very frequent and so they only check in memory stats. However, in memory stats can be missing some entries, especially after a rollover, but also due to a larger bug fixed in master (too risky to take now). The fix is to do a deep query (reading older files from disk) and maintain a parallel cache of stats for app idle. That way the rolling window of data required to serve app idle queries stays in memory. Bug:26355386 Change-Id: I6a29bbc25214f6a3c2f24c8c079936e66f99e42e
* Fix issue #25357209: Could not send SMS or MMS messages, had to rebootDianne Hackborn2015-11-031-12/+30
| | | | | | | | | | | | | | | | I think what probably happened is that since we only report an app going in to the "interaction" state as an interaction event to usage stats, apps that sit around in that state forever will only see one interaction at the start and never again. So usage stats could start thinking they are idle. Fix this by having the activity manager report an interaction event for such long running applications at least once a day. Also, because it is correct and for paranoia by protected us another way, system uids should never go in to standby. Change-Id: I8a3805bfca86cbe78560488a649ecd07427da99a
* Fix parole scheduling bugs.Jeff Sharkey2015-09-141-3/+2
| | | | | | | | | | There were a few subtle bugs in app idle parole scheduling that would cause us to never end a parole period we had entered. The updated logic in this change concentrates the registration for the next event in one place in setAppIdleParoled(). Bug: 24050462 Change-Id: I1efe43cd6e00a547f70c4a4a37e1f3ef52a7e706
* Fix issue #23270878: NPE in UsageStatsService while running UserManagementTestDianne Hackborn2015-08-181-0/+3
| | | | Change-Id: I34d4fcdc103b3a6ea5c4ed78895f2fe18597237a
* Fix issue #22989030: Separate battery whitelistsDianne Hackborn2015-08-071-1/+77
| | | | | | | | | | | | | | | | | | | | | | | | We now have a new whitelist you can put apps in, which opts them out of the old battery saver mode and new app idle, but doesn't keep them from going in to doze. This is for a few special cases that we had previously whitelisted for battery saver, and inherited to the new modes... ultimately we should figure out how to get these apps out of the whitelist completely, but this will help for now. Apps in this new whitelist are not shown in the UI, because they are still significantly restricted by not being able to operate normally in doze. This also means they are still visible in the list of all apps for the user to be able to put them on/off the complete whitelist if that is what they really want. In the course of doing this, I needed to clean up code in the network policy manager to better separate management of the two firewall rules that now have different whitelists applied to them. This also hopefully just generally simplifies and cleans up that code. Hopefully! Change-Id: I92e15f2f85899571dd8b049b5e3eb1354f55f353
* Merge "Ignore the active network scorer when checking for idleness" into mnc-devWenchao Tong2015-07-231-0/+11
|\
| * Ignore the active network scorer when checking for idlenessWenchao Tong2015-07-221-0/+11
| | | | | | | | | | Bug: 22667334 Change-Id: I97085e653c146eff148458440bbac0a2ac64d6d2
* | UsageStats: Reduce log spam during time changeAdam Lesinski2015-07-221-4/+15
| | | | | | | | | | | | | | | | With lots of usage stats files, the log gets spammy when the time changes and we are moving files around. Bug:22549399 Change-Id: I9da39399b090066d52568dea6fc5b59aba063c5a
* | UsageStats: Gracefully handle corrupt filenamesAdam Lesinski2015-07-222-5/+21
|/ | | | | | | | Not sure how useful this is, since renames should be atomic. If the filesystem is corrupt I'm sure other parts of the system will break. Good to be safe though! Bug:22172659 Change-Id: Iad339be2869d170bcf736c59feb93830a51905e1
* Fix issue #21626564: MMS should be receivied while DozingDianne Hackborn2015-07-141-1/+5
| | | | | | | | | | | | | | | | | | | | | | We now place whoever is receiving the MMS on the temporary whitelist while doing so, so they can get network access to download it. There was also an issue that needed to be fixed where we were no longer updating the list of allowed uids while dozing based on their proc states... we now do that. Also did a bit of optimization of the temp white list update path do the network policy manager, instead of going through a broadcast we now directly call in to the network policy manager. This also allows us to have a synchronous version of updating the list, so we can know the app has network access before we tell it to do anything. Finally added battery stats events for things going on and off the whitelist so we can diagnose the behavior there. Change-Id: Ic7fe010af680034d9f8cb014bb135b2addef7455
* system_server: optimize app idle parole state changeXiaohui Chen2015-06-221-9/+33
| | | | | | | | | | | Currently when app idle parole state changes, all idle apps' states are updated one by one including firewall modifications which are very expensive. This optimization gets rid of individual firewall rule changes and makes sure we only modify the firewall once at child chain level. BUG: 21446713 Change-Id: Iafc415fe0bc127826fe17894d4fedcf1755cb17d
* Fix issue #21930140: Add config to turn off auto power featuresDianne Hackborn2015-06-221-8/+31
| | | | | | | | Doze and app standby are now off in the default platform config. The Google overlay turns them on. Other people can do that as well, if they are feeling like it. Change-Id: Ic8a87f696df94f2d8354fe0772d03b672f464e32
* App Standby : Association between content providers and their sync adapterAmith Yamasani2015-06-191-1/+47
| | | | | | | | | | | | | Set sync adapters to active if the associated content providers are used at foreground process state. Minimize how frequently published content providers are reported by keeping track of last reported time. Also cache sync adapters associated with an authority in SyncManager. Bug: 21785111 Change-Id: Ic2c8cb6a27f005d1a1d0aad21d36b1510160753a
* Fix issue #21814207 and issue #21814212 (alarm manager)Dianne Hackborn2015-06-171-2/+2
| | | | | | | | | | | | | | | | | Issue #21814207: AlarmManager.setAndAllowWhileIdle should also allow wake locks. Introduce a whole new infrastructure for providing options when sending broadcasts, much like ActivityOptions. There is a single option right now, asking the activity manager to apply a tempory whitelist to each receiver of the broadcast. Issue #21814212: Need to allow configuration of alarm manager parameters The various alarm manager timing configurations are not modifiable through settings, much like DeviceIdleController. Also did a few tweaks in the existing DeviceIdleController impl. Change-Id: Ifd01013185acc4de668617b1e46e78e30ebed041
* Fix issue #21813831: Need API for asking to be added to power whitelistDianne Hackborn2015-06-151-1/+1
| | | | | | Add the API. Clean up a few related things. Change-Id: I190adad1812f36f6095b98a1001fedb94874e8b5
* Merge "Fix negative inactiveTime on creating a new user" into mnc-devAmith Yamasani2015-06-121-1/+1
|\
| * Fix negative inactiveTime on creating a new userAmith Yamasani2015-06-121-1/+1
| | | | | | | | | | | | | | Initialize the beginIdleTime to 0 rather than current time. Bug: 21699099 Change-Id: Ib94a9198c4e80aea5d9de68c5cf5d6f8cfc79e0a
* | App Standby: Convert constants to Settings.GlobalAdam Lesinski2015-06-121-35/+85
|/ | | | | | | Use settings instead of hardcoded constants, and listen for their changes. Bug:21640379 Change-Id: Id8305bb234f93f7c64c1a5e82e26b31504624324
* Report app standby state to batterystatsAmith Yamasani2015-06-122-46/+106
| | | | | | | | Also reduce idle checks to the target user if possible. Optimized calls to some internal methods Bug: 21639147 Change-Id: If1faf26f862e5c4ca905f2603a4ba52a8d1af954
* UsageStats: Change INTERACTION to SYSTEM_INTERACTIONAdam Lesinski2015-06-114-20/+40
| | | | | | | | | | | SYSTEM_INTERACTION events are signals to the system for a package's implicit actions (service bound, etc). These should not affect the API visible stats like lastTimeUsed, etc. USER_INTERACTION is for user initiated actions (notification interaction, etc). Bug:21761781 Change-Id: I4585cf35fbb158612a3c737710108bec34e89183
* Ignore carrier apps when checking for idlenessZach Johnson2015-06-081-0/+11
| | | | | | | Also introduce a way to check if a package has carrier privileges for any active phone. Change-Id: If5c5fe07f05ffc90fc21431eb27cf48030c0175b
* Temporarily whitelist an app for network during dozeAmith Yamasani2015-06-021-8/+14
| | | | | | | | | | | | | | | API to allow an app to be whitelisted for network and wakelock access for a short period. So even if the device is in idle mode, such apps can be given a chance to download the payload related to a high priority cloud-to-device message. This API is meant for system apps only. A new permission CHANGE_DEVICE_IDLE_TEMP_WHITELIST is required to make this call. Bug: 21525864 Change-Id: Id7a761a664f21af5d7ff55aa56e8df98d15511ca
* Use screen-on time and wallclock time for idleness calcAmith Yamasani2015-05-203-25/+62
| | | | | | | | 12 hours of screen-on time and 2 days of wallclock time must elapse before considering an app idle. Bug: 20066058 Change-Id: Ie7b584b40e644d868aa2708876723c3391fd432e
* Allow settings to change app inactive stateAmith Yamasani2015-05-131-1/+2
| | | | Change-Id: I57efb4b5fa69c9a268025fb1ef83de36c4cc83ca
* Track app idle history and dump itAmith Yamasani2015-05-132-8/+116
| | | | | | | | | "dumpsys usagestats history" will show the active state of each app for the last 100 hours, if the device hasn't rebooted. Bug: 20066058 Change-Id: I703e5bc121298e4363c202da56fffb0b8534bcaf
* Allow exemption to idle apps at periodic intervalsAmith Yamasani2015-05-122-10/+115
| | | | | | | | Triggers are device idle mode changing as well as internal delayed message handlers. Bug: 20066058 Change-Id: I0627cfbcc16cfc2b8ac7d298fd2c681a5a6571dd
* Idle timebaseAmith Yamasani2015-05-114-63/+192
| | | | | | | | | | | | | | | Use screen on time as timebase for idling out apps that have been inactive. Store the time when an app was last active as an additional package state in UsageStats. Compare it to screenOnTime to decide if it's inactive. Exclude device idle whitelist from apps that can go inactive. Bug: 20066058 Change-Id: I709f9f31a9affa7ca6e1ae3e4c5729c5fb221669
* Rename *AppIdle to *AppInactive per api-councilAmith Yamasani2015-05-081-3/+3
| | | | | | | Change to setAppInactive and isAppInactive in a few places. Bug: 20823737 Change-Id: Ie57dbc0dd2842e771bb5fd9f69b8041aacaa005c
* Exclude bound app widgets from idle app listAmith Yamasani2015-05-011-0/+9
| | | | | | | | Track package names of bound app widgets and use the list when querying for idle apps. Bug: 20066058 Change-Id: If8039397a061ef04bb13aa38d57cd7f0221f5fc7
* Remove network access for idle appsAmith Yamasani2015-04-291-11/+95
| | | | | | | | | | | | | | | | | | Track apps going in and out of idle in the NetworkPolicyManagerService. Apply DROP rules in firewall controller if app is to be blacklisted for network access. Firewall can now be in whitelist (old) or blacklist mode. When in blacklist, it allows all by default and we can selectively DENY some uids. Track app idle in UsageStats and update periodically. Track charging/discharging states. TODO: Check for appidle temporary parole state Bug: 20066058 Change-Id: Ia65d7544204b3bcb78a517310ef4adcc05aac6fb
* More usage trackingAmith Yamasani2015-04-241-3/+2
| | | | | | | | | Notification listeners can now report that a notification has been seen by the user and that package is then marked as active. Bug: 20066058 Change-Id: I336040a52c44c21fd0d78b02ec9a19d448c64b40
* Add ability to get and set idle state of appsAmith Yamasani2015-04-242-0/+111
| | | | | | | | | Add am shell command to set and get idle Add public API to check if an app is idle Bug: 20534955 Bug: 20493806 Change-Id: Ib48b3fe847c71f05ef3905563f6e903cf060c498
* Delay syncs for idle appsAmith Yamasani2015-04-131-0/+4
| | | | | | | | Apps that haven't been in use for a while and are considered idle are not synced until the device is charging or the app is used. Bug: 20066058 Change-Id: I3471e3a11edae04777163b0dbd74e86495743caa
* Mark apps as not-idle at least onceAmith Yamasani2015-04-063-4/+78
| | | | | | | | | | | | On a fresh boot or update to M, mark existing apps as being used if there is no existing entry in the usage stats. On subsequent OTAs, make sure that at least the new system apps are marked as used. Reduce idle threshold to 1 day. Bug: 20066058 Change-Id: I9a273c051d04432877bacd381c85bf6e721c1a85
* Throttle jobs for idle appsAmith Yamasani2015-04-032-2/+148
| | | | | | | | | | | | | | | | | | | First pass at delaying jobs from apps that are idle. TODO: Throttle syncs TODO: Provide a periodic point at which apps are checked for idleness. Apps that switch to foreground process state are tracked by UsageStats as an INTERACTION event that affects the last-used timestamp. JobScheduler's logic for when an app is ready is trumped by the idleness of the app, and only if the battery is not charging. When charging state changes, we update the idle state of all the tracked jobs. android package is whitelisted. Bug: 20066058 Change-Id: I0a0acb517b100a5c7b11e3f435f4141375f3451f
* Merge "Fix issue where pruned UsageStats files would not be removed from index"Adam Lesinski2015-03-021-12/+17
|\
| * Fix issue where pruned UsageStats files would not be removed from indexAdam Lesinski2015-03-021-12/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This would cause an exception to be thrown when querying stats that included a deleted file and cause only in-memory stats to be returned. This change now re-indexes after deleting files. Furthermore, we continue reading UsageStats files in order to return more useful data if some other issue (file corruption) leads us to fail reading a file. Change-Id: I4a52739624d68e719e3d7d324a0b16709a62ac7a
* | Merge "Add generic "INTERACTION" event type to UsageStatsManager"Adam Lesinski2015-03-023-1/+35
|\ \ | |/
| * Add generic "INTERACTION" event type to UsageStatsManagerAdam Lesinski2015-03-023-1/+35
| | | | | | | | | | | | | | | | This will allow for updating a package's last time used property for packages that are interacted in ways other than launching their activities (interacting with notifications, etc.) Change-Id: Ic6f9519f46fa04abd37ea6fc9475bcd9ea721003
* | Fix UsageStats to report correct endTime from XMLEdward Cunningham2015-02-271-1/+1
|/ | | | | Bug: 19529542 Change-Id: Iacb1a245a40c6b88ae15740797217f59d5fca1e6
* UsageStatsService: Update file index to prevent double checkinAdam Lesinski2014-11-072-14/+31
| | | | | | | | | We seem to have renamed a file as checked-in twice, which means we checked it in twice and created a malformed name with the suffix "-c-c" instead of the correct suffix "-c". Bug:18280677 Change-Id: Ie3164010898a333e5d9b97151d285ea376de799e
* Fix bug where checking-in more than once would cause an infinite loop in ↵Adam Lesinski2014-11-041-0/+1
| | | | | | | | | UsageStatsService - Forgot to increment loop variable :S Bug:18239732 Change-Id: Ie37a83584d7849108dbfd3bd4cbb595520d488b1
* Merge "Add dumpsys output to UsageStatsService, along with --checkin ↵Adam Lesinski2014-10-294-14/+240
|\ | | | | | | support" into lmp-mr1-dev
| * Add dumpsys output to UsageStatsService, along with --checkin supportAdam Lesinski2014-10-244-14/+240
| | | | | | | | | | Bug:17814138 Change-Id: If414ae5f4b8e4a2838f63f52d80e764915cee934
* | Get UsageStats if no PackageUsage is available for boot dexopt filtering.Jeff Hao2014-10-231-1/+6
|/ | | | | Bug: 17191977 Change-Id: I33e18459e49afa42b8e8218574a2434e5205a6da