• Home
  • History
  • Annotate
  • only in /frameworks/base/services/tests/servicestests/src/com/
History log of /frameworks/base/services/tests/servicestests/src/com/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3256601f5e4d94713f59e97b9d4912875c1bdcaf 03-Dec-2014 Jeff Sharkey <jsharkey@android.com> Offer to "merge" subscribers for data usage.

There are some cases where multiple subscriber identities (IMSI)
should be treated as "merged together" from a data usage
perspective. This is done by extending the template used for
matching purposes to support multiple subscribers.

Then, when we query historical usage or set network policies, we
normalize the matching template to merge to any other identities
that should be included. When normalizing, the "lowest" identity
is always used for equality and storage purposes, which allows
identities to come and go over time.

This change also fixes data usage recording for multi-SIM devices
by passing along the concrete subscriber identity for each network
interface. Also correctly create default policies for multi-SIM
devices. This change also drops setPolicyDataEnable() until it can
be wired up to the right underlying NetworkAgent. (This means we
still bring up the network, and then rely on iptables rules to block
traffic when over the limit, instead of proactively disabling the

Bug: 18012787
Change-Id: If6acf32009fdfea2b836f5aff8e2f3e5e0248b4a
21b5ee3f0e39be4a79bcfb2b79b0529f75f5cb58 13-Nov-2014 Sreeram Ramachandran <sreeram@google.com> Eliminate race conditions in UID-based network filtering.

The previous code retrieved information from the legacy tracker multiple
times for each user query, leading to race conditions where the info
could've changed between the calls.

Refactors the handling of legacy data types in ConnectivityService and
unifies call paths so that APIs that deal with legacy data types
(NetworkInfo and int/networkType) and newer types (such as Network) go
through common code paths, using NetworkState to hold all the necessary
data pieces. This enables follow-on bug fixes to getActiveNetworkInfo().

The changes are limited to public "query" APIs (those that retrieve some
network information or the other). More details about the specific
changes and their rationale can be found in the code review thread.

Bug: 17460017
Change-Id: I656ee7eddf2b8cace5627036452bb5748043406c
e542499a304f067372d85722e11a74b4e56b0bd7 07-Nov-2014 Adrian Roos <roosa@google.com> Add LockSettingsStorage tests

Bug: 18163444
Change-Id: I563276e6d445d43d05bf0d3c633440a8e0109b69
d634d39c605553e669a16fd8fd406aa4695f54af 27-Oct-2014 Jeff Sharkey <jsharkey@android.com> Merge "Follow API removal." into lmp-mr1-dev
cff1d673394f8ef8c92bb69fea18cef4f7d07959 27-Oct-2014 Jeff Sharkey <jsharkey@android.com> Follow API removal.

Bug: 18118003
Change-Id: Iad73ce748e05ba0660246e8dbb041415c187f792
036ebd782ca60c87360df354acf85854d428de12 27-Oct-2014 Jeff Sharkey <jsharkey@android.com> Follow ArraySet refactoring.

Bug: 18115729
Change-Id: I2c32965b621b5bb57ff3bde02b00b31b59a5cd6d
48a30db75dd0eedf8e065c89825b2af86a381b62 23-Sep-2014 Matthew Williams <mjwilliams@google.com> Fix lock ordering in JobScheduler

BUG: 17625667
Two part clean-up.
1) Don't try to lock in onControllerStateChanged. Do it in the handleMessage
instead where the rest of the locking is. This is sufficient to fix this bug.
2) The other side of the deadlock came b/c we lock when cancelling and calling
stopTrackingJob. Controllers handle their own locking so this isn't
necessary. B/c of a potential race from the controller side, added an explicit
check for the JSS to only run an expired job if it still exists.

Change-Id: Iaeebbc19437eb5b73e3ced3168f1fc13e564a4be
0e8d7d63ba439cc0604af7055679dae3d30fdc48 03-Sep-2014 Amith Yamasani <yamasani@google.com> Add some @SystemApi tags for internal user-related APIs

Also added an internal isManagedProfile()

Bug: 17371392
Change-Id: Ibcc26771d954505cbd530192bf4a8a25a8d4cae0
d1c06753d045ad10e00e7aba53ee2adba0712ccc 22-Aug-2014 Matthew Williams <mjwilliams@google.com> Implement API review feedback for JobScheduler

BUG: 17005336

Took the opportunity to clean up some back-off logic

Change-Id: Ibc8ae34d1d44dd064ba071e4cbad17872f7e38cf
235510e67210f90de30c2d5582a2077ccc589619 13-Aug-2014 Jose Lima <joselima@google.com> Made AlarmClockInfo a nested class in AlarmManager

Bug: 16959028
Change-Id: I150eaaff765d1e214c3621c1bf50162ec0dac8ec
95ab7849444125387dc88088bb5197ee463d8c17 12-Aug-2014 Amith Yamasani <yamasani@google.com> Decouple user limit from guest creation

Allow Guest to be created even if there are N users.
Allow N users to be created even if there are N-1 users
and a Guest.
Limit number of guests and managed profiles that can
be added.

Added unit tests.

Bug: 15934700
Change-Id: I1a8f0fa38a91d71ef7b2980e05c974244dfc337a
6831f1d80f9a5ad2400bd186fb6179e0e511be05 27-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Remove dead code 2.

Removing ConnectivityService.NetworkFactory. This requires disabling
the ConnectivityServiceTest, but that's been broken since we stopped
using NetworkStateTrackers anyway.

Change-Id: I9b86bd37eb9d018c40f60dca5b00d62c36d4e3ad
01ac45b6ff2334925c8d24b5278b44e5e30f5622 23-Jul-2014 Matthew Williams <mjwilliams@google.com> Fix JobScheduler race condition

The loading of jobs from disk is now done sychronously.

Bug: 16372824
Change-Id: Ica0592d6de51e89662c9e49ed1eb59209b64356c
1031c974855ff4117a6d7866e664295786840319 23-Jul-2014 Chris Wren <cwren@android.com> Honor the sort and group keys for notification ranking.

Sort notifications naturally, then move group childen to be next their proxy.
The group proxy is the summary, or if no summary exists, the lowest-ranked
member of the group is chosen as the proxy.

Notifications with a sortKey but no group and placed into a synthetic
group that consists of all notifications from that package and user in
the same priority bucket that also have sortKeys.

Expose a new API for listeners to get the group key for the notificaiton.

Bug: 15190903
Change-Id: I324ba0c394affdabb3588ca2ebafa7cf0acad2af
cf7ed583080b6c958f5a02817110505bae2a17df 23-Jul-2014 Chris Wren <cwren@android.com> Revert "Honor the sort and group keys for notification ranking."

This reverts commit df09d4c348f9f2aea10391b27d157d8b71a9e189.

Change-Id: Idbc9ed5c5c83cd0cad5a71872bcc203321a11e9e
4a24fd3c7bab53e4e9c127214e7168db0af8800a 17-Jul-2014 Chris Wren <cwren@android.com> Honor the sort and group keys for notification ranking.

Sort notifications naturally, then move group childen to be next their proxy.
The group proxy is the summary, or if no summary exists, the lowest-ranked
member of the group is chosen as the proxy.

Notifications with a sortKey but no group and placed into a synthetic
group that consists of all notifications from that package and user in
the same priority bucket that also have sortKeys.

Bug: 15190903
Change-Id: I377ed65b9592079446da4a4189f5ab49d28630ec
03666c705ddabe0e7c5869ab69c2ca8b964164e9 20-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Cleanup: Delete dead code.

Bug: 15413389
Change-Id: I315468832ef18ffc84174e54774ab63b86d284dc
900c67fc51fc2672458dd1c9641250f2ecc01a31 09-Jul-2014 Matthew Williams <mjwilliams@google.com> Add job persistance as a setter in the API

Bug: 15936795
Change-Id: I11e5a722bab5838dc151670256ed09dfaa7fdaa7
c42a1e1071937ae48b7aa5d6291a32c29078b74b 07-Jul-2014 Adrian Roos <roosa@google.com> Add AlarmClock API to AlarmManager

Adds a new kind of alarm that represents an alarm clock and
a way to query the next scheduled alarm clock.

Deprecates Settings.System.NEXT_ALARM_FORMATTED.

Bug: 14589952
Change-Id: I297eeeff36d07adcda010afac183d0f5ee37dc99
43c4f41adb330522c6784177bf8e9a1239c6a15f 11-Jun-2014 Matthew Williams <mjwilliams@google.com> am 8e8c1401: Fix build.

* commit '8e8c140114cb3a4f1cf448c4492c13769738ca12':
Fix build.
0188bee2c526270c178a0b1f918b2a09999de25f 11-Jun-2014 Christopher Tate <ctate@google.com> am d8f71d34: Merge "Out with the old; in with the new" into lmp-preview-dev

* commit 'd8f71d34c3c7fb161a1586de8edb52161c32d672':
Out with the old; in with the new
46919f358390ad40e19259d12ef04b6898b9e4a4 11-Jun-2014 Matthew Williams <mjwilliams@google.com> Fix build.

Two tests were breaking the build.

Change-Id: If424a552d3fedb912fa94870b88c60dc3750b69a
7060b04f6d92351b67222e636ab378a0273bf3e7 10-Jun-2014 Christopher Tate <ctate@google.com> Out with the old; in with the new

Switch to the official "JobScheduler" etc naming.

Bug 14997851

Change-Id: I73a61aaa9af0740c114d08188bd97c52f3ac86b7
f53c295ae3ccabf1cf5a31c03f64233526e683eb 10-Jun-2014 Matthew Williams <mjwilliams@google.com> am 3b471117: Merge "Add OnNetworkActive to TaskManager and simplify locking." into lmp-preview-dev

* commit '3b4711176e77640d697e94137e65fa93c8363f5c':
Add OnNetworkActive to TaskManager and simplify locking.
effacfa75bd9c2ebc889a7bc4f002c07f82f4c31 06-Jun-2014 Matthew Williams <mjwilliams@google.com> Add OnNetworkActive to TaskManager and simplify locking.

Bug: 14993295
Hooks up a ConnectivityManager.NetworkActiveListener.
Previously was using 3 locks where 1 would suffice,
negligible to no performance issues b/c most of the previous locks
were nested.

Added OnNetworkActiveListener so that the ConnectivityController can kick of
tasks when it knows that the network is active.

Fixed some bugs that stopped timecontroller from executing tasks.

Requesting a retry will not add a deadline to that task. However backed-off
tasks are run as soon as they are ready, subject to their constraints.

Added receiver to listen for package removal and user removal, which will
delete any outstanding jobs for that uid.

Change-Id: I4c4523af558b927f19b8a215878fcc7198abb93f
38b200fe6c1aba63b57b315f4274d337545f0c89 05-Jun-2014 Matthew Williams <mjwilliams@google.com> am 1a2f47d4: Merge "Add persistence of tasks for TaskManager & BatteryController" into lmp-preview-dev

