summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/ThrottleService.java
AgeCommit message (Collapse)Author
2013-01-14Removed Throttle Manager as obsoleteSasha Levitskiy
Change-Id: I63e8514f34c880d0badaab33a347f54a80c84da6
2012-09-26First step towards cleaning up Global settings.Jeff Sharkey
Remove all @Deprecated @hide settings, and clean up any stragglers. Bug: 7232125 Change-Id: Ibf67093c728d4a28565129b923edb1701d3b2789
2012-09-24Fix issue #7214090: Need to be able to post notifications to all usersDianne Hackborn
Also fix a bunch of system services that should be doing this. And while doing that, found I needed to fix PendingIntent to evaluate USER_CURRENT at the point of sending, not creation. Note that this may end up with us having some notification shown to non-primary users that lead to settings UI that should only be for the primary user (such as the vpn notification). I'm not sure what to do about this, maybe we need a different UI to come up there or something, but showing the actual notification for those users at least seems less broken than not telling them at all. Change-Id: Iffc51e2d7c847e3d05064d292ab93937646a1ab7
2012-08-30Improve multi-user broadcasts.Dianne Hackborn
You can now use ALL and CURRENT when sending broadcasts, to specify where the broadcast goes. Sticky broadcasts are now correctly separated per user, and registered receivers are filtered based on the requested target user. New Context APIs for more kinds of sending broadcasts as users. Updating a bunch of system code that sends broadcasts to explicitly specify which user the broadcast goes to. Made a single version of the code for interpreting the requested target user ID that all entries to activity manager (start activity, send broadcast, start service) use. Change-Id: Ie29f02dd5242ef8c8fa56c54593a315cd2574e1c
2012-07-17Network data activity change intent for network interfaces.Haoyu Bai
The activity notification is received from netd, an intent DATA_ACTIVITY_CHANGE is then raised for other part of the system to consume. Change-Id: Idfcc4763c51c5b314c57f546c12557082f06bebf
2012-05-01Begin collecting xtables iface counters.Jeff Sharkey
Add method to parse new iface_stat_fmt proc stats, or return null when kernel support is unavailable. Add test and remove older, unused parsing code. Create new "xt" recorder to persist the new xtables counters when available. Add SSID support to NetworkIdentity to fix policy tests. Bug: 6422414 Change-Id: I77f70e9acb79a559ab626f3af5c4f3599801ed43
2011-08-24Data usage buckets active time, parsing ISE.Jeff Sharkey
When recording data usage, measure the actual active time, since buckets can be quite long. Offer incrementOperationCount() version that reads thread stats tag for caller. Rethrow any NPE as ISE during stats parsing, which callers already handle. Bug: 5171812, 5184508, 5180659 Change-Id: I6da80ccc0162be68bee279529e3a23b6f98ebd87
2011-08-15Foreground/background network stats using sets.Jeff Sharkey
Teach NetworkStats about "counter sets" coming from kernel, and use them to track usage in foreground/background. Add AID_NET_BW_ACCT to system_server so it can control counter sets. Move to composite key of NetworkIdentitySet, UID, set, and tag when recording historical usage. Persisting still clusters by identity, since that is heaviest object. Request async stats poll during systemReady() to bootstrap later delta calculations. Reset kernel counters when UID removed. Update various tests. Bug: 5105592, 5146067 Change-Id: Idabec9e3ffcaf212879821515602ecde0a03de8c
2011-07-14NetworkManagementService: receive bandwidth controller eventsJP Abgrall
This is a 1st pass at receiving events that indicate some quota has been reached e.g. warning quota, data collection quota, cutoff quota,... It needs: - new kernel with quota2 logging support - new net:bandwidthcontroller that supports . quota2, . setting alerts. - new NetlinkEvent/NetlinkManager/NetlinkHandler to process NETLINK NFLOG messages. Change-Id: Ibfbb13512c5350cdee0e544ec14caa6f59812409
2011-07-12Hide NetworkStatsHistory internals.Jeff Sharkey
Instead of exposing internal storage details, offer getValues() accessor which populates values into a recycled structure. Change-Id: I5228d7099a8f61b2018a435a813435a67dae49b4
2011-07-10Cached NTP time for system services.Jeff Sharkey
Uses NTP server and timeout from secure settings, or fallback to defaults in resources. Update various system services to use cached NTP time when fresh enough, or force updates as needed. Bug: 4517273 Change-Id: Ie1c4c4883836013d02ca0bbd850cf8949f93b34b
2011-06-24Hookup interface status to other clientsMike J. Chen
After unreverting the linkstate change patch, hook up notification handlers that didn't exist when the first patch was created, like EthernetDataTracker.java and Vpn.java. For the observers that handle interfaceStatusChanged(), I made interfaceLinkStatusChanged() call it so they both do the same thing. Change-Id: I0077e5e5f48f3932ba98f5bf363243892f2de6cc Signed-off-by: Mike J. Chen <mjchen@google.com>
2011-06-23Revert "Revert "Propagate new link-status-change message to any ↵Mike J. Chen
NetworkManagementService"" This reverts commit 1a7e67190228a8ff3b92e7e5496a8db8ff306cca. Bring back the changes from Stan Chesnutt regarding link-status-change notifications. The comment from the original patch was: Propagate new link-status-change message to any NetworkManagementService observers. Also fix the syntax of the "interface-status-change" message. Add a null handler in the ThrottleService and Tethering classes (plus fix names). Change-Id: I42cbed692024de32275cad234f42ff23ab7e9d8d Signed-off-by: Mike J. Chen <mjchen@google.com>
2011-06-18Read "qtaguid" network stats, refactor templates.Jeff Sharkey
Teach NMS to read qtaguid stats from kernel, but fall back to older stats when kernel doesn't support. Add "tags" to NetworkStats entries to support qtaguid. To work around double-reporting bug, subtract tagged stats from TAG_NONE entry. Flesh out stronger NetworkTemplate. All NetworkStatsService requests now require a template, and moved matching logic into template. Record UID stats keyed on complete NetworkIdentitySet definition, similar to how interface stats are stored. Since previous UID stats didn't have iface breakdown, discard during file format upgrade. Change-Id: I0447b5e7d205d73d28e71c889c568e536e91b8e4
2011-05-04Return NetworkStats bundle from NM service.Jeff Sharkey
Introduce NetworkStats which is a collection of network statistics, which should match the structure communicated by kernel module through netd. Will introduce tags and fg/bg stats later. Kept entirely in a flat data structure to optimize parcel speed. Initial pass at returning NetworkStats from NetworkManagementService, both summary and details. Will eventually pull data from kernel module over netd connection. Change-Id: I92d9f61678ec8c22e2ce26775fb035a0cf32413f
2011-04-28Tests for ThrottleService, NTP into TrustedTime.Jeff Sharkey
Wrote initial suite of tests for ThrottleService, checking a variety of edge cases. Checks going over limits, updating policies, and reset after cycle elapses. Moved NTP code in ThrottleService into new TrustedTime interface, which makes it easier to understand, and allows tests to provide custom clocks. Change-Id: I0d62b8b3a169516a2ab2d33025f6fe30dc792be8
2011-01-09Revert "Propagate new link-status-change message to any ↵Wink Saville
NetworkManagementService" This reverts commit 780dfa42aa8664afa53c30ae669fc0e1f10f6537.
2011-01-07Propagate new link-status-change message to any NetworkManagementServiceStan Chesnutt
observers. Also fix the syntax of the "interface-status-change" message. Add a null handler in the ThrottleService and Tethering classes (plus fix names). Change-Id: I58cabc7b0ce5662243bc6513b2de4818065e6c52
2010-06-16Reorder ThrottleService startup to avoid race.Robert Greenwalt
Don't start people reading settings until after the settings (ntp server settings) are loaded. bug:2608189 Change-Id: I7dfaa1e9418b98a141d17dc35d22ff42fcfa052f
2010-06-08resolved conflicts for merge of ee09dc67 to masterRobert Greenwalt
Change-Id: I8b0b595580d9c6d44b84e636012705dc913fa6ac
2010-06-07Cut logging, boost efficiency of ThrottleServiceRobert Greenwalt
Changed the Alarms to be non-waking. bug:2748959 bug:2747862 Change-Id: I9e4294162a4fc2f90aed36393b858edcf82aa307
2010-05-26resolved conflicts for merge of 3cd6a3e3 to masterRobert Greenwalt
Change-Id: If3e45cc3494b2c52a1f1dcc19deff763a50498d7
2010-05-25Make the NTP Cache max-age gservices-settableRobert Greenwalt
Trying to make Throttle polling more energy efficient. bug:2708119 Change-Id: I2b75639e202dcbcee11047c43407a22de04ce350
2010-05-11Fix throttle datafile parsing.Robert Greenwalt
"Optimization" yesterday was buggy. bug:2674511 Change-Id: I3b1dde35a75b2017117c20905fcd82de405d41b5
2010-05-10Fix build. Instantiate object before use.Robert Greenwalt
bug:2673562 Change-Id: I1e39f7847c25c5c1923a7b7e864b402c94834528
2010-05-10Reduce lock contentionRobert Greenwalt
Reduce the amount of work done inside of synchronized blocks and force the use of cached ntp data when publicly called. bug:2662331 Change-Id: Ibafd29ea9e355fa8f875d06ce37870b0c01c57f4
2010-05-06Fix ThrottleService wifi interactionRobert Greenwalt
When we switch to another network (or even just lose mobile data) the mobile interface is either brought down or destroyed altogether. That means any throttling rules we've told the kernel about get lost. This change notices when our interface comes up and reinstates throttling if needed. bug:2660287 Change-Id: I4c6ebf78acc59ed66b95984a1e8b7c2ffbc22dcb
2010-04-26Fix Throttle reset.Robert Greenwalt
The start and end times were precisely the same so, a ">" check needed to be ">=". Also removed useless code and removed the potential problem where continuous gradual advancement of your start and end times would prevent resets. bug:2629717 Change-Id: Ieced1965a5611a9b555e92bcf924ec350f2a80db
2010-04-23Handle throttling being disabled via policy changeRobert Greenwalt
bug:2622543 Change-Id: Ic0c169094cdb4f80af9cfcbed116f59fda46a421
2010-04-23Respond to changes in throttle policy.Robert Greenwalt
We were updating limits and such before, but we were not applying them to the current situation if we were already throttled. Now it can result in us throttling or changing our throttle rate or unthrottling or even making the ui come or go (disabling/enable throttling) bug:2622543 bug:2619879 Change-Id: I64a62634d54f4768ab8625f8d72f9f66a239cb19
2010-04-22Add a Throttle check shortly after boot.Robert Greenwalt
Throttle is useless when ntp and imsi are not yet ready. In the real world the second check won't happen for 10 minutes letting people do what they want for 10 minutes each boot. Trim this down with a quicker first check. bug:2614247 Change-Id: I84ec33f31e8fed37b3933482fbc187b8e9e94e79
2010-04-22Trim throttle logs.Robert Greenwalt
Removing unwanted sntp logging and throttle logging. bug:2614927 Change-Id: Ic0b1c3502ebbc1f04130d09d715591af6513f439
2010-04-19Misc fixes for throttling.Robert Greenwalt
Cleanup of duplicate code Caching Ntp data so we don't hit the network as often Clearing out of MRU data when we switch to a new sim Sending notification after we reset byte counts bug:2605277 bug:2605272 bug:2597530 bug:2576057 Change-Id: I3df526bae6374f6ae56fed67b0defad2b4fabefd
2010-04-18Make ThrottleService more tamper resistant.Robert Greenwalt
Use elapsed time not wall time for alarms so users can't play with the system time to get around things. Also using NTP servers to pull in an authoritative time - if we the build is configured with an NTP server we will not advance to the next cycle without it, but we also will not trottle - rather not throttle users on an error. Note that the poll alarm is just relative to the last poll time and real time doesn't matter. Defining the time-fetching API's as returning time in the system wallclock range (correcting if we are using NTP time internally). bug:2597530 Change-Id: I1c0ac0923314c2f8a04edd0b36c4845352eae99a
2010-04-16Dont check on interface value on APIIrfan Sheriff
The interface check in API could be used in future. Bug: 2576057 Change-Id: Icfb78a88be44d1e6a8350c4b65efe70970e658d8
2010-04-15Add multi-sim support to ThrottleService.Robert Greenwalt
Uses the last used data until the SIM is available (if ever). Supports data from several SIMs for all the world travelers out there. bug: 2576057 Change-Id: I70e34a51f1c2ccda41a480652b0233b68ff3f538
2010-04-14Sholes mobile iface comes/goes - handle the resetRobert Greenwalt
The byte counter for the iface goes to zero when it comes back. Catch that and do the complex math to correct. Also add a log entry telling us our desired throttle index. Lastly, reset the sec/msec part of our reset time so that one calc will == another and not be off by little bits. bug:25494925 Change-Id: I99525b72a76316a8e601ceb457ca202fae040bae
2010-04-14Update the datause icons.Robert Greenwalt
bug:2576057 Change-Id: Idf57d59aecb9bcff635dafa1e77d90a8737a0c08
2010-04-13Perist Throttle data across rebootsRobert Greenwalt
Never got SharedPreferences working for this system service. Didn't really need it anyway. Using a straight up file now. bug:2576057 Change-Id: Idad926e8242a85e22718c25f3f6c03e5749badac
2010-04-13Add build config values for data use defaultsRobert Greenwalt
Don't use hard coded defaults - use build configs instead. Iface is now ONLY set by config so gservices doesn't need to. bug:2576057 Change-Id: I8f9e3bc51af3b1cdf8bb4290a43197d9c01e2a14
2010-04-12Fix Throttle Notification intentsRobert Greenwalt
Now goes to the correct settings page. bug:2576057 Change-Id: I21df0e53f7f56ae9bf71f983a3aed200c5ac217d
2010-04-09Add warning magic to be a bit more reasonable.Robert Greenwalt
Currently warns if you exceed more than 25% and 2*100%*timeUsed/(timeUsed+totalTime) The formula means that imagining you've got half of the remaining time that you really have, we will warn you if you would exceed the quota given your rate so far. It's generous during the early to mid-life and converges back to the limit as your timeUsed approaches totalTime. bug:2576057 Change-Id: Id189de5b026f927ef478fd212d61d9e4ab5239e6
2010-04-09Make ThrottleService notice policy changes.Robert Greenwalt
Added ContentObserver to watch relevant Secure Settings. Also added new policy-change broadcast to let settings know. Lastly reorged things a bit so that all of our broadcasts are sent at boot so the sticky ones are populated. bug:2576057 Change-Id: Ie11ffb057de9c801a5088612cd464ea062f3a666
2010-04-08Roaming data doesn't count against limitsRobert Greenwalt
bug:2576057 Change-Id: I51a66e3b49a62e0186816ec0473814a216184e6b
2010-04-08Throttling framework addinsIrfan Sheriff
Add ThrottleManager in getSystemService Add API for URL fetch Bug: 2576057 Change-Id: Icd25c8b91ea4beea15c74e8ad7292ab48c962253
2010-04-08Updating some notificiation UI for ThrottlingRobert Greenwalt
String update and make one an ongoing notification. bug:2576057 Change-Id: I7980f110c7eed8e8bf305490eddaa58e2949e3be
2010-04-08Add service to monitor/control the flow of data.Robert Greenwalt
bug:2576057 Change-Id: Ib343c7ee1d619c6978910d9ee597db195d5aa3b6