* commit '1a2f47d4cdc0ea40dff1b88f7976d64c19d687b1':
Add persistence of tasks for TaskManager & BatteryController
3d86fd2bb9db6067c49634bc4c6cdb4d5235ad36 17-May-2014 Matthew Williams <mjwilliams@google.com> Add persistence of tasks for TaskManager & BatteryController

Tasks are persisted only if the client has the RECEIVE_BOOT_COMPLETED
permission. This applies to both periodic and one-off tasks.
Write out task as xml, using PersistableBundle for the extras data.
Todo: Add persistable bundle to xml when ag/468207 is merged.

Also added BatteryController logic.

Change-Id: I23eeeb8b3bc6ba155e7fa4ec25857a68ee8b1567
5b5aa4072fb58aea47f523c724878c579adae294 02-Jun-2014 Amith Yamasani <yamasani@google.com> Handle saving and restoring ints in application restrictions

Unit tests for restrictions types and proper escaping.

Change-Id: Iac35521faf5798398a89fecbad82fcdd256a4146
92af372fc60f59c628a7169d4a506e9c834c097a 27-May-2014 Chris Wren <cwren@android.com> add tests for ValidateNotificationPeople.getExtraPeople()

Change-Id: Ieb8acce58574c25cccce674b4494f75d96b57125
4ddebf7f5b85d082c56f6a8aad11bd0c5ca68fde 16-Apr-2014 Sreeram Ramachandran <sreeram@google.com> Fix build.

Change-Id: I5dab09d2d8a9cff56fa17bb4e8c14b365449399b
a7b9796345335e4906d98432a1d194fa242cd23e 15-Apr-2014 Paul Jensen <pauljensen@google.com> Get ConnectivityServiceTest building again after 8f80cc8.

Change-Id: I4520011ba2076d8fac1ca234cb9a79c774992671
629f76682729a63c0e3d29f836c3c69c6fdb4c77 11-Apr-2014 Narayan Kamath <narayan@google.com> am 80edaa67: am 24c089a8: Fix build.

* commit '80edaa676bd59409f8a82e12c035bee96e653004':
Fix build.
24c089a8b5871b331441d0858aa164364b7737cb 11-Apr-2014 Narayan Kamath <narayan@google.com> Fix build.

isScreenOn was changed to isInteractive.

Change-Id: I381d0b0ca745b61e64ac6309c2a6307696f52be0
c798e4f5497c39a3c6c14b120cffdee1122a9212 25-Mar-2014 Matthew Williams <mjwilliams@google.com> am 4701b51a: am bb87ac7f: DO NOT MERGE: Downgrade expedited to normal on reschedule.

* commit '4701b51af216ce2b6fa9fa508ebba47bf13063c7':
DO NOT MERGE: Downgrade expedited to normal on reschedule.
bb87ac7f9733ca9b490cb34e8a675dba083a57b7 24-Mar-2014 Matthew Williams <mjwilliams@google.com> DO NOT MERGE: Downgrade expedited to normal on reschedule.

bug: 12033540
Expedited was previously tracked by a redundant internal variable, ostensibly
as an optimisation. This variable could differ from the value in the bundle
depending on how the operation is initialised, which led to confusion. Now an
expedited sync will only be treated as such on its first execution.

Change-Id: Ibfc4e9e49b86c82f2364a6ef55f887705a053eb6
cde7086b900fd192a8e389f62ab5007d351d86b8 21-Mar-2014 Matthew Williams <mjwilliams@google.com> Merge "Downgrade expedited to normal on reschedule."
a3f828ba3079408543091a4ccd6c11896ec4e0c7 19-Mar-2014 Ashish Sharma <ashishsharma@google.com> Update the tests to deal with the new timestamps in idletimer module.

Change-Id: I1a8368d84ef806f1501b0a1f5e817388a1d10518
8a985d24ce9a38f40ed88fecbdcd0e75e3a68f44 25-Feb-2014 John Spurlock <jspurlock@google.com> Tabs -> spaces in frameworks/base.

Change-Id: I5a84e8e93ac99b5ed0212b37bf66efa5e53864be
d63b4314b85e982a1d70d4064af59851f476dd36 13-Feb-2014 David Christie <dnchrist@google.com> Merge "Log history of location requests in LocationManager. -Assists with debugging power issues. Bug: 12824233"
6428046767ee4195617fb41b5639eefa2ca7a939 09-Jan-2014 Matthew Williams <mjwilliams@google.com> Downgrade expedited to normal on reschedule.

bug: 12033540
Expedited was previously tracked by a redundant internal variable, ostensibly
as an optimisation. This variable could differ from the value in the bundle
depending on how the operation is initialised, which led to confusion. Now an
expedited sync will only be treated as such on its first execution.

Change-Id: I9979102317aecbe8bc53a36381d4b2782ac131be

776c555d954d9494069f786785877c08add27327 09-Jan-2014 Adam Connors <adamconnors@google.com> Extend DeviceOwner concept to accommodate ProfileOwners

ProfileOwners, like DeviceOwners, are Device Admins that have
additional priviledges. ProfileOwners however are scoped per

Change-Id: I1e22c85878e0672121e6ebbe97fca38591f992b2
2ff96af24de2c22a21de9b56ea8543dccdbdcb9d 31-Jan-2014 David Christie <dnchrist@google.com> Log history of location requests in LocationManager.
-Assists with debugging power issues.
Bug: 12824233

Change-Id: Iaaef0dbe00154c7668034a166587671b75d1f3c7
4598ea4e5e6b2accce5165a76f5e2d04ce46c74c 09-Dec-2013 Lorenzo Colitti <lorenzo@google.com> am 263c4788: am 30253d7a: am 2daa0c93: Merge "Add address flags and scope to LinkAddress."

* commit '263c4788dcf45f104f8668fd6621d1a7c39689b9':
Add address flags and scope to LinkAddress.
64483947fdb03bf838e317ac0a4af5e0f53a5bbf 15-Nov-2013 Lorenzo Colitti <lorenzo@google.com> Add address flags and scope to LinkAddress.

This is necessary so that the framework can know whether an IPv6
address is likely to be usable (i.e., if it's global scope and
preferred). Also, it will simplify the address notification
methods in INetworkManagementEventObserver, which currently take
the address, the flags, and the scope as separate arguments.

1. Add flags and scope to the class and update the unit test.
Use the IFA_F_* and RT_SCOPE_* constants defined by libcore.
Since most callers don't know about flags and scope, provide
constructors that default the flags to zero and determine the
scope from the address. Addresses notified by the kernel will
have these properly set. Make multicast addresses invalid.
Update the class documentation.
2. Provide an isSameAddressAs() method that compares only the
address and prefix information between two LinkAddress
objects. This is necessary because an interface can't have
two addresses with the same address/prefix but different
3. Update LinkProperties's addLinkAddress and removeLinkAddress
to identify existing addresses to add/remove using
isSameAddressAs instead of implicit equals(). Specifically:
- If addLinkAddress is called with an address that is already
present, the existing address's flags and scope are updated.
This allows, for example, an address on an interface to go
from preferred to deprecated when it expires, without it
having to be removed and re-added.
- If removeLinkAddress is called with an address that is
present but with different flags, it deletes that address
instead of failing to find a match.
4. Update the INetworkManagementEventObserver address
notification methods to take just a LinkAddress instead of
LinkAddress, flags, and scope. While I'm at it, change the
order of the arguments for consistency with the other
functions in the interface.

Change-Id: Id8fe0f09a7e8f6bee1ea3b52102178b689a9336e
317d15c15531b353aa3e8cb1a3ba03d98b71efb6 02-Dec-2013 Lorenzo Colitti <lorenzo@google.com> am 4806fdfb: am f226bc60: Merge "Use LinkAddress in address notifications."

* commit '4806fdfbd0fecf91584396fc0f620c97a05ab837':
Use LinkAddress in address notifications.
5ad421a3d00c92c155d57af9d1a05d81cc2fa88f 17-Nov-2013 Lorenzo Colitti <lorenzo@google.com> Use LinkAddress in address notifications.

Currently address{Updated,Removed} pass in the address as a
string such as "fe80::1/64". Use LinkAddresses instead, since
that's what it is.

This makes the code more robust in the unlikely case that netd
passes in an invalid string. In the future we can move flags and
scope into the LinkAddress itself and simplify the code further.

Bug: 9180552
Change-Id: I66599f9529cf421caa7676fdd0141bb110b8589e
5ae4a531cc31be2868f65c40e8636658f1ae2f06 31-Oct-2013 Lorenzo Colitti <lorenzo@google.com> Pass DNS server info notifications to observers.

These are sent if the device receives IPv6 Router Advertisements
with DNS server configuration options. Currently, nothing listens
to them; in a future change we will use them as IPv6 DNS servers.

[Cherry-pick of 416740ad4d9132005a71dc0883334e852235a18a]

Bug: 9180552
Change-Id: I05000c0cd3867a68ab390102e8470b6912a9d3aa
a9626c1c956f51e7b4cb783d70b75abc3b180a00 04-Nov-2013 Lorenzo Colitti <lorenzo@google.com> Minor cleanups to NetdCallbackReceiver.onEvent.

- Clean up identical error messages.
- Fix the array length check for InterfaceAddressChange.

[Cherry-pick of 59be800e7fe81842aa8c77b91319f58ab165983d]

Bug: 9180552
Change-Id: Id871f481445b530c3ad749725f1548df0e3a1228
416740ad4d9132005a71dc0883334e852235a18a 31-Oct-2013 Lorenzo Colitti <lorenzo@google.com> Pass DNS server info notifications to observers.

These are sent if the device receives IPv6 Router Advertisements
with DNS server configuration options. Currently, nothing listens
to them; in a future change we will use them as IPv6 DNS servers.

Bug: 9180552
Change-Id: I05000c0cd3867a68ab390102e8470b6912a9d3aa
59be800e7fe81842aa8c77b91319f58ab165983d 04-Nov-2013 Lorenzo Colitti <lorenzo@google.com> Minor cleanups to NetdCallbackReceiver.onEvent.

- Clean up identical error messages.
- Fix the array length check for InterfaceAddressChange.

Bug: 9180552
Change-Id: Id871f481445b530c3ad749725f1548df0e3a1228
d08d6686c5e16cedc23cd9bc836a28d629b8622c 14-Oct-2013 Matthew Williams <mjwilliams@google.com> resolved conflicts for merge of 94b51810 to master

Change-Id: Ida818f066b66c356a84c80e5eab0a4e2cf4ebd49
94b518101c2b2587cb60664dde8931b11f154ec0 11-Oct-2013 Matthew Williams <mjwilliams@google.com> am e0a2bdaf: am 32551ae5: Merge "Fix infinite boot-loop bug in SM." into klp-dev

* commit 'e0a2bdaf61a7a72e92d614f81f86e7fd441b38e4':
Fix infinite boot-loop bug in SM.
632515b9d0960749ddb1636677d7f12f196d73f7 11-Oct-2013 Matthew Williams <mjwilliams@google.com> Fix infinite boot-loop bug in SM.

If the ContentResolver sync API is used with the empty ("")
string as a provider, the ContentService will throw an RTE.
This cl addresses all the entry points of the API that could
allow this, as well as adds an ifEmpty check at the point of
Also removed RTE throws from public functions(no point in
crashing the phone).

Change-Id: I57427d12a6cafb3e6d7a32ca0c10b05315b20580
87e385effb106d1764abaf1c7d77ff3751b922dc 04-Oct-2013 Alex Klyubin <klyubin@google.com> am aa947f15: am a9bce468: am 84742149: Merge "Make EntropyMixer mix in output of Hardware RNG into Linux RNG."

* commit 'aa947f15314a4239de91a1cd0bea085e3399d43e':
Make EntropyMixer mix in output of Hardware RNG into Linux RNG.
aa947f15314a4239de91a1cd0bea085e3399d43e 04-Oct-2013 Alex Klyubin <klyubin@google.com> am a9bce468: am 84742149: Merge "Make EntropyMixer mix in output of Hardware RNG into Linux RNG."

* commit 'a9bce46876d6f1f82727ab6922748fcc6b43c767':
Make EntropyMixer mix in output of Hardware RNG into Linux RNG.
6ab3d20d3c2de01a342450d83103e9f5e89e670e 03-Oct-2013 Alex Klyubin <klyubin@google.com> Make EntropyMixer mix in output of Hardware RNG into Linux RNG.

On devices with Hardware RNG (HW RNG), this makes EntropyMixer
periodically (every three hours) read 512 bytes from HW RNG and mix
them into the Linux RNG.

This is done without increasing Linux RNG's entropy estimates to
avoid having to trust the quality of the HW RNG. This approach cannot
reduce the quality of the Linux RNG output, but may increase it.

Change-Id: Ifde851004301ffd41b2189151a64a0c5989c630f
06485a7c6e3bbea1f427f345ac3a18b2346750e0 26-Jul-2013 Matthew Williams <mjwilliams@google.com> Pending op fix didn't merge properly from KLP-dev.

Manually merge in Cl c/342668. Add another test to ensure that it

Change-Id: Iae603328d525cc71e4e31ad30a13384efc50f823
86f4b37d196bb9a72a22f706f89f3066ab2bf287 16-Sep-2013 Matthew Williams <mjwilliams@google.com> Merge "Refactor SyncManager rename authority->target"
8ef2204c8f5f9744a2ff7abdbbf2d26a5ea02837 26-Jul-2013 Matthew Williams <mjwilliams@google.com> Refactor SyncManager rename authority->target

fix bug that was stopping any sync service sync from
from taking place.
Change-Id: Ib3f46d43be630d4196fbf0ca32da03b6e7a6a5b9
123eeea6d62a80fb9660ad623fd378d2f2f0c904 12-Sep-2013 Jeff Sharkey <jsharkey@android.com> am e2d76fa8: am cecccecc: Merge changes Ib1274847,I2eb2a1bf into klp-dev

* commit 'e2d76fa8c6d0f5c3d1a73a3ec9756c4bc545806d':
Fix SDK build.
Request all tethering interfaces, fix corruption.
e4984bea95a07dea0ef0259fefa1e52f0bbb1533 11-Sep-2013 Jeff Sharkey <jsharkey@android.com> Request all tethering interfaces, fix corruption.

netd now tracks statistics for tethered interfaces across tethering
sessions, so switch to asking for all tethering stats. (Currently
we're double-counting all tethering data, ever since it started
tracking across sessions.)

Also catch OOME to handle corrupt stats files, which we then dump to
DropBox and then start over.

Bug: 5868832, 9796109
Change-Id: I2eb2a1bf01b993dd198597d770fe0e022466c6b9
56dbf8f23677d28615e61ef2fbb0e738cca02528 26-Jul-2013 Matthew Williams <mjwilliams@google.com> Fix broken javadocs

Change-Id: Ibf7f2ed92919efd36fffa963447b1a443c0bb9db
7421a01f18f34d554ca7a9fd987c4f96da2bdf2f 20-Aug-2013 Lorenzo Colitti <lorenzo@google.com> Add a simple test for NetworkManagementService.

For now, this only tests network observers. It works by starting
NetworkManagementService with a fake netd socket, feeding it
inputs, and seeing if the appropriate observer methods are

Bug: 10232006
Change-Id: I827681575642a4ee13ae48b81272521544b676bd
ba35271e91648c9cde2bb606aaf2001282231b07 14-Aug-2013 Matthew Williams <mjwilliams@google.com> Use pending.xml to persist sync ops.

Support pending ops by producing badly formed xml.
fixed bug that stopped alarm manager from updating if the
next alarm time is in the past.
Use new AlarmManager API for old AM behaviour - to set
exact alarms.

Change-Id: I57090f9c7155996298be7ec968a88f17ac1938a7
ba530545f70e7aadad774987681091f9abbecb79 06-Aug-2013 David Christie <dnchrist@google.com> Revert "Fix broken unit test"

This reverts commit 0ca981fe42c43a4b7c345f4a0a2b3b2a519be5da.

Change-Id: I67f5e7227a8a874158c4f0954e62a77a317f1edd
0ca981fe42c43a4b7c345f4a0a2b3b2a519be5da 02-Aug-2013 David Christie <dnchrist@google.com> Fix broken unit test

Change-Id: I4aa0035233749f6d585c151329436439ae9b2921
df2cab2fc46c3f2c56f85dee1a19d0fa48cfd444 02-Aug-2013 David Christie <dnchrist@google.com> Fix build breakage

Change-Id: Ia684fb55db301fdadaa3aae93f82b2cdcfc200af
ebe51fc0d860077245c44bfb00130be62da001e1 26-Jul-2013 David Christie <dnchrist@google.com> Add WorkSource capability to AlarmManager.

Change-Id: I663ea3078d405f0fa667a04bdaa376ae6652e994
fa77418134c6f1f80af225a78819f069e9c974fb 19-Jun-2013 Matthew Williams <mjwilliams@google.com> AnonymousSyncService & SyncRequest.

Changes to the way bundles are parcelled broke SM,
this update writes out the bundle as xml. This circumvents
the need for parcel, and makes it easier to debug whats
Change-Id: I6cd5d3a2eb80bfa5b3ae0c7f2d2ff91a65daaa34
bc668ac4b7c54278ed20d8329eb80e0b54892dc7 21-Jul-2013 Guang Zhu <guangzhu@google.com> fix build

Change-Id: Ie4bd7c3fe9320d22b7da2962e5e5a4abca510bd2
3e07a89b2c7fd8ac67a83b08b583682840f8fa5c 19-Jul-2013 Christopher Tate <ctate@google.com> Fix build & preserve DHCP scheduling as-is

Change-Id: I4063b18532c476280f343658bf3641495e526ed4
a8c7e3f86ab205a557c7b8cc1e8c6a61cec06f41 16-Jul-2013 Svetoslav <svetoslavganov@google.com> Fix the build - missed a renaming

Change-Id: I0e85723647c0e5a6f6374e119f0fbd43db477ee0
56cd646abeae51e806791f82ab0995fe047b1fe4 08-Jun-2013 Jeff Sharkey <jsharkey@android.com> Avoid logging sensitive data.

When building commands to send across NativeDaemonConnector, scrub
sensitive arguments to prevent them from being logged.

Bug: 8609800
Change-Id: I84b16791749264a010f7e59f9918f68d71bac6b9
31c0959b1a04f4e17d7528a6e4a9296701e3ade7 31-Mar-2013 Amith Yamasani <yamasani@google.com> Fix test

Change-Id: I329ceff03d3707e10c2e4eabfb8e6ea61082ae6d
9d034debdd7226ea33530143710fcb962144be22 29-Mar-2013 Geremy Condra <gcondra@google.com> am 24948d3c: am 946a5c91: Merge "Save off the seinfo value with packages.list."

* commit '24948d3ca7ff7fa70ee85e9aa7530239d7b482b2':
Save off the seinfo value with packages.list.
7039738f813f8e38e4857d439b7e46f3c877794d 28-Mar-2013 Dianne Hackborn <hackbod@google.com> Fix build.

Change-Id: I38a25dc63107fc907a520169e1b58f00e51dbb9d
05191053545065c9c71afae173d3ab42a2d947fa 26-Mar-2013 Amith Yamasani <yamasani@google.com> Match tests to new API.

Change-Id: I9a537a437c721ae64d9307b889b9de5d5429670f
4a4537331be12e7ac11066931c845ec9d8064571 26-Mar-2013 Robert Craig <rpcraig@tycho.ncsc.mil> Save off the seinfo value with packages.list.

Patch adds the seinfo label per package to the file.
This is of particular interest to the run-as program
which uses the seinfo tag to correctly label the
app security context before running the shell.

Change-Id: I9d7ea47c920b1bc09a19008345ed7fd0aa426e87
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
e16713597661c326d2bb6586a8b13e27520c4227 08-Mar-2013 Lorenzo Colitti <lorenzo@google.com> Always specify an interface for host routes.

Change-Id: I05b4d87e7d7e8237c6f4a70f1fedae00f416f581
79619ddbfe7367e11dd17d848b179877350b7b8e 04-Mar-2013 Nick Kralevich <nnk@google.com> EntropyMixer: Write entropy at shutdown / reboot / power

Write out entropy if we're shutting down or rebooting,
or if someone plugs in the power.

Bug: 8312061
Change-Id: Id9a48064a7bdfe6c05a9227ea95a1bdbd0e9b8ae
6794458f8626c3be27eac3db3a5c89d94f132675 22-Feb-2013 Maggie Benthall <mbenthall@google.com> Add location sharing toggle user restriction.

And add support for respecting it.

Change-Id: Ia5cf9134c5f5741c3f55afadbe54f862da7bfe5b
3671b1e910e4d297bebcd3ceaa2682bfb4b1f4a1 01-Feb-2013 Jeff Sharkey <jsharkey@android.com> Migrate to using Mockito directly.

Change-Id: I1fcc5d1a780f5831bd6685f0735d4c0c6d245735
20949a76fee62e89d7dc22858a74469efa14f61d 12-Feb-2013 Amith Yamasani <yamasani@google.com> Fix UserManager test

Change-Id: I927ffdda3dd5f69dc136e65c8069f2e480badfe9
e4cf73437a18c1444055f88a1fcc0d146ec23ac5 17-Dec-2012 Amith Yamasani <yamasani@google.com> Starting point for User Restrictions API

Restrictions saved as key/value pairs, mostly booleans right now
but might be expanded to other types later.

Save and restore restrictions in the user manager service.
Enforce some of the restrictions at the framework level. Some
are enforced (also) at the app level, such as in Settings.

Change-Id: Id11ffe129cb6a177e094edf79635727388c26f40
f265ea9d8307282ff1da3915978625a94fc2859e 01-Feb-2013 Dianne Hackborn <hackbod@google.com> App ops: vibration, neighboring cells, dialing, etc.

Improve handling of vibration op, so that apps are
better blamed (there is now a hidden vibrator API that
supplies the app to blame, and the system now uses this
when vibrating on behalf of an app).

Add operation for retrieving neighboring cell information.

Add a new op for calling a phone number. This required
plumbing information about the launching package name through
the activity manager, which required changing the internal
startActivity class, which required hitting a ton of code that
uses those internal APIs.

Change-Id: I3f8015634fdb296558f07fe654fb8d53e5c94d07
d4d9364019ed071509213b9ce772f4a5904d2847 30-Jan-2013 Dianne Hackborn <hackbod@google.com> Maybe fix build.

Change-Id: Ibad8edb15e7cc332d6c29958a386d32a96f4e755
56dc0e02fc0e519a86c5efefe0143001d2563d43 23-Jan-2013 Jeff Sharkey <jsharkey@android.com> Merge "Tests to assert correct January behavior."
1539905b4621f94b0a1a215407a71034da806247 15-Jan-2013 Jeff Sharkey <jsharkey@android.com> Tests to assert correct January behavior.

Change-Id: I162102b6f1b892b79e2f5b96cb0184abb85d00bc
ca6486e7f579fa885b6213513f26ce2ca49f873b 15-Jan-2013 Sasha Levitskiy <sanek@google.com> Removed Throttle Manager as obsolete

Change-Id: I63e8514f34c880d0badaab33a347f54a80c84da6
03cb98aecfeef0b0894f69987f8b4a15c02501f3 11-Dec-2012 Amith Yamasani <yamasani@google.com> Move Observer test to servicetests

Change-Id: Ib3493af4eb3185db79004a3cad5473161ed51f71
e03c17f1cb50a7869ef33406a2be275fdb040ea1 11-Dec-2012 Amith Yamasani <yamasani@google.com> Merge "Move one more test."
814a8d35ae11b70027e0e476ca1c0bb589106b4d 11-Dec-2012 Amith Yamasani <yamasani@google.com> Move one more test.

Change-Id: Iea0e0b5727746f2332db2ab1c1b216326eb50f13
8ff9a156c04c24458d94c716a64a5b7327f0e987 11-Dec-2012 Amith Yamasani <yamasani@google.com> Fix build. Forgot to move this test.

Change-Id: I06aab8ec6e2dac86b65bbeed3587444260fec2e8
7a96c39c510923ef73bbb06ab20109f0168b8eb1 15-Nov-2012 Jeff Sharkey <jsharkey@android.com> Move lingering services to services.jar.

This helps reduce the pressure on framework.jar, and makes it clear
that it should only be used by the system_server.

Bug: 7333397
Change-Id: I0858904239535380fbf30562b793e277d8c3f054
b2e18e91ec1f9c521b69e44761db2805e3a61ba3 29-Nov-2012 Dianne Hackborn <hackbod@google.com> am b443ddbb: am 2c41c4a2: Fix build.

* commit 'b443ddbbc7f1c7ed2d30310f80323cd4a5bf3e8d':
Fix build.
b443ddbbc7f1c7ed2d30310f80323cd4a5bf3e8d 29-Nov-2012 Dianne Hackborn <hackbod@google.com> am 2c41c4a2: Fix build.

* commit '2c41c4a2766dcce506fc0e9e361fc8198553293c':
Fix build.
2c41c4a2766dcce506fc0e9e361fc8198553293c 29-Nov-2012 Dianne Hackborn <hackbod@google.com> Fix build.

Change-Id: Icc1f2913b4e889609066b0ff1dddcd9be0230897
58ed5d748c0b9b64845975ef5844ad313de7c3f6 07-Nov-2012 Kenny Root <kroot@google.com> am 768d9e1a: Merge "Correct executable bit for source files"

* commit '768d9e1a72ceee7d4a5f608776b87b62d6ce4a04':
Correct executable bit for source files
3a084af2e90849aaa8beb3a610189e3399c63ea0 07-Nov-2012 Kenny Root <kroot@google.com> Correct executable bit for source files

Many media files and source code files were marked as executable in Git.
Remove those.

Also a shell script and python script were not marked as executable.

Change-Id: Ieb51bafb46c895a21d2e83696f5a901ba752b2c5
283d1409ddadd35cd41b5496659d3a24dc365fb0 21-Oct-2012 Amith Yamasani <yamasani@google.com> am f624d72c: am 8074e98b: Merge "Fix crashes when quickly adding and removing users" into jb-mr1-dev

* commit 'f624d72cb0fe40fd5748d4f0d1a93bf267aa3ed8':
Fix crashes when quickly adding and removing users
f624d72cb0fe40fd5748d4f0d1a93bf267aa3ed8 21-Oct-2012 Amith Yamasani <yamasani@google.com> am 8074e98b: Merge "Fix crashes when quickly adding and removing users" into jb-mr1-dev

* commit '8074e98b20ac04fdc032a1ed00dd6763b7e04147':
Fix crashes when quickly adding and removing users
db6a14cc85cede0769735fdac4da70766989a3ce 18-Oct-2012 Amith Yamasani <yamasani@google.com> Fix crashes when quickly adding and removing users

Make USER_REMOVED an ordered broadcast and send it before the user's
state is completely removed from the system. This gives services the
opportunity to clean up their state, while still having access to the
user's directory and UserInfo object (such as serial number).

Tell SyncManager to skip over dying/partially created users.

Improve UserManager tests, waiting for users to be removed fully.

Bug: 7382252

Change-Id: I93cfb39c9efe6f15087bf83c569a2d154ef27168
ae1af49a914cdbbd64ee069ad3f9913c7c6632f0 28-Sep-2012 Jeff Sharkey <jsharkey@android.com> am 3a8af8ef: Merge "Migrate more Secure settings to Global." into jb-mr1-dev

* commit '3a8af8efff93ca8ee80fc8c7841e7bee9a8b7786':
Migrate more Secure settings to Global.
625239a05401bbf18b04d9874cea3f82da7c29a1 27-Sep-2012 Jeff Sharkey <jsharkey@android.com> Migrate more Secure settings to Global.

Migrate networking, storage, battery, DropBox, and PackageManager
related Secure settings to Global table.

Bug: 7232014, 7231331, 7231198
Change-Id: I772c2a9586a2f708c9db95622477f235064b8f4d
031c410adc368a6242a834e23741afa09db69fa0 27-Sep-2012 Jeff Sharkey <jsharkey@android.com> am 68b7a6d1: Merge "First step towards cleaning up Global settings." into jb-mr1-dev

* commit '68b7a6d14b68b38324ffd275c7227805c7d99b2d':
First step towards cleaning up Global settings.
bdfce2ec05a3e9ca6acd6711de6133e06f2446e6 27-Sep-2012 Jeff Sharkey <jsharkey@android.com> First step towards cleaning up Global settings.

Remove all @Deprecated @hide settings, and clean up any stragglers.

Bug: 7232125
Change-Id: Ibf67093c728d4a28565129b923edb1701d3b2789
558f6d654f45ffc77db94fc660152704d4a6783f 26-Sep-2012 Jeff Sharkey <jsharkey@android.com> am 6e065a72: Merge "Handle multi-user mountObb() requests." into jb-mr1-dev

* commit '6e065a729dbf08f99209a7710da80442a394ec0d':
Handle multi-user mountObb() requests.
4fbbda4cecb078bd3867f416b02cc75f5455284f 25-Sep-2012 Jeff Sharkey <jsharkey@android.com> Handle multi-user mountObb() requests.

Since emulated external storage paths differ based on execution
context, carefully fix up paths for various use-cases:

1. When sending paths to DefaultContainerService, always scope
OBB paths as belonging to USER_OWNER.
2. When sending paths to vold, always build emulated storage paths
visible to root.
3. Always use the original untouched path when talking with apps.

Mount OBB containers using shared app GID, so that an app can read
the mount point across users.

Handle legacy paths like "/sdcard" by resolving the canonical path
before sending to MountService. Move tests to servicestests, and
add tests for new path generation logic.

Bug: 7212801
Change-Id: I078c52879cd08d9c8a52cc8c83ac7ced1e8035e7
31a2b8c7bfe0401a3b8c6250cf3ea43693362f92 22-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> am 0a5c5567: Merge "Multi-user support for the accessibility layer." into jb-mr1-dev

* commit '0a5c5567f2d7e203d95c80a8d3353d0acd98b5f9':
Multi-user support for the accessibility layer.
58d37b55bd228032355360ea3303e46a804e0516 18-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Multi-user support for the accessibility layer.

1. This change converts the accessibility manager service to
maintain a state per user. When the user changes the services
for the user that is going away are disconnected, the local
accessibility managers in the processes for this user are
disabled, the state is swapped with the new user's one, and
the new user state is refreshed.

This change updates all calls into the system to use their
user specific versions when applicable. For example, regisetring
content observers, package monitors, calls into other system
services, etc.

There are some components that are shared across users such
as UI created by the system process and the SystemUI package.
Such components are managed as a global state shared across
all users and are updated accordingly on a user switch. Since
the SystemUI is running in a normal app process this change
adds hidden APIs on the local window manager to allow the
SystemUI to notify the accessibility layer that it will run
accross users.

Calls to AccessibiltyManager's isEnabled(), isTouchExplorationEnabled()
and sendAccessibilityEvent return false or a are a nop for a
background user sice he should not send accessibility events,
and should not perform touch exploration.

Update the internal accessibility tests due to changes in the

This change also fixes several issues that were encountered
such as calling out the accessibility manager service with a
lock held.

Removed some incorrect debugging code from the TouchExplorer
that was leading to a system crash.


Change-Id: I2cf32ffdee1d827a8197ae4ce717dc0ff798b259
d44daaba447e42c0b75d4cf5d33cf0b6ea3076b5 18-Sep-2012 Andy Stadler <stadler@google.com> Move files to make eclipse-java happy

No changes to text at all, just moving the java files to match their
declared packages.

There was no original bug# but this cleans up the code submitted in
the original Change-Id: I42307f58074157b33b6e01216aab10022340d449

Change-Id: I233fa7f21167a42565aadb7ad109600b1a1a5721
8e53462d943231bcc993e94b57b32b8700b3e73f 16-Sep-2012 Jeff Sharkey <jsharkey@android.com> am d0c6ccba: Move NetworkPolicy from apps to UID.

* commit 'd0c6ccbafdebc73d03cf3cd47f02f9f6c78a69ff':
Move NetworkPolicy from apps to UID.
d0c6ccbafdebc73d03cf3cd47f02f9f6c78a69ff 15-Sep-2012 Jeff Sharkey <jsharkey@android.com> Move NetworkPolicy from apps to UID.

For multi-user devices, switch to storing policy per-user instead of
per-app. Also watch for user added/removed broadcasts to clean up
policies and apply global restrictions.

Bug: 7121279
Change-Id: Ia7326bd0ebe0586fa4ec6d3a62f6313dc8814007
b631084613e12e1c6a0ae2ad9446e1284b650ccb 24-Aug-2012 Geremy Condra <gcondra@google.com> DO NOT MERGE Add components for the Android Config Updater to system server.

This adds the necessary bits to verify and install configuration
updates using system server. It also includes the cert pinning
updater as the first user.

Change-Id: I42307f58074157b33b6e01216aab10022340d449
4120375d46091df8527bb701882e056fbb0e6b06 31-Aug-2012 Dianne Hackborn <hackbod@google.com> Remove Binder.getOrigCallingUid().

Replaced all remaining places that used it with explicit user

While doing this, I ran into stuff that was creating PendingIntent
objects (that now need to specify the explicit user they are for),
which are also posting notifications... but have no way to specify
the user for the notification.

So the notification manager in the system process now also gets a
formal concept of a user associated with the notification, which
is passed in to all the necessary aidl calls. I also removed the
old deprecated aidl interface for posting/cancelling notifications,
since we now always need a user supplied.

There is more work that needs to be done here, though. For example
I think we need to be able to specify USER_ALL for a notification that
should be shown to all users (such as low storage or low battery).
Along with that, the PendingIntent creation needs to be tweaked to
be able to handle USER_CURRENT by evaluating the user at the point the
pending intent is sent.

That's for another change, however.

Change-Id: I468e14dce8def0e13e0870571e7c31ed32b6310c
2a00329c6d55c6cd9166e01963d7410e95d80d21 15-Aug-2012 Amith Yamasani <yamasani@google.com> UserHandle to UserSerialNo mapping

Use AtomicFile for usermanager files.

Added a MANAGE_USERS permission that apps (signature permission) can use
to create/query/modify/remove users.

Change-Id: I5cf232232d0539e7508df8ec9b216e29c2351cd9
f02b60aa4f367516f40cf3d60fffae0c6fe3e1b8 16-Aug-2012 Dianne Hackborn <hackbod@google.com> Rename UserId to UserHandle.

This is the start of turning this into a formal public API.

Change-Id: I5786d2c320f1de41a06ed5d0f65adb68967287a0
258848d2ae04f447ff1c18023fa76b139fcc0862 11-Aug-2012 Amith Yamasani <yamasani@google.com> User Manager service to manage users and query user details

Moved a bunch of methods from PackageManager to UserManager.

Fix launching of activities from recents to correct user.

Guest creation APIs

Change-Id: I0733405e6eb2829675665e225c759d6baa2b708f
fb878b66b9456f8fee2bcb1076263852d207949d 27-Jul-2012 Jeff Sharkey <jsharkey@android.com> Isolate NetworkStateTracker creation, test.

Change ConnectivityService to use a factory when creating
NetworkStateTrackers, which gives us a good place to inject mocks
for testing. Add initial tests to verify that network routes are
added and removed as networks changed.

Change-Id: I11cbc61a84c2ed4afa2670036295b1494eab26e1
b8151ecd6ef4faa5c16d0a4c3abb45ec84d1f97a 19-Apr-2012 Amith Yamasani <yamasani@google.com> Add an icon to the user information.

Store the icon in the user folder under /data/system,
similar to how the wallpaper is stored.

Change-Id: Id8ccb55b9e2ba7b4c557505a7f69f04eca1518cf
70c70530bd6793869736ec894498e4ebf5dc9b20 16-May-2012 Jeff Sharkey <jsharkey@android.com> Transition from DEV network stats to XT.

When XT stats are available, transition to prefer them over DEV,
since they aren't subject to hardware driver bugs. Only switches at
the first atomic XT bucket, and adds a Settings.Secure flag to force
back to DEV if needed. Includes tests to cover transition.

Fix tests where device overlay would change which network types
reflected data usage. Test both history and summary APIs. Fixed
collection timestamps to reflect full buckets.

Bug: 6504744
Change-Id: Idd7f3b2fdb064c36547c85c51c214fd938c59b7e
3d33c268cc7f08ec3d2ec1aa535fa86dec458b2e 07-May-2012 Geremy Condra <gcondra@google.com> Adds support for the CertBlacklister.

The CertBlacklister is a mechanism for allowing is to use gservices
to blacklist certs by serial number or public key.

Change-Id: Ie4b0c966a8a43c9823fb550c0b1691204f133ae7
0cf6de0c930c9082b7bffdb9824e4a7c7832b6df 05-May-2012 Jeff Sharkey <jsharkey@android.com> Fix network stats and policy tests.

Bug: 6299195
Change-Id: I1941b5f7329940cc7469bd3fda17c3dc3a656250
ac3fcb1590e1da21324c13ce237ec48f2bf488bf 03-May-2012 Jeff Sharkey <jsharkey@android.com> Reduce persist threshold for lower warning/limit.

Default is 2MB persist threshold, but even that can be substantial
for devices on 100MB/month plans. This change gradually reduces the
persist threshold up to 8x lower (256kb outstanding) based on lowest
active policy.

Bug: 5382676
Change-Id: Ief4e8cdb169bfb151a3d1b45722a8eaa01926508
e8914c36276710de50b347c1e6aecfa45d6a56cd 02-May-2012 Jeff Sharkey <jsharkey@android.com> Begin collecting xtables iface counters.

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
bfdd680ab44da173a4a39fcd6feccdebb9d1f855 09-Apr-2012 Jeff Sharkey <jsharkey@android.com> Migrate to @Override to remove warnings.

Bug: 6303344
Change-Id: I0d33b2ed448467379d576ccd71fb5ae20c878852
b52e3e55098c4a6e3dbfe19885895411cfb38911 06-Apr-2012 Jeff Sharkey <jsharkey@android.com> INetworkStatsSession with lifecycle for caching.

Users outside system_server now explicitly communicate their
lifecycle, which keeps a strong-reference chain to any fully loaded
NetworkStatsCollection histories.

Bug: 6236498
Change-Id: I8e22739b6e89a626b676967a736d7117fd000778
8fc27e8b87bd1def854a03d84009143b315d4176 05-Apr-2012 Jeff Sharkey <jsharkey@android.com> Support metered Wi-Fi NetworkPolicy.

Add networkId field to NetworkIdentity to identify Wi-Fi networks by
SSID. Add support for policies without usage cycles.

Only apply mobile policies when SIM state is ready, which is cleaner
than just checking for airplane mode. Also avoids creating no-op
default policies when subscriberId is null.

Bug: 3001465, 3291052
Change-Id: I1f8aaa49a5db306df022c402ea7f3f5d4bc0cfc7
135936072b24b090fb63940aea41b408d855a4f3 23-Mar-2012 Amith Yamasani <yamasani@google.com> User management and switching

Broadcast intents that get sent out when users are added/removed/switched.

More work on generating user-specific information in package manager queries.
APIs to update user name and query a user by id.
Removed Package.mSetStopped and mSetEnabled, since they're not user specific.

User removal:
- Cleanup ActivityManager, PackageManager, WallpaperManager, AppWidgetService
and AccountManager.
- Shutdown processes belonging to the user.

Don't show vibrate option in long-press power if there's no vibrator.

Lock the screen when switching users, to force unlocking.

Change-Id: Ib23a721cb75285eef5fd6ba8c7272462764038fa
6143f31537991d2cd0f27e4d8f48f109fb10bc52 22-Mar-2012 Jeff Sharkey <jsharkey@android.com> Merge "NetworkPolicy multi-user tests."
cae04a29da1334aa160ac44f7430411c23cebd1b 22-Mar-2012 Jeff Sharkey <jsharkey@android.com> NetworkPolicy multi-user tests.

Bug: 6214004
Change-Id: If13023a689dadfefe1475e0ef2f192922f2e7753
ad812a23df775062f0185076557e7f3fdfa57943 22-Mar-2012 Amith Yamasani <yamasani@google.com> Merge "Package restrictions per user"
4b63d69759ecbb6837b3ee227f336905c9d9bae5 22-Mar-2012 Jeff Sharkey <jsharkey@android.com> Fix test breakage.

Change-Id: I2c5fc8c3bf7795ccdd474caa3f858e9a56f026ed
483f3b06ea84440a082e21b68ec2c2e54046f5a6 14-Mar-2012 Amith Yamasani <yamasani@google.com> Package restrictions per user

Packages can be enabled/disabled per user.
This requires maintaining stopped/launched states and
enabled / disabled components and packages per user.

Refactored pm.Settings and PackageSettingsBase to keep
track of states per user.

Migrated the stopped-packages.xml to users/<u>/package-restrictions.xml

Changed intent resolution to handle individual user restrictions.
Bunch of IPackageManager calls now have a userId argument.
Make AppWidgetService handle removals of packages.

Added some tests for pm.Settings and PackageManager.

Change-Id: Ia83b529e1df88dbcb3bd55ebfc952a6e9b20e861
9bf3150cfae03421c9dd237b46657714859d871c 10-Mar-2012 Jeff Sharkey <jsharkey@android.com> Save timezone when setting data cycle reset date.

Instead of cycle reset at midnight UTC, use midnight of timezone
active when user last set cycle reset date. Tests to verify, and
also to test leap year behavior.

Bug: 5938567
Change-Id: Ie06f7f0fa242d23110f9586a3f4f7037af87b31b
241dde2306202e7655fdf41d5381f2874e47e108 03-Feb-2012 Jeff Sharkey <jsharkey@android.com> Unify shorthand for byte-based units.

Change-Id: If990859dee3f0973e1d4c48f05312c84071b3328
0e2e5f8b564bebd5798c9fa387fbff96429ab5d2 03-Feb-2012 Jeff Sharkey <jsharkey@android.com> Support snoozing of data warning notification.

Introduce second snooze timestamp to support dismissal of data usage
warning notification. Also explicitly set notification "when" to
avoid fighting with other notifications, such as ongoing downloads.

Bug: 5443756, 5262414
Change-Id: I03342c25b0410b1b2db84de9a40884f04cb1d8ae
63abc37356728c0575d6a62a203102ae6d97953b 12-Jan-2012 Jeff Sharkey <jsharkey@android.com> Move network stats to FileRotator pattern.

Split existing network stats into two separate classes: a recorder
which generates historical data based on periodic counter snapshots,
and a collection of historical data with persistance logic.

Recorder keeps a pending history in memory until outstanding data
crosses a specific threshold. Persisting is handled through a given
FileRotator. This pattern significantly reduces disk churn and
memory overhead. Separate UID data from UID tag data, enabling a
shorter rotation cycle. Migrate existing stats into new structure.

Remove "xt" stats until iptables hooks are ready. Avoid consuming
Entry values when recording into NetworkStatsHistory. Assign
operation counts to default route interface.

Introduce "Rewriter" interface in FileRotator with methods to enable
rewriteAll(). Introduce IndentingPrintWriter to handle indenting in
dump() methods.

Bug: 5386531
Change-Id: Ibe086230a17999a197206ca62d45f266225fdff1
f60d0afd1ef08a24121d015bb016df05265b6d07 01-Dec-2011 Jeff Sharkey <jsharkey@android.com> Restrict app data on metered networks.

This separates the definition of "metered network" and "network with
limit." For now, all mobile networks are considered metered.

Bug: 5571454
Change-Id: I394cd385bd33add75e53bfc9cf2fefd06a00208a
f9165b7e43885a3bf8c2b14788d0600642493d58 10-Dec-2011 Makoto Onuki <omakoto@google.com> MCC detection fixes for CountryDetector

- Don't get and cache phone tpe at the initialization time. At this point
TelephonyManager is probably not ready yet.

- Refresh MCC whenever we get the service state changed callback, even when
the state hasn't actually changed, in order to make sure we get refresh
country properly when MCC changes.

- Also remove the initialization of mPhoneStateListener, which prevented us from
registering phone state listener properly.

- Also fix tests which were already failing.

Bug 5670680

Change-Id: Id45abeba1b1e843053ac2c946861b439ca568de4
31c6e4817f6c967fc4f61c4f1d9f25743958f7de 19-Nov-2011 Jeff Sharkey <jsharkey@android.com> Move NativeDaemonConnector to varargs.

Perform uniform argument escaping inside NativeDaemonConnector, using
varargs to separate boundaries. Also move to parsed NativeDaemonEvent
instances instead of raw Strings.

Bug: 5472606
Change-Id: I1270733e2b2eeb2f6b810240df82ab24d38ebf40
8549aeea0af63810bd5a661a23079d6554e4717b 18-Nov-2011 Nick Kralevich <nnk@google.com> Merge "Rename EntropyService to EntropyMixer"
6967cbc959b079fa7e4411360e40e2a0ed65da29 17-Nov-2011 Nick Kralevich <nnk@google.com> Rename EntropyService to EntropyMixer

EntropyService implies that this program provides entropy to other
programs, and is misleading. The EntropyMixer class is designed purely
to stir the existing entropy pool with some possibily random-ish data,
and carryover entropy across device reboots.

Change-Id: I086cd339a3b652d32371521e61e1b1f555ce2280
c506ff615080082515b1f634ad49b19fd2111669 17-Nov-2011 Jeff Sharkey <jsharkey@android.com> Only write network stats when already loaded.

Bug: 5584564
Change-Id: Ife2a68804bf3691e9bccdc167807204bce8a85b2
7ee8658453fe4efe04781bea9a14368e1d5ff41f 15-Nov-2011 Jeff Sharkey <jsharkey@android.com> Conservatively trim data usage stats.

Instead of trusting NTP time alone, use the most-conservative of
system clock and NTP.

Bug: 5584564
Change-Id: I5dd87fc009959b1cf0a7d660e385a0b1a8be238b
163e6443f27884a9bfcb9a48ef606dc635852c23 01-Nov-2011 Jeff Sharkey <jsharkey@android.com> Correct proc file reader, optimizations.

Moved away from BufferedReader, which only reads the first 8KB of
some proc files because it aggresively fills its buffer. Optimized
proc parsing, now double the speed. Tests to cover.

Log when NetworkStats counters roll backwards when subtracting, and
optimizations around findIndex(). When system removes UID, also
remove from last stats snapshot to avoid xt counters from rolling

Bug: 5472949, 5458380
Change-Id: I07c08fe5233156fac2b84450f6291868bf9bfaf2
1059c3c30ad96a15695c1a92ae8896e078a6309f 05-Oct-2011 Jeff Sharkey <jsharkey@android.com> Move battery stats to xt_qtaguid for data stats.

Replace TrafficStats calls by reading values from xt_qtaguid kernel
module. To keep BatteryStatsImpl changes lightweight, cache recently
parsed stats. Tracks mobile ifaces from ConnectivityService.

Refactor xt_qtaguid parsing into factory outside of NMS. Add stats
grouping based on UID, and total based on limiting filters like iface
prefix and UID.

Bug: 4902271
Change-Id: I533f116c434b77f93355bf95b839e7478528505b
ae2c1810839430c84e4a1172580d9c4b18f568ca 04-Oct-2011 Jeff Sharkey <jsharkey@android.com> Read iface stats from single proc file.

When available, use single "iface_stat_all" file instead of reading
values from dozens of files scattered across proc. Tests to verify.

Bug: 5397840
Change-Id: I0247be518436c1f79b32c4b72216739f49a9e8cc
905b5891d2aa802f447ac2ce5d77b6c5ba06277a 01-Oct-2011 Jeff Sharkey <jsharkey@android.com> Track xtables summary, move tether stats, time.

Begin tracking xtables summary of data usage to compare with values
reported from /proc/net/dev. Roll tethering directly into UID stats
to trigger UID stats persisting when crossing threshold.

Include xtables summary and authoritative time in samples.

Bug: 5373561, 5397882, 5381980
Change-Id: Ib7945522caadfbe0864fdf391582dc820f4f371e
8a663c89a3b5bda4e749a58d0434b130260eabb2 26-Sep-2011 Kenny Root <kroot@google.com> Merge "Allow non-required package verifiers"
05ca4c90644921df9193d92b2abdc81ef77e4a62 15-Sep-2011 Kenny Root <kroot@google.com> Allow non-required package verifiers

* Verifiers can be specified in the AndroidManifest.xml

* Those verifiers can respond to the new Intent action

* PackageManager API for those verifiers: verifyPendingInstall

Change-Id: I4892bce2e6984871e6e93c60a1ca0dae145f5df5
367d15ab1a33b6159447fa8542d4fa8ff148371c 22-Sep-2011 Jeff Sharkey <jsharkey@android.com> Watch network subtype, tethering teardown, empty.

Watch for changes to telephony network subtype, and update iface
mapping to persist stats under correct type. Update network stats
before removing tethering NAT rules.

Skip recording that would create empty historical buckets. Query UID
stats before iface stats to always skew positive when counters are
actively rolling forward.

Bug: 5360042, 5359860, 5335674, 5334448
Change-Id: I8aa37b568e8ffb70647218aa1aff5195d3e44d5a
34c73acf88c8190b8cd51d8b8f2b9c22aa7f7941 18-Sep-2011 Jeff Sharkey <jsharkey@android.com> Sample atomic network stats buckets, full poll.

When sampling network stats, always use atomic buckets instead of
interpolating. Always poll iface and UID together so we distribute
into buckets equally. Move stale bucket trimming to just before
writing stats.

Bug: 5321340
Change-Id: I78a2226778a79c875f3668336e39ea24a7b4d5c4
98a4f7e7e12effb78b3d1035e5a670ccbbf5bca1 03-Sep-2011 JP Abgrall <jpa@google.com> NetworkManagement SocketTagger: Migrate QTagUid support to JNI.

* Instead of javaland trying to write commands to
use the libcutils/qtaguid.c support via JNI.
* Get rid of tagToKernel() handled by qtaguid library.

Requires libcutils changes from c/132538/

Change-Id: I9de5b3fa4a596c56835024c6d376769a0eea7db1
991d1b1b3f303ad247a959881b1d5b57766f678b 15-Sep-2011 Jeff Sharkey <jsharkey@android.com> Network stats flag to force complete poll.

Devices currently delay collecting UID stats during common operations
like global alerts to reduce parsing load. Here we introduce a flag
to always collect UID and iface stats together to aid debugging.

Bug: 5321340
Change-Id: Ia8e1daf1a6f9d5f5cf1f64a04b6b6766ee965ab6
b3d5957604f8fcaafe72bd76052bc76b682bf443 08-Sep-2011 Jeff Sharkey <jsharkey@android.com> Poll UID stats during iface changes, enforce idx.

When ifaces change, poll UID stats without persisting, since they
depend on knowing active iface to store correctly. Log dropped UID
stats when iface is unknown. Switch to using flags when calling

Enforce that "idx" values are consistent from xt_qtaguid. Transition
to using Log.wtf() for important checks, mostly around file I/O,
kernel stats parsing, and kernel module control. Increase stats
persist threshold to 2MB to reduce churn.

Bug: 5269476, 5270106
Change-Id: I721215bfb65127f95775c71cf135e907cd567e92
0fea823673e9cab24bd16a1c80a9bd689fc7a6f9 01-Sep-2011 Jeff Sharkey <jsharkey@android.com> Selectively add stats based on iface active state.

Only combine /proc/net/dev and xt_qtaguid stats when iface is marked
as active. When inactive, only return xt_qtaguid stats. When iface
is unknown to xt_qtaguid, always pass through /proc/net/dev stats.

Bug: 5242730
Change-Id: I469fc6abe45309f794afebca814cbb39e4f13af5
961e30458319cfd50e1892ba7dd14a1d0ebe4cc7 30-Aug-2011 Jeff Sharkey <jsharkey@android.com> Introduce immediate CONNECTIVITY_ACTION variant.

New broadcast that is dispatched immediately after connectivity
changes have been handled by ConnectivityService, bypassing any

Also protect CONNECTIVITY_CHANGE broadcasts, since they should only
be sent by system.

Bug: 5198167
Change-Id: I75f1fb44b21da1879f0ab960bcaa481126d70fde
47eb102b40cd1324d89816a7fb0fecd14fd7a408 26-Aug-2011 Jeff Sharkey <jsharkey@android.com> Always splice historical data stats, debug info.

When reading network counters, always splice in xt_qtaguid values
to avoid counting backwards. Test to verify.

Remove verbose logging around global alerts, and add dumpsys debug
info for NMS and MDST. Also fix subtle bug around stats persisting
and dumping.

Bug: 5212893, 5211028
Change-Id: I783e5286637a67ee2dd2b09878198711a926d0cb
8e9992ae5053a3ac52d28a5a892aed0a0798c7ab 24-Aug-2011 Jeff Sharkey <jsharkey@android.com> Register for kernel global data usage alerts.

Instead of polling every 15 minutes, register for alerts that trigger
when system-wide traffic passes a threshold. Still mixed with polling
to persist UID stats, but relaxed to 30 minutes. Currently watches
for every 512kB.

Make persistence decision separately for network versus UID, and use
total delta bytes when making decision. Use light bootstrap during
systemReady() instead of heavy poll, which had been force-loading all
UID data unnecessarily.

Bug: 5023631
Change-Id: I04b723d6c4bf872fb1028071122dba66a8e1b576
8e28b7d78232f6cf08739ca0d129cc7f9e650801 19-Aug-2011 Jeff Sharkey <jsharkey@android.com> Proactively disable data when over policy limit.

Add policy controls to NetworkStateTracker which are combined with
other user preference and internal flags to decide if data connection
should be established. Better locking around enabled flags.

When data network would be over limit, proactively disable data on
that network. Enable when policy is snoozed or when cycle resets.

Track and dismiss notifications from now-stale policies.

Bug: 4587023, 5178147
Change-Id: Ibfcc9f73cda7c369209af701b46eddd3d1943f2d
b5d55e302d2253e4bfb233ea705caf258cdc4cb9 11-Aug-2011 Jeff Sharkey <jsharkey@android.com> Foreground/background network stats using sets.

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
af82ea2abf53b6825fbbce23434419527d8e8b5c 05-Aug-2011 Jeff Sharkey <jsharkey@android.com> Data cycle ends on last second of month.

When data cycle resets on a day invalid in given month, snap the
cycle to last second of month. Previous behavior was to bump fully
into next month, but that causes cycle loops.

Includes tests to verify.

Bug: 4623124
Change-Id: I2f233091f6f1df33a2814284519cbc04532874e9
63d27a9233fed934340231f438493746084a681d 04-Aug-2011 Jeff Sharkey <jsharkey@android.com> Network stats with varint, omit parcel fields.

Persist NetworkStatsHistory using variable-length encoding; since
most buckets have small numbers, we can encode them tighter. Initial
test showed 44% space savings. Also persist packet and operation

Let NetworkStatsHistory consumers request which fields they actually
need to reduce parcel overhead.

Tests for verify varint and history field requests, also verify end-
to-end by persisting history into byte[] and restoring. Expose
bandwidth control enabled state. Extend random generation to create
packet and operation counts. Moved operation counts to long.

Fix bug that miscalculated bytes since last persist, which would
cause partial stats loss when battery pulled.

Bug: 4581977, 5023706, 5023635, 5096903
Change-Id: If61e89f681ffa11fe5711471fd9f7c238d3d37b0
a63ba59260cd1bb3f5c16e395ace45a61f1d4461 20-Jul-2011 Jeff Sharkey <jsharkey@android.com> Add operation counts to network statistics.

Provide API to increment "operation counts" for a UID and tag, used
to eventually derive bytes/operation stats. Internally is stored at
network layer, but should belong at data layer. Switch profiling
to use data layer stats, which are emulated by summarizing network
layer details.

Read packet counts from new /proc/ columns and collect them into
NetworkStatsHistory. Prevent double-counting by ignoring values from
first snapshot. Watch for duplicate /proc/ entries. Update tests
to verify packet and operation counters.

Bug: 5052136, 5097392
Change-Id: I1832f65a2b8a9188f8088f253474a667c21a2f09
41ff7ec82422a5b6d00892afdb3232bc0e53d851 26-Jul-2011 Jeff Sharkey <jsharkey@android.com> Revise data limit notifs, watch kernel alerts.

Teach NetworkPolicy limits to "snooze" when requested by user, and
notify with both dialog and notification. Register for network alerts
through NMS to trigger updates immediately instead of waiting for
next stats update.

Enforce that all NetworkPolicy are unique on a template basis, and
move SCREEN_ON/OFF broadcasts to background thread. Launch SystemUI
and Settings directly instead of using actions, and include full
NetworkTemplate in extras.

Tests to verify notification and snooze behavior.

Bug: 5057979, 5023579, 4723336, 5045721
Change-Id: I03724beff94a7c0547cb5220431ba8d4cd44d077
00aabf7d187bc05408199bd687a538b2e68bdc17 21-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> Touch exploration state set to clients asynchronously and depended on talking service being enabled.

1. Upon registration of an accessibility client the latter received only
the accessiiblity state and waiting for the touch exploration state
to be sent by the system in async manner. This led the very first
check of touch exploration state is checked a wrong value to be reported.
Now a state of the accessibility layer is returned to the client
upon registration.

2. Removing the dependency on talking accessibility service to be enabled
for getting into touch exploration mode. What if the user wants to use
an accessibility service that shows a dialog with the text of the touched


Change-Id: Ib377babb3f560929ee73bd3d8b0d277341ba23f7
35bfedeaba724aeadc6f6c890269cb6bf7ef42f5 15-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> Touch exploration separate setting and API to poll the latter state.

1. Seperated touch exploration to be a seperate setting rather being
magically enabled by the system of accessiiblity is on the there
is at leas one accessibility service that speaks enabled. Now
there is a setting for requesting touch exploration but still the
system will enabled it only if that makes sense i.e. accessibility
is on and one accessibility service that speaks is enabled.

2. Added public API for checking of touch exploration is enabled.

3. Added description attribute in accessibility service declaration
which will be shown to the user before enabling the service.

4. Added API for quick cloning of AccessibilityNodeInfo.

5. Added clone functionality to SparseArray, SparseIntArray, and


Change-Id: Ia442edbe55c20309244061cd9d24e0545c01b54f
4e814c348ce205fcc1a273427f95ef1d100ed60c 15-Jul-2011 Jeff Sharkey <jsharkey@android.com> Hide NetworkTemplate details, buffered stats I/O.

Move template matching to builder methods instead of exposing the
internal constants. Also rule to match Ethernet usage. Buffer
reading and writing of network stats, making operations 5x faster.

Change-Id: Iedb2d0ab3b26a976811c050f84a164e909eb74b6
434962e44ea93b1c4d216c55f636a435bf54aa54 13-Jul-2011 Jeff Sharkey <jsharkey@android.com> Include full network history around current time.

When requesting historical values with time ranges, always include
full values for buckets that span current time. (It doesn't make
sense to interpolate partial data.) Move getTotalData() to return
full Entry objects to prepare for packet counts.

Bug: 4691901
Change-Id: I717bd721be9f1d4a47c4121e46e07a56cb15bbf1
d37948f6ed1667d077e0e3a38808f42f981ddcc2 12-Jul-2011 Jeff Sharkey <jsharkey@android.com> Hide NetworkStatsHistory internals.

Instead of exposing internal storage details, offer getValues()
accessor which populates values into a recycled structure.

Change-Id: I5228d7099a8f61b2018a435a813435a67dae49b4
fd8be3e5e7420f3cca591daeec8a44487f5f65aa 11-Jul-2011 Jeff Sharkey <jsharkey@android.com> Return stats from inactive ifaces, packet counts.

When an iface goes inactive, xt_qtaguid maintains historical counters
instead of discarding. Now reading and returning those values in
NetworkManagementService summary calls. Tests to verify stats are

Modify NetworkStats to include rxPackets and txPackets values, and
move to Entry to eventually hide internal storage details.

Bug: 4984539
Change-Id: I1ba0bb5580c62e946d9dff2cc2a6f64aff403efc
350083e36b9db6062e165954403ef921ff3dfdad 29-Jun-2011 Jeff Sharkey <jsharkey@android.com> Migrate bandwidth control to NMS, omit history.

Both stats and policy make NMS calls that depend on bandwidth control
being enabled, so move enable/disable into NMS and drop calls when
disabled. This avoids throwing heavy ISE exceptions when disabled.

Only include recent data when writing NetworkStatsHistory as part of
dumpsys call. Introduce manual poll event for Settings UI.

Bug: 4982115, 4770435, 4515856
Change-Id: I257820b057af2f0f99c736fb4f61e55b9fdc3e66
b3f19ca36c8c1301893c621d8f2150e06210722c 30-Jun-2011 Jeff Sharkey <jsharkey@android.com> Enforce background data flag, rules through netd.

Connect up netd penalty box through NMS, and enforce the existing
background data flag by putting all UIDs in penalty box. Allow
platform applications to have policy applied. Only dispatch unique
rules to netd, avoiding any repeats.

Bug: 4598463, 4965677
Change-Id: Ibf9beff998ba7a1ea92f5e2f7eeba7b483d4b918
afb60c36b7879c4ed195fb19cc4334175be28c92 29-Jun-2011 Jeff Sharkey <jsharkey@android.com> Merge "Push interface quota rules from NetworkPolicyManager to kernel."
50fd36d7c38c40b087c8f3e3172478abe0c051d9 16-Jun-2011 Ashish Sharma <ashishsharma@google.com> Push interface quota rules from NetworkPolicyManager to kernel.

Change-Id: Id2b758f561820b44839f69bf5fbd676cae771fe3
8568db534118fc14cc28100306d51626464ff319 29-Jun-2011 Jesse Wilson <jessewilson@google.com> Move socket tagging from libcore.

Change-Id: I7515896936c5bbd212c88e2801b831914219a925
4414cea13908b8230640f84ef39603d68ff9c377 25-Jun-2011 Jeff Sharkey <jsharkey@android.com> Better network stats parsing, integer tags, async.

Change NMS parsing to handle extended /proc/ stats formats by pairing
values with header keys. Move TrafficStats to integer tags to match
kernel internals, and offer well-known tags for system services.

Async policy event dispatch from NPMS, and update tests to block for
event dispatch. Narrow app policy to exclude apps signed with system
key, which are usually critical.

Bug: 4948913, 4903489, 4585280

Change-Id: Idb357227ccaa617906411f309371cea18d7bc519
d03fd3f004e3ba8aaa1692ee0e92e8ae171d2a04 20-Jun-2011 Jeff Sharkey <jsharkey@android.com> Persist "tagged" network stats along with UIDs.

Now stores tags other than TAG_NONE (0x0), which are useful for app
debugging. Combine UID and tag together into single long key, and
expose tag data through AIDL when requested. Change NMS to track
TAG_NONE as total UID traffic, matching the kernel definition.

Added TAG_MAX_HISTORY to control how long tag-granularity statistics
are stored; overall UID usage is still kept for UID_MAX_HISTORY. Fix
bug to trim NetworkStatsHistory outside normal polling loops to catch
non-active networks and UIDs.

Test to verify UID and tag packing, and to verify that UID traffic on
two networks are combined to match MOBILE_ALL template.

Change-Id: If0e039416d9e7f63b1a39e04cddfb1133b5a78ee
b09540f33a6cabe50edec0ef32d0b1d0b0d96fff 19-Jun-2011 Jeff Sharkey <jsharkey@android.com> Handle removed UIDs in network stats and policy.

When UID_REMOVED, clean up any existing UID network policy so it
doesn't linger for future apps. Also move any NetworkStatsHistory
to special UID_REMOVED tracking bucket.

Tests for new removal code. Also test detailed UID stats, including
network changes to verify template matching logic.

Bug: 4584212
Change-Id: I9faadf6b6f3830eb45d86c7f1980a27cdbcdb11e
1b5a2a96f793211bfbd39aa29cc41031dfa23950 19-Jun-2011 Jeff Sharkey <jsharkey@android.com> Read "qtaguid" network stats, refactor templates.

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
fdfef57f498e3021a34342538aef9f1c7ccbae78 17-Jun-2011 Jeff Sharkey <jsharkey@android.com> Notify policy listeners about metered ifaces.

Currently, kernel definition of metered networks is applied at the
interface level. This change maintain list of those metered ifaces
and notifies policy listeners, like ConnectivityService. (This gives
us a consistent picture of when a network would be blocked.)

Bug: 4601393
Change-Id: I277d5ca96ab967a1c1c3f1da8f9587557cd6d74c
2ef2aeb18d9d1ca7e25ad705c4da559f3682805a 15-Jun-2011 Jeff Sharkey <jsharkey@android.com> Fix NetworkPolicy tests after notifications.

Change-Id: I569e9ceba6d89459b347ed151fd9bda2909dc892
af11d4859582a9736aa204562f0beac5a7d60934 13-Jun-2011 Jeff Sharkey <jsharkey@android.com> Fix test-related build breakage.

Change-Id: I48a3dbbdc49d742d6ad19cff34ee8da4b3949bb8
4a97122ebf4d92a3f94402041729d77905e6c0c0 12-Jun-2011 Jeff Sharkey <jsharkey@android.com> Growable NetworkStats object instead of builder.

NetworkStats now grows in place with arraycopy() instead of callers
needing to know record count a priori. Better growth calculation for
both NetworkStats and NetworkStatsHistory; 50% each time. Better
estimates of buckets needed in calling services.

Change-Id: I3adbffa0b7407612cc6349d9135a8b4eb63cd440
39ebc2195ed16b9e955dd57f5c95212bb7b934b6 12-Jun-2011 Jeff Sharkey <jsharkey@android.com> Persist UID stats, lazy loading, resize buckets.

Persisting detailed UID stats in separate "netstats_detail.bin" file
to enable different schedules for summary and detail polling. Only
load detailed UID history on demand, since it's not needed during
boot. Add test to verify UID stats are persisted across simulated

Move external settings into well-named interface, which is still
backed by Settings.Secure. During periodic poll events, resize any
history to match current bucket duration setting. Test to verify.

Change-Id: I6366f3583a591f8ba859b0e5987daf8cafa4e95a
cd2ca4038a027315832c38c68be5076000bc4b53 11-Jun-2011 Jeff Sharkey <jsharkey@android.com> Move data cycle methods to framework object.

Moved so they can be used by both system service and Settings UI, since
they both work with data usage cycles. Still covered by tests.

Change-Id: I01c0c4db6da9457dd867c9167d31a5f9f8e5f5d9
21c9c45e5caf62b935354b74392fb40c4bf18529 07-Jun-2011 Jeff Sharkey <jsharkey@android.com> Interface-level network policy, persist policies.

Define NetworkPolicy as cycle-reset day and warning/limit values, and
set/get through NetworkPolicyManager. Watch ConnectivityManager for
network connection events, and apply quota rules based on matching
interfaces. Policy service matches based on strong identity to support
IMSI-specific policy values.

Calculates remaining quota based on current stats recorded since the
last reset cycle day. Tests to verify edge cases around February.

Persist network and UID policies in XML, and restore on boot.

Change-Id: Id40ba7d6eed6094fbd5e18e6331286c606880d80
3f3913550c10792edb8aecf66cc83c3db5c8b311 06-Jun-2011 Jeff Sharkey <jsharkey@android.com> Persist network stats using AtomicFile.

Implements read/write of network stats using AtomicFile, along with
magic number and versioning. Stores in "/data/system/netstats.bin"
for now. Tests to verify that stats are persisted across a simulated
reboot, and to verify that TEMPLATE_WIFI is working.

Fixed bug where kernel counters rolling backwards would cause negative
stats to be recorded; now we clamp deltas at 0.

Change-Id: I53bce26fc8fd3f4ab1e34ce135d302edfa34db34
75279904202357565cf5a1cb11148d01f42b4569 25-May-2011 Jeff Sharkey <jsharkey@android.com> Collect historical network stats.

Periodically records delta network traffic into historical buckets to
support other services, such NetworkPolicyManager and Settings UI.

Introduces NetworkStatsHistory structure which contains sparse, uniform
buckets of data usage defined by timestamps. Service periodically
polls NetworkStats and records changes into buckets. It only persists
to disk when substantial changes have occured. Current parameters
create 4 buckets each day, and persist for 90 days, resulting in about
8kB of data per network.

Only records stats for "well known" network interfaces that have been
claimed by Telephony or Wi-Fi subsystems. Historical stats are also
keyed off identity (such as IMSI) to support SIM swapping.

Change-Id: Ia27d1289556a2bf9545fbc4f3b789425a01be53a
9599cc5f21152860af9d18015b1398b50743da76 22-May-2011 Jeff Sharkey <jsharkey@android.com> Tests for NetworkPolicyManager rule generation.

Verifies that policy changes trigger rule updates that respect current
foregroundActivities status. Also verifies logic that promotes a UID
based on its most-foreground PID. Verifies that policy changes result
in immediate rule changes.

Also verifies that BACKGROUND_DATA_SETTING_CHANGED broadcasts are sent
by policy changes.

Change-Id: I4fd0dad9e1dbccee2c5968244bb1814e6cb2c6e1
cc4053e031371456fe54d51bbad1db721db4ae38 23-May-2011 Svetoslav Ganov <svetoslavganov@google.com> Accessibility serviceconfiguration via meta-data

Note: This is a part of two CL change and contains the
system changes without updates to the settings.

1. Added a mechanism for configuring an accessibility service via
XML file specified in a meta-data tag (similar to IMEs).

2. Added property for specifying a settings activity for an
accessibility service.

3. Refactored the APIs in AccessibilityManager to return
lists of AccessiblityServiceInfo instead ServiceInfo
since the former describes an AccessibilityService in
particular (similar to IMEs).

Change-Id: Ie8781bb7e0cdb329e583b6702a612a507367ad7b
eedcb9525ba5befee2ba6ebb7a9ee3f13395c2a3 17-May-2011 Jeff Sharkey <jsharkey@android.com> APIs to profile network usage for current UID.

Added startDataProfiling() and stopDataProfiling() to TrafficStats,
which can be used by apps to measure network usage delta between two
points in time. Currently takes two NetworkStats snapshots and returns
delta, which will eventually include tag-level granularity. Added
tests for NetworkStats delta subtraction.

Added NMS.getNetworkStatsUidDetail() that returns stats for specific
UID. Always gives stats access for the calling UID, otherwise enforces
that caller has permission. Fix readSingleLongFromFile(), since
/proc/ files don't have well-defined lengths.

Change-Id: Ic5b6414d8effbd66846e275b00d4b8a82c74589d
9a13f36cddaad01350bdb5f000167811a1d753c9 27-Apr-2011 Jeff Sharkey <jsharkey@android.com> Return NetworkStats bundle from NM service.

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
a550bdc84af70babb48091197bfb1b93d3671664 27-Apr-2011 Daisuke Miyakawa <dmiyakawa@google.com> Use passive provider for location based country detection

Bug: 4345419
Change-Id: Ia3e071b97c6971538ea994fdee6029db928201d6
b7342acebcb7e5dc7da0cda77fbddf50e7dfdd7c 26-Apr-2011 Jeff Sharkey <jsharkey@android.com> Tests for ThrottleService, NTP into TrustedTime.

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

Change-Id: I0d62b8b3a169516a2ab2d33025f6fe30dc792be8
0b285499db739ba50f2f839d633e763c70e67f96 15-Apr-2011 Amith Yamasani <yamasani@google.com> Plumbing in PackageManager and installd for multi-user support.

- Create /data/user directory and symlink /data/user/0 -> /data/data for
backward compatibility
- Create data directories for all packages for new user

- Remove data directories when removing a user

- Create data directories for all users when a package is created

- Clear / Remove data for multiple users

- Fixed a bug in verifying the location of a system app

- pm commands for createUser and removeUser (will be disabled later)

- symlink duplicate lib directories to the original lib directory

Change-Id: Id9fdfcf0e62406a8896aa811314dfc08d5f6ed95
4b2e934928a2eb65927bd39197198c28c49efb94 31-Mar-2011 Amith Yamasani <yamasani@google.com> Package manager changes to store and update user information.

Some API stubs for managing users and storing their details.
List of users is stored in an xml file.
Each user's properties are stored in a separate xml file.

Some unit tests for modifying the XML files.

Change-Id: If2ce2420723111bd426f6762def3c2afc19a0ae5
383742c16d3dcbfcf748a89f0cb88ac8d2b31bb5 09-Dec-2010 Svetoslav Ganov <svetoslavganov@google.com> 3205857 java.lang.ExceptionInInitializerError at java.lang.Class.newInstanceImpl(Native Method)

Change-Id: I72ab33da2f5cc0bbaa89f3b996ff4ac48deadf73
a58a8751b4c2ce457f0082a0baaee61312d56195 13-Jul-2010 Bai Tao <michaelbai@google.com> Add new system service CountryDetector

a. The CountryDetector detects the country the user is in
in order of mobile network, location, sim card or locale.
It will be used by contact and contact provider.

b. All added APIs are hidden at this stage.

Change-Id: I4ba278571ffb6ab6ded0996d4f440a18534f8ed4
3300b6f41e18b26a462824effa6be65a4b158346 22-Jul-2010 Dan Egnor <egnor@google.com> am 7da38863: am 3685db7f: am e8605af5: Merge "Avoid leaking file descriptors when returning drop box events." into froyo

Merge commit '7da38863d4382746090bf50413b1774ab04f6bc1'

* commit '7da38863d4382746090bf50413b1774ab04f6bc1':
Avoid leaking file descriptors when returning drop box events.
6e6d60d4c85ce440d9ef5e5f36e708ed0ced65c6 21-Jul-2010 Dan Egnor <egnor@google.com> Avoid leaking file descriptors when returning drop box events.

We can't use Parcel.writeValue() to write the ParcelFileDescriptor, otherwise
it leaks when returning the value to the caller (the flag gets lost). Change
the way DropBoxManager.Entry gets serialized so that it uses a bit of its own
flags value to track whether the data is a byte[] or a ParcelFileDescriptor.

Modify the dropbox unit test to add extensive checking of Entry serialization
and deserialization under various circumstances, and to include a regression
test to ensure that FD leaking doesn't happen.

Bug: 2847738
Change-Id: I4ccd17dd03ffab234340cd359e6f3510fdf81193
5637745e59e1c0c22ec2e0adb1f48f8f4edcb7be 07-Jun-2010 Svetoslav Ganov <svetoslavganov@google.com> 2744878 com.android.server.AccessibilityManagerServiceTest:testInterrupt is failing

Change-Id: I73d056c7dcf8edddae2ef9cb28ec7d2b3203bb9b
0b29a587142b19ed25dd6489cfa037d06145afd1 17-Apr-2010 Svetoslav Ganov <svetoslavganov@google.com> 2604226 Add test cases for the internal accessibility infrastructure.

Change-Id: Iaeb2c11b6c2167632086b50d9c79e6459cc072b8
3a8b0c18a49c017ecfde8ebf4eb4bb5181ac6fef 25-Mar-2010 Dan Egnor <egnor@google.com> Limit DropBox storage to 1000 files (by default).

Also does trimming asynchronously (not directly in the broadcast receiver).

Bug: 2541253
Change-Id: I7daf8bc618e2dce68a98571f5f7fbce4df1d6a76
93a68398b661c02d6c417a2a04e64a6750a9a119 20-Mar-2010 Nick Kralevich <nnk@google.com> Unittests for EntropyService. Make EntropyService more testable.

I've been meaning to write these tests for a long time...

Use "runtest frameworks-services" to run these tests.

Change-Id: I3a3cb7eda547f4a790f38be884b4a583426c7326
1a44d5dcabc18cd5ef111f732ccff91683a1a093 13-Jan-2010 Neal Nguyen <tommyn@google.com> Phase 2 of test cleanup: moving test files from AndroidTests closer to their sources.

Most of these are file moves; a couple notable exceptions are the changes due to the move, and fixing up test code:
- database/DatabaseCursorTest.java
- database/DatabaseStatementTest.java
- net/UriTest.java