History log of /frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
fe9a53bc45fd0124a876dc0a49680aaf86641d3e 31-Mar-2017 Jeff Sharkey <jsharkey@android.com> Consistent dump() permission checking.

This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access. It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.

Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
62f5c178378be82d15fcb6d0b3a95be154f062bd 18-Mar-2017 Sudheer Shanka <sudheersai@google.com> Add NetworkManagementInternal.isNetworkRestrictedForUid.

This will be used by the ActivityManagerService to decide if
an app needs to block for network or not.

Bug: 27803922
Test: runtest -c com.android.server.NetworkManagementInternalTest frameworks-services
cts-tradefed run singleCommand cts-dev --module CtsHostsideNetworkTests -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests
and manual

Change-Id: I9e62406e2638f70497b43b5b41607df41aefd66c
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
c2d3ff55533af7f1e17afb56b2ee2316ff66002c 19-Jan-2017 Erik Kline <ek@google.com> Merge "Try to deduplicate observer iteration code" am: c8223d0874 am: c822d054a3 am: f8afe45d89
am: e344c6732b

Change-Id: Id8c1766a5e1321ce8cc4327aae5677094aa61fb0
b2cfdfbbb0c652e759d8cae32d016b01918a3083 18-Jan-2017 Erik Kline <ek@google.com> Try to deduplicate observer iteration code

Later on, registerObserver() can take a handler argument and
invokeForAllObservers() can be updated to post to it when
provided.

Test: as follows
- built (bullhead)
- flashed
- booted
- runtest frameworks-net passes
Bug: 32163131
Change-Id: Ibc32079e1084e2e43f7826fe6b2bdbb83c482e26
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
e00c7dd3fc24aefc38b59bb2c67e75347a7f156b 17-Jan-2017 Lorenzo Colitti <lorenzo@google.com> Merge "Delete dead code." am: cf59ff79c5 am: d305a7c894 am: 8cf7169564
am: bb79257dbf

Change-Id: I97102d587cfc8699fd36f18e4072a5baaa7e2d11
319146d3725cf39d818cb90e8ec16bb04449973e 15-Dec-2016 Lorenzo Colitti <lorenzo@google.com> Delete dead code.

Since N, DNS servers are not set by setDnsServersForNetwork, they
they are set by setDnsConfigurationForNetwork.

Test: compiles
Bug: 30944031
Change-Id: I3a3edb9ffe9d5f9652af0b6637eb89b1b044a270
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
dc589ac82b5fe2063f4cfd94c8ae26d43d5420a0 11-Nov-2016 Sudheer Shanka <sudheersai@google.com> Update usage of ActivityManagerNative.

- Remove references to ActivityManagerProxy.
- Add isSystemReady to ActivityManager.

Bug: 30977067
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \
-w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
29e72ea036a4ec9b68d05296a95d84a4ab7ad935 08-Sep-2016 Felipe Leme <felipeal@google.com> Added trace on Data Saver-related methods.

BUG: 31389946
Test: m -j32 cts && cts-tradefed run commandAndExit cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: I4a4299371a529121438db166fe03de8263812323
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
722de5f9d0bbac21fb0d132669fcc317e2c6703f 30-Aug-2016 Mitchell Wills <mwills@google.com> DO NOT MERGE Manually merge commit 'f28778064383821ccf48c9570191f34a24aa513f' into nyc-mr1-dev-plus-aosp

Change-Id: I7cb1f97a5b931c2057a811d7947f47ad7320ef1c
5de073a6b0d08f7bca33ea9e944379042d734d75 02-Aug-2016 Christopher Wiley <wiley@google.com> Remove WiFi related methods from NetworkManagementService

These are no longer necessary, since WiFi manages its own details.

Bug: 30041228
Change-Id: Ia3824da43367ae74d3f3a204318cfe5470d74957
Test: Compiles
(cherry picked from commit 212b95f587f4af637fb2429f29f7d0add1bd251f)
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
31a513b461321300bf3a575632663d97292f30c8 06-May-2016 Christopher Wiley <wiley@google.com> Remove unused method from NetworkManagementService

Bug: 28598325
Test: Builds

Change-Id: I6a226b3410cda4e12a9225741ec81cd12b48892f
(cherry picked from commit 2103e78e0cdc5938de479cd857325c537a9fc185)
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
ec38e55b465c67f36e3e83e97cd2713bad7cb218 18-Aug-2016 Erik Kline <ek@google.com> Better error handling when NetworkManagementService#untetherInterface() fails. am: 1f4278a67a am: 121a238408
am: 583db815ea

Change-Id: Ia79fa6238d3100c7a903ed1c39d50dbfd859b98f
1f4278a67a96af3cae66dd9806c3daa776dade0d 16-Aug-2016 Erik Kline <ek@google.com> Better error handling when NetworkManagementService#untetherInterface() fails.

Additionally, catch ServiceSpecificException when making netd binder calls.

Test:
Flipped back and forth between USB and wifi tethering and no longer
some of the unrecoverable errors.

Bug: 30882741
Change-Id: I470b7cfdaaa82013db35b500a5df10dcfaad2d8c
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
212b95f587f4af637fb2429f29f7d0add1bd251f 02-Aug-2016 Christopher Wiley <wiley@google.com> Remove WiFi related methods from NetworkManagementService

These are no longer necessary, since WiFi manages its own details.

Bug: 30041228
Change-Id: Ia3824da43367ae74d3f3a204318cfe5470d74957
Test: Compiles
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
f9b4d50541446df1d0e054ca2e2971647044db94 22-Jul-2016 Erik Kline <ek@google.com> Support removing specific routes from local_network am: 6599ee8b96
am: 51c8fe903b

Change-Id: I02c0805c38e11226bd11b815da5418f1afc1ab89
6599ee8b968bd84039837104a04e01c77fe42f8e 17-Jul-2016 Erik Kline <ek@google.com> Support removing specific routes from local_network

Bug: 9580643
Change-Id: Id0aaf4bc7424797e2beef03fb18a2c1885a86509
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
daa3e9cd80f6290680f0af6ea17dd51720b29a59 18-Jul-2016 Adam Lesinski <adamlesinski@google.com> Merge \\"Record UID of wakeup packets\\" into nyc-mr1-dev am: 117cf8de91
am: d279c1291e

Change-Id: I6973342d48a8a8cebe8f4515c6d67d271dbcf7f7
5f056f6d87b2b9f2abc1b37c5d8530d57c6230cd 15-Jul-2016 Adam Lesinski <adamlesinski@google.com> Record UID of wakeup packets

Bug:28931278
Change-Id: I50a3b6a8026b4d06aaa2730cd531658d280ddb73
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
c179797f8e8cd232d544aa4a037635958255f8c0 06-Jul-2016 Erik Kline <ek@google.com> Merge \\"[net mgmt svc] add method to retrieve INetd reference\\" into nyc-mr1-dev am: 58ef88927d
am: e62b36bb33

Change-Id: Icf35de6a5a0dcc356cce4cf5d183aed647f35cc6
4e37b7044018153bf294a0e9e834681c46c050d7 05-Jul-2016 Erik Kline <ek@google.com> [net mgmt svc] add method to retrieve INetd reference

Bug: 21859053
Bug: 28135208
Change-Id: Idfb5ca65788ae8c7aea91f12d9d461686ad836d6
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
24f7b92a3c95f76fcea0630f29853c8c4e7a022a 19-May-2016 Robin Lee <rgl@google.com> Merge "Lock down networking when waiting for always-on" into nyc-dev am: d171df660e am: 77ab7fc8d4
am: 22e9213a1c

* commit '22e9213a1c903a4eda75fb09603735753a131c05':
Lock down networking when waiting for always-on

Change-Id: I50583a9738ac51378e5f5dcbbaa396f1aa30f97c
d171df660e19bdba4d188beeb8b6023874712413 19-May-2016 Robin Lee <rgl@google.com> Merge "Lock down networking when waiting for always-on" into nyc-dev
17e6183b85ba3038acb935aaa01415058b2e6ddd 09-May-2016 Robin Lee <rgl@google.com> Lock down networking when waiting for always-on

Fix: 26694104
Fix: 27042309
Fix: 28335277
Change-Id: I47a4c9d2b98235195b1356af3dabf7235870e4fa
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
f6f2d202c60cbc571b6c136155ad4e8de5e8f100 18-May-2016 Felipe Leme <felipeal@google.com> Merge "Use batching to set firewall rules." into nyc-dev am: e821f3d032 am: 09e9877dca
am: e151f0519f

* commit 'e151f0519f7440919ce73948922d08db0c7936f0':
Use batching to set firewall rules.

Change-Id: I572d12ef571de9bbb0561dbe31edd3c08988e95d
a701cad320a0a2715cac1c31b269ced2ccbc8ac2 12-May-2016 Felipe Leme <felipeal@google.com> Use batching to set firewall rules.

Netd now provides an option to flush all uids for a given firewall
chain. Using this option is particularly useful when setting the
fw_standby chain, since over time the device will have dozens of idle
apps.

For example, in a Nexus 5X with 45 idle apps, setFirewallUidRules() at
boot was taking 1044ms, and after this change it dropped to just 32ms.

BUG: 26675191
Change-Id: I7016ba646b872f80d0b27a56b867c0b6080d2516
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
558159a5781b9be19c16c0e0aebce84a4fe140ff 14-May-2016 Ruchi Kandoi <kandoiruchi@google.com> Merge "network: Adds the functionality to parse uid in netlink messages." into nyc-dev am: 2512ec9e37 am: b60d0a438a
am: 3bba531ee4

* commit '3bba531ee475be6749553ae884e9bedf63c8e52b':
network: Adds the functionality to parse uid in netlink messages.

Change-Id: Ied6e9a7a24d84f7c8b8264b4e4819b449cd30a2e
fa97fcf7b9b9999102bc0c6b298114375b27a1c3 14-May-2016 Ruchi Kandoi <kandoiruchi@google.com> network: Adds the functionality to parse uid in netlink messages.

Netlink notifications about the state of the modem contains uid too.
This patch adds the functionality to add that. It also fixes the bug to
parse the timestamp in the message even in cases where the length is
greater than expected.

Bug: 28527904
Change-Id: I4643bff3eb5b1ffa2dc0b78f1c6947d60487e0d8
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
a66a3b9be459929619e3fc3d3d92246b6cbe0e3a 09-May-2016 bohu <bohu@google.com> Merge "Ensure Netd Service is alive" into nyc-dev am: d521a6d146 am: 9549841ec4
am: a2ca55ecb6

* commit 'a2ca55ecb64993eee2fc8e720dcceaadd47c6e4a':
Ensure Netd Service is alive

Change-Id: I8c527b272fbed77f3aa7858eadd50e9c72da972d
07cc3bb04081b8ad836f16abb7644a626fc47bae 04-May-2016 bohu <bohu@google.com> Ensure Netd Service is alive

At least on android TV emulator system image, the Netd
service could be null when the setDnsConfigurationForNetwork
is invoked.

bug: 28553503
Change-Id: If059495c8573ede287c4e9d8f343318d519fca7f
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
2103e78e0cdc5938de479cd857325c537a9fc185 06-May-2016 Christopher Wiley <wiley@google.com> Remove unused method from NetworkManagementService

Bug: 28598325
Test: Builds

Change-Id: I6a226b3410cda4e12a9225741ec81cd12b48892f
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
4a992cbde834fdf3770e34b21361b47f4786f65f 02-May-2016 Lorenzo Colitti <lorenzo@google.com> Merge changes I86257bc8,I5c2221c5 into nyc-dev

* changes:
Use Netd's binder interface to set resolver configuration.
Add Gservices settings for resolver configuration.
8e48e67827dd2da40e0b28977a9afca0f43de73d 21-Apr-2016 Pierre Imai <imaipi@google.com> Add Gservices settings for resolver configuration.

BUG: 25731675

Change-Id: I5c2221c5a2478fe2fa0fdf9ceeb13a932d758d33
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
3fef7230d2d4c9e8bd49e52e7f319303f2867177 29-Apr-2016 Lorenzo Colitti <lorenzo@google.com> Address review comments on ag/962875.

Bug: 27824851
Change-Id: I7dd553a926b10faf6e0c2b0e3ed9d8e91b3cccf0
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
4cb4240b4d404f8b2d444a725abd53d43ad06bc7 23-Apr-2016 Lorenzo Colitti <lorenzo@google.com> Close open sockets when enabling firewall rules.

When enabling a firewall rule that will deny networking to apps,
first close any sockets opened by those apps. Just dropping an
app's packets without closing its connections has the following
problems:

1. The app has no way to know this has happened until a network
timeout occurs.
2. The app's connections stay open, so the other end of the
connection (e.g., a server) might continue to retransmit
packets. These packets will wake up the kernel and cause
battery drain, but we cannot respond to them because packets
on those connections are dropped by the kernel (since the app
is blackholed). So the other end might keep retransmitting.
3. Even though we think the connections are still open, the
other end of the connection, or any intermediate NATs or
firewalls, might time out and close the connection (e.g., by
sending a RST). Because the app is blackholed, we have no way
of knowing that this has happened, so when the app is granted
network access again, these connections might just get stuck.

Bug: 27824851
Bug: 27867653
Change-Id: Iaaad1b26954fc5f1ba5c9ed8bdee039282f5e249
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
efdb8454275954e54bd11a59d450cbac30c13da4 21-Apr-2016 Rebecca Silberstein <silberst@google.com> NativeDaemonConnector: add waitForCallbacks method

Add a method that allows callers to wait until all unsolicited
responses received from the native daemon during a command are
processed.

When commands are issued to a native daemon (such as netd) through the
NativeDaemonConnector we block until the command response is received.
Any responses or events that are a side-effect (considered
"unsolicited") of the command are placed in a Message and handled as
callbacks. The order of their processing is not guaranteed and, as we
have seen from bugreports, can be handled several seconds
later - causing the SoftAP that was just set up to be torn down
because a late interface down/removed is indistinguishable from a
new interface down/removed.

This CL adds a method that first checks to make sure callback thread
is not the same thread as used for the blocking call. The new
waitForCallbacks method uses a CountDownLatch to force the calling
thread to wait until all unsolicited responses received from the
native daemon during the execution of the command are handled.

The wifiFirmwareReload method is also updated to use the new
waitForCallbacks method.

BUG: 27857665
Change-Id: I3e22978f720b1cbf57fbb64ad4fea73f8c2d408a
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
e2ec94fbab91e5da515617adb2d0532f7b52727f 24-Mar-2016 Rebecca Silberstein <silberst@google.com> Add error logging for softap commands

Log response code and message for softap commands to netd in failure
cases.

This CL adds a general function that logs an error if the executed
command does not return the expected response code or response message.
This function is general and can be used for commands other than softap.

BUG: 27834948
Change-Id: I88a5f78ccd5fc8d15af9726f2f59df0c27d49a4f
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
94887874e385797ac5290e867fe412b9d6fc2f9c 05-Apr-2016 Erik Kline <ek@google.com> Don't flush DNS cache on route changes.

Since Lollipop, routes are isolated within Networks. Flushing a
Network's DNS cache whenever that same Network's routes are updated
doesn't provide any benefit. Any system components depending on this
behaviour need to uncovered and fixed.

Additionally, clean up no-longer-used flushNetworkDnsCache(). This
should be replaced, when needed, by a proper binder interface to netd.

Change-Id: I34bf79e4839da014d466058a876d754209d0c007
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
771d0c2be4c6a38e7d99beda03b7618d7188eac4 25-Mar-2016 Felipe Leme <felipeal@google.com> Merge "Refactored NetworkManagerService to support Data Saver." into nyc-dev
65be3025fd07d53137f5434794d1d1b3a0933aab 22-Mar-2016 Felipe Leme <felipeal@google.com> Refactored NetworkManagerService to support Data Saver.

Netd provides 2 bandwidth control rules to restrict which uids can use
metered networks:

- bw_penalty_box is a blacklist-based firewall chain used to determine
which uids do not have access to metered interfaces.

- bw_happy_box is whitelist-based firewall chain used to determine which
uids have access to metered interfaces.

Currently, both NetworkManagerService (NMS) and
NetworkPolicyManagerService (NPMS) uses just the bw_penalty_box rule,
which makes turning Data Saver mode on / off too slow (since NPMS needs
to build the bw_penalty_box on demand); this CL adds support for both
rules on NMS, although NPMS doesn't take advantage of it yet (it will be
refactored in a separate CL).

BUG: 27127112
BUG: 26685616
Change-Id: Ib954574f7c86269fc9b4cf8ce4ba72ba5878c23d
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
9eb844e6643d94d580d3f16f74d51dd07ceb0696 23-Mar-2016 Lorenzo Colitti <lorenzo@google.com> Remove duplicated code to push firewall UID rules.

The code to set up firewall, standby, dozable, and powersave UID
chains is identical. Deduplicate it.

Bug: 26685616
Change-Id: If623fff14b9dad801510a6f8d5e2edd6031bc3f7
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
bf4a6574b17efd9d7ad6623f61a3c608b1664055 22-Mar-2016 Lorenzo Colitti <lorenzo@google.com> Delete dead code.

Change-Id: If8052efaa00f15e5c7eb038435be33206d54276a
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
58967baff37a139af3f34ddbdf249e47ab9c7391 02-Feb-2016 Lorenzo Colitti <lorenzo@google.com> Use native netd binder interface in NetworkManagementService.

Bug: 27239233
Change-Id: Idf0cfee82ec5007fde0237d944ab0c2b53ff4a7b
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
3ce000e647da42c0f39b70dceabbaa52b8ef5ca3 04-Mar-2016 Felipe Leme <felipeal@google.com> Merge "Code cleanup on NMPS and NMS." into nyc-dev
03e689db51284d37145b8af2e750d6bbd22312b2 03-Mar-2016 Felipe Leme <felipeal@google.com> Code cleanup on NMPS and NMS.

- Always check for DBG before using Slog.d.
- Logs duration of NMS.systemReady() when debugging.
- Logs duration of NMPS.updateRulesForGlobalChangeLocked() when debugging.
- Removed redundant toString() calls.
- Catch multiple exceptions.
- Replaced enhanced for on nested Iterable iterations.

BUG: 21725996
Change-Id: Ia775a394b59de7a0570ad4954d1fe3a2698c66d6
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
011b98f93a4e0f609f9f3a83be784021c8b593a6 11-Feb-2016 Felipe Leme <felipeal@google.com> Created a firewall chain for power save mode.

When power-save mode was first implemented, there were no firewall rules
on netd, so the solution was to make all network interface metered and
re-use the bw_penalty_box chain.

This change removes that workaround by creating a explicit fw_powersave
chain, whose behavior is similar to fw_dozable (in fact, it reuses some
of its code); such change not only makes network restrictions on
power-save mode simpler, but it also allows to optimze how the restrict
network rules are changed (which will be done in a separate change).

BUG: 27127112
BUG: 26685616
Change-Id: I7f7a7b1c1855e916c6651ad90da29fe187a7bea2
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
47585ba14352d20f8e8633f5409f1fe954cc8511 10-Feb-2016 Felipe Leme <felipeal@google.com> Optimized add|removeRestrictBackgroundWhitelistedUid().

The initial implementation of these methods was calling
updateRulesForGlobalChangeLocked(), which is expensive.

The new implementation is optimized by:

- quitting earlier if there is no change
- only calling setUidNetworkRules
- only broadcasting a ACTION_RESTRICT_BACKGROUND_CHANGED it the status
of the app changed.

This change also removed the unnecessary onPackageRemovedAllUsers()
callback (just onPackageRemoved() is enough).

BUG: 26685616

Change-Id: If38b8b870e992c48e40b4362e8170c64ff8b2a9d
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
8216236175c74c4d93e28eb06314b7b22b12df15 21-Jan-2016 Nathan Harold <nharold@google.com> Remove Data RealTime Info Listener Support

-Remove Listener from the NetworkManagementService
-Remove the callback capability from TelephonyRegistry
-Remove the callback capbility from PhoneStateListener

Because of intractable problems with power consumption and
consistency, this signal is removed and should not be used.

Bug: 23319188

Change-Id: I99383075bbd5604cc801deab6de94ac97fc17bfd
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
9180e2ea5916d43caf998d0fa7bf7ac70c575c4e 05-Aug-2015 Paul Jensen <pauljensen@google.com> am abd27102: am 41779e46: am 95297732: am 86e7d135: resolved conflicts for merge of dbc4edcc to mnc-dr-dev

* commit 'abd27102f4e232be448bc6012e0bd833637ab3fa':
Fix NOT_RESTRICTED network capability and enforce it.
487ffe7d3d84bf65212158f7098e8a84b5b55e09 24-Jul-2015 Paul Jensen <pauljensen@google.com> Fix NOT_RESTRICTED network capability and enforce it.

With this change:
1. NOT_RESTRICTED should be removed from NetworkRequests that bring up
special restricted carrier networks (e.g. IMS, FOTA).
2. NetworkRequests without NOT_RESTRICTED require CONNECTIVITY_INTERNAL
permission to register
3. Binding sockets to networks without NOT_RESTRICTED requires
CONNECTIVITY_INTERNAL permission

Bug:21637535
Change-Id: I5991d39facaa6b690e969fe15dcbeec52e918321
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
896b49ad02b20cf0723241f1f28dd9bee43f2b99 29-Jul-2015 Xiaohui Chen <xiaohuic@google.com> ignore initial request to disable iptable chain

iptable child chains are disabled by default. Ignore the initial
request so netd won't throw errors when it cannot detach chains that
does not exist.

Bug: 22800189
Change-Id: I9312dd558ba6d59dc6aa394afeb66a222daafcf9
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
593e8da3df2cab19b6b6dab041322e2e7002b64b 29-Jun-2015 Ravi Joshi <ravij@codeaurora.org> wifi: Fix softAP turn-ON issue in statically loaded driver

SoftAP fails to turn-ON on some statically loaded driver
models in which the network interfaces are not available
until the firmware is reloaded in the AP mode. This change
provides the fix to load the firmware earlier in the softAP
start sequence to make wlan0 interface available.

b/22236507

Change-Id: If2c4b28c704bc6e5acb2be70d5d9d84d6e98f747
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
8dca36dc8a5d17315775ce216689addc5bd9be00 19-Jun-2015 Xiaohui Chen <xiaohuic@google.com> system_server: optimize app idle parole state change

Currently when app idle parole state changes, all idle apps' states
are updated one by one including firewall modifications which are
very expensive. This optimization gets rid of individual firewall
rule changes and makes sure we only modify the firewall once at child
chain level.

BUG: 21446713
Change-Id: Iafc415fe0bc127826fe17894d4fedcf1755cb17d
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
b41c9f7f39939cee8d226eb5e506c3f0573f44f5 18-Jun-2015 Xiaohui Chen <xiaohuic@google.com> system_server: add two child chains to firewall

This is an attempt to speed up getting out of device idle. It groups
uid firewall rules in these child chains so we can attach/detach a whole
chain instead of individual uid rules.

BUG:21446713
Change-Id: Ie8f392da2deabe7cc86a9ecf4ed080163861d41e
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
06400475c732dc00bcb2be6560ba454cdc925ced 05-Jun-2015 Lorenzo Colitti <lorenzo@google.com> Delete code that checks for the simulator, it's long gone.

Exhibit A: http://b/5010576

Bug: 19316303
Change-Id: I093e4320f12459adaa51c6a14350e7a60e02937d
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
15e47235c055495ec0ccc24768a6746a960d3a61 25-Apr-2015 Amith Yamasani <yamasani@google.com> Remove network access for idle apps

Track apps going in and out of idle in the NetworkPolicyManagerService.
Apply DROP rules in firewall controller if app is to be blacklisted
for network access.

Firewall can now be in whitelist (old) or blacklist mode. When in
blacklist, it allows all by default and we can selectively DENY
some uids.

Track app idle in UsageStats and update periodically.
Track charging/discharging states.

TODO: Check for appidle temporary parole state

Bug: 20066058
Change-Id: Ia65d7544204b3bcb78a517310ef4adcc05aac6fb
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
e08af19fcc7b13d526f3dfd24d58300947cf1146 26-Mar-2015 Adam Lesinski <adamlesinski@google.com> Adding per UID WiFi power distribution.

Change-Id: I88c539074607d7261f6c5cf1dbae47c3cf53f253
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
e9b9b73ab598a912de04fbd5501bca5924ce8f71 07-Apr-2015 Bart Sears <bsears@google.com> Revert "Adding per UID WiFi power distribution."

This CL is breaking the clockwork settings app in master. Reverting
until Adam has a chance to investigate.

This reverts commit b943fabfc8ddb581dc2fd7288f87428dcb5d27b7.

Change-Id: Ieb11423c11cf9874a6175dce49843d0e1080c590
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
b943fabfc8ddb581dc2fd7288f87428dcb5d27b7 26-Mar-2015 Adam Lesinski <adamlesinski@google.com> Adding per UID WiFi power distribution.

Change-Id: Ia3d97e0a1c3352127185c18626d8ba8221c9ab40
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
f5fabf1542624005a0e978045bdd117a62ab2593 15-Mar-2015 Vinit Deshpande <vinitd@google.com> am "Separate NAT from forwarding."

merged from goog/mirror-m-wireless-internal-release
35e36db Separate NAT from forwarding.
3912479de9eaa8901137dc78473548c4a5a1bfff 15-Mar-2015 Vinit Deshpande <vinitd@google.com> am "Append forwarder name to ipfwd command"

merged from goog/mirror-m-wireless-internal-release
f3d4a58 Append forwarder name to ipfwd command
a86f0741c794ffb00490320220219b864a5f90e3 15-Mar-2015 Vinit Deshpande <vinitd@google.com> am "get channel list from driver for SoftAP channel selection"

merged from goog/mirror-m-wireless-internal-release
18ae1d2 get channel list from driver for SoftAP channel selection
b35f4efe159829852ea4a4b58b21448b306c37d9 15-Mar-2015 Vinit Deshpande <vinitd@google.com> am "set softAP on a specified band, including both 2.4 and 5 GHz band"

merged from goog/mirror-m-wireless-internal-release
a0be0fb set softAP on a specified band, including both 2.4 and 5 GHz band

Change-Id: I8f2514dfc35fafddc52d9244a093f2924697b748
35e36db1d726f5741e7d8d83d2556e1417642be9 25-Feb-2015 Lorenzo Colitti <lorenzo@google.com> Separate NAT from forwarding.

Bug: 19500693
Change-Id: I39878644e21d51def1c31d1857e815f473ef0938
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
f3d4a58519d6bf8e74ac035aeb845bff6dc12aa4 24-Feb-2015 Nilesh Poddar <npoddar@quicinc.com> Append forwarder name to ipfwd command

Pass the name of entity that is requesting to enable/disable
ip forwarding

Change-Id: Iaf04768a23c417eb7d40af776c6fc76efaa67bb7
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
18ae1d22077e1cd8ed71b1e74d14a3a2c4e50a62 05-Feb-2015 xinhe <xinhe@google.com> get channel list from driver for SoftAP channel selection

Instead of hard coding the available channel list, we should
get channel list from driver

Bug:19237543
Change-Id: Id2ec689273407f54709cb034d6ba666f91da51c0
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
a0be0fb2709124a567f89114b1d8e80f74452edc 08-Jan-2015 xinhe <xinhe@google.com> set softAP on a specified band, including both 2.4 and 5 GHz band

Bug:18929692
Change-Id: I6109b477937b0ecab95f5a2b414f2bec9b30e1cd
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
c2ae6fb9ada52e9c990542a6d1cae80085318f31 16-Jan-2015 Jeff Sharkey <jsharkey@android.com> Merge commit '605eb79c9519307147fc1795d0eb155638a7f542' into manualmerge

Change-Id: Id6db8cce3a477572478a1d50f624823200848896
605eb79c9519307147fc1795d0eb155638a7f542 04-Nov-2014 Jeff Sharkey <jsharkey@android.com> Offer to detect non-SSL/TLS network traffic.

Introduces new module that provides network-related features for
the StrictMode developer API. The first feature offers to detect
sockets sending data not wrapped inside a layer of SSL/TLS
encryption.

When a developer enables, we ask netd to watch all outgoing traffic
from our UID, and penalize us accordingly if cleartext sockets are
detected. When enabled, netd captures the offending packet and
passes it back to the owning process to aid investigations. When
death penalty is requested, all future traffic on the socket is
blocked, which usually results in a useful stacktrace before the
app is actually killed.

Bug: 18335678
Change-Id: I3adbc974efd8d3766b4b1a23257563bb82d53c29
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
829dfa7cd80faa61b3f63c455f81411571144f82 28-Nov-2014 Lorenzo Colitti <lorenzo@google.com> Only use mDefaultDns if the network claims to offer Internet

Currently, if a network does not specify DNS servers, we default
it to using 8.8.8.8. This was done because the emulator did not
specify DNS servers. However, it causes queries to fail slowly,
instead of failing fast, on networks that do not have
connectivity to 8.8.8.8.

Bug: 18327075
Change-Id: I0df13ff4a17ee65e640be96695a3af31b020963a
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
d09c4cad65c708f2c4810d24295456708a2000d2 22-Nov-2014 Wink Saville <wink@google.com> Additional changes to SubscriptionManager API as per API council.

bug: 17575308
Change-Id: Idd98aa46c15a9219ccf28091c62602ac8bf16c62
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
2d1ee982276f5dbd0e035778b731b48e4ef34515 20-Nov-2014 Wink Saville <wink@google.com> Revert "Additional changes to SubscriptionManager API as per API council."

This reverts commit baf21da1e17ef358632c078128d381b3be218a08.

Change-Id: I73cbdfadf07ca3cf20b042781b62aafcc72b17d6
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
baf21da1e17ef358632c078128d381b3be218a08 20-Nov-2014 Wink Saville <wink@google.com> Additional changes to SubscriptionManager API as per API council.

bug: 17575308
Change-Id: I7773965094510999bfce8fc6b2b31ba6ce496653
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
e21a26b3ba78b0238f4ed4a09b43319a2320fbaa 28-Oct-2014 Lorenzo Colitti <lorenzo@google.com> Add support for running 464xlat on wifi as well.

1. Add a command to NetworkManagementService to enable/disable
IPv6 ND offload via netd.
2. Make Nat464Xlat enable offload if clatd successfully comes up
on a wifi network (which means it detected a NAT64), and
correspondingly re-enable offload when the clatd interface
goes down.

This change does not enable clatd on wifi yet, that requires an
extra 2 lines to enable it.

Bug: 12111730
Change-Id: I4318611762a37487c9a84f8c4867ec5aece98be8
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
954394653dad05838235f48244a4320893e0f0cf 09-Oct-2014 Lorenzo Colitti <lorenzo@google.com> Support more than one clatd at a time.

1. Make Nat464Xlat a per-network object, one for every network
requiring clat, instead of a ConnectivityService singleton.
2. Make the NetworkManagementService clatd commands take an
interface.
3. When we attempt to start clatd on a network, store its
Nat464Xlat object in the NetworkAgentInfo, so we have an
authoritative way of knowing whether clat is running on a
given network.
4. Rework Nat464Xlat, hopefully simplifying it.

Bug: 12111730
Change-Id: I1fa5508ef020cd1c3d1c7a1f7b06370ac5fc2ae2
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
e4a05afe85f15472325db9c535ef81f409fb6070 24-Sep-2014 Sreeram Ramachandran <sreeram@google.com> Send app permissions to netd.

Based largely off Robert's http://ag/546170 (thanks!)

Bug: 15413737
Change-Id: I8a1f0a184923c4c0a4935e6b88895bcc05e39f02
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
60446165d8bd44f72cec8d0c5583a688369fa660 19-Sep-2014 Lorenzo Colitti <lorenzo@google.com> Block address families with routes, not NetworkAgent side channel

Now that we support unreachable routes, use those to block
address families on VPNs. This is a much more elegant solution.
Also update LinkProperties when IP addresses are added and
removed, fixing a TODO.

Bug: 17462989
Change-Id: Ib749d84710dca70d672350b9f129bb91419ec77e
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
4b0f8e6fb707e19799011c1f4a5e4f54603e34b1 18-Sep-2014 Lorenzo Colitti <lorenzo@google.com> Support non-unicast route types: unreachable and throw.

Bug: 17462989
Change-Id: I8635472ca3e96ec2866af2de48e6260ab2da13fb
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
b57edc5ae999abd9c7310833f4f10bbacbc469d7 23-Aug-2014 Lorenzo Colitti <lorenzo@google.com> Pass the socket mark for DNS queries to dnsmasq.

This makes tethered clients use the correct DNS servers when
tethering to non-default networks like the DUN APN.

Bug: 16357676
Change-Id: I8933b6de198a92c2aaf0291931ace8966ddba275
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
b69a3a8eaade042aa5b4d17f9b0dfd565c2e4a97 06-Aug-2014 Paul Jensen <pauljensen@google.com> Revert DNS cache flush command deletion from "Cleanup: Delete dead code."

This reverts part of commit 7a161c535104555890fa78b99faf1f414fc03e85.
The DNS cache flushing code needs to be called when routes change.

Change-Id: I20d39eabfa088deeeeeff0c3292b1910fd948b0d
bug:16549455
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
42065ac64cba166dc0fe602957ea8fe80bf406e2 27-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Prohibit address families by default unless a VPN explicitly allows them.

Bug: 15972465
Change-Id: I3278d94536fefacc86390c1ba4231680f7be8589
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
8cd33ed84e94036a5e1201485af7603dc6fb0d9b 24-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Implement support for bypassable VPNs.

Bypassable VPNs grab all traffic by default (just like secure VPNs), but:
+ They allow all apps to choose other networks using the multinetwork APIs.
If these other networks are insecure ("untrusted"), they will enforce that the
app holds the necessary permissions, such as CHANGE_NETWORK_STATE.
+ They support consistent routing. If an app has an existing connection over
some other network when the bypassable VPN comes up, it's not interrupted.

Bug: 15347374
Change-Id: Iaee9c6f6fa8103215738570d2b65d3fcf10343f3
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
03666c705ddabe0e7c5869ab69c2ca8b964164e9 20-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Cleanup: Delete dead code.

Bug: 15413389
Change-Id: I315468832ef18ffc84174e54774ab63b86d284dc
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
a77760d74ad544bbd4f6310fd28b395f24c5467d 18-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Fix WiFi-Direct.

Add a new command to let netd know about routes on a p2p interface.

Bug: 15413694

Change-Id: I36effc438d5ac193a77174493bf196cb68a5b97a
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
06b6cdaed5c68816faac9d2354c6caf61e65e19d 12-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Remove unnecessary code and APIs.

This stuff has been replaced by setNetworkForUser() in NetdClient.

Change-Id: If525ee259b74314191d1913f7c2a3e828e05c38f
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
31ab41726b84c31a6aa45c929aad4ad04d32a992 12-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Delete unused APIs in NetworkManagementService.

Change-Id: Idc6c0ac0d3a4149821fc7820b7f37d4209fc55d3
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
6bc2c2c34f2b23eae79ad733c97a691734055c4f 07-May-2014 Paul Jensen <pauljensen@google.com> Convert Vpn from NetworkStateTracker to NetworkAgent.

This eliminates the need for the ConnectivityService.VpnCallback class.
This requires shifting VPNs to the new "network" netd API.
VpnService.protect() is modified to no longer go through ConnectivityService.
NetworkCapabilities is extended to add a transport type for VPNs and a
capability requiring a non-VPN (so the default NetworkRequest isn't satisfied
by a VPN).

bug:15409918
Change-Id: Ic4498f1961582208add6f375ad16ce376ee9eb95
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
67e0789cd3870af2fbbdefbff28f6fde9095a015 19-Jun-2014 Wink Saville <wink@google.com> Mobile_radio in battery history is not accurate

Invoke TelephonyManager#listen to connect mPhoneStateListener to receive
the notifications.

Bug: 15568103
Change-Id: I5a3fa6347704e96ceb34289f74ba6e3157bbb333
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
c18cbfdf8d40e7a526a088225cb32341e1ea0920 13-Jun-2014 Lorenzo Colitti <lorenzo@google.com> Notify network observers of route changes.

Bug: 9180552
Change-Id: If8432bc74335676320b815784b21f404d3479c35
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
fb40dd4d00bd3361b2535bc866e6c21eadc52558 13-Jun-2014 Wink Saville <wink@google.com> Merge kwd to master

Add initial IMS and MSIM support from klp-wireless-dev-mirror

Change-Id: Idb607c0aa32f80fe4fe1539aedea7a221e9e7f04
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
7dc78cf3af9fd11a4f1e2e981ce584a23755ea9e 09-Jun-2014 Lorenzo Colitti <lorenzo@google.com> Minor changes to the LinkAddress API docs.

1. Rename getNetworkPrefixLength to getPrefixLength. Update all
callers in frameworks/base and add a shim method and a TODO
for the rest.
2. @hide isSameAddressAs. It doesn't add much, and it's just
one-liner that callers can implement if they want.
3. Fix the alignment of the initial paragraph (<ul> should have
been </ul>).
4. Remove the documentation that talks about creating
LinkAddresses, since there's no public API for creating them.

With these changes I think LinkAddress is fine as a public API.

Bug: 15142362
Change-Id: Iaf3b1db577745bb68a9e1dd7f96d666dd3f3ec7c
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
cc91c7b804a079f7b20404827277c61dd403805f 04-Jun-2014 Sreeram Ramachandran <sreeram@google.com> Add a new IpPrefix class and use it in RouteInfo.

This change uses IpPrefix only in the public API and continues
to use LinkAddress for everything else. It does not change the
callers to use the new APIs, with the exception of changing
all current uses of getDestination to getDestinationLinkAddress
to make room for the new getDestination method that returns an
IpPrefix.

Based on Sreeram's earlier change:
https://googleplex-android-review.git.corp.google.com/#/c/477874/
but a bit simplified and with a bit more documentation.

Bug: 15142362
Bug: 13885501
Change-Id: Ib4cd96b22cbff4ea31bb26a7853989f50da8de4e
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
1fbcb2719828f16aec8b2d742a20b98e4a2cf17c 23-May-2014 Sreeram Ramachandran <sreeram@google.com> Support legacy routes added by apps via ensureRouteToHost().

Change-Id: I0ee1ca89fdc859d75a89021ca8c1902811b1e4a9
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
2d4b4ed681efcfb64c4d2b4d2a2d236aae1dc7ee 22-May-2014 Dianne Hackborn <hackbod@google.com> Battery monitoring fixes:

- Improve monitoring of level changes to not be confused
when it goes up while draining or down while charging.
- Put back in connectivity service code to tell battery
stats about the interfaces.
- Turn back on reporting of mobile radio active state
from the RIL.
- Fix bug in marshalling/unmarshalling that would cause
the UI to show bad data.

Change-Id: I733ef52702894cca81a0813eccdfc1023e546fce
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
992f25257938ecc0378514f21c6e6e6375272976 28-Apr-2014 Paul Jensen <pauljensen@google.com> Separate network and interface addition/removal netd APIs.
This should facilitate stacked interfaces (i.e. clatd).

Change-Id: Ib3e7a4d3847ef6ec4449451f6da42e75959baa4f
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
b2829fa165124264c7ec06a6e23b08a1d97b99e5 16-Apr-2014 Sreeram Ramachandran <sreeram@google.com> Specify netId when adding/removing routes.

Change-Id: I07fd950aee726e9721153f75c3e4c10d8e19d8e9
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
f047f2a8f49cd06d9cb94238861f4acce937d87b 16-Apr-2014 Sreeram Ramachandran <sreeram@google.com> Update netd API.

Remove:
- resetOldSockets from setDefaultNetId: netd takes care of this automatically.
- {add,remove}DnsServersForNetId: equivalent to "resolver setnetdns".

Change-Id: I819a8be216d07cf9a8c05f51745b64658027ed02
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
13e817df516a803fbedeacca2c802a9fc1c1370f 10-Apr-2014 Paul Jensen <pauljensen@google.com> Use NetId instead of interface name when communicating DNS changes to netd.

Change-Id: Ic82b73de6f50d39d56c5e1a32f5b1f3ebb80bb7d
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
e4bde7d475135252cfa799d337ebbb029ebaf937 11-Apr-2014 Sreeram Ramachandran <sreeram@google.com> Update the API for permission set/clear.

Change-Id: I1d10a5702a77cb24fa52016bb497d52270379f8a
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
913c895216c0cb248ed0ce910e69dd84b285c064 08-Apr-2014 Robert Greenwalt <rgreenwalt@google.com> Update netd interface

Adding netId for route changes

bug:13732575
Change-Id: Id171412a0f580f71398c9b0b8742acb1f3ef5a1e
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
568891d9282383747c418a59ee714281726f390a 04-Apr-2014 Robert Greenwalt <rgreenwalt@google.com> Add multinetwork netd calls

bug:13732575
Change-Id: I7f030bd63971ff71d32a221e50318c781e7f2370
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
9ba9c58e4a249456794fbfb9989f27bd846d067e 20-Mar-2014 Robert Greenwalt <rgreenwalt@google.com> First pass on multinetwork framework

Starting to switch netd to use NetId.
Adding the Network identifying class

bug:13550136
Change-Id: Ie0db4fb17c9300bfafb63329adfa02339911b33d
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
2ffa11e4b71c545e34533ef827bdc1a07fbe8246 22-Apr-2014 Dianne Hackborn <hackbod@google.com> Start collecting mobile radio activity from the radio.

Hook in to the new radio API to find out when the radio
is active and use that to track its state in batter stats.
We also still have the data being tracked from the kernel's
emulation, and continue to use that if we don't get data from
the radio.

Currently this monitoring is turned off until some issues
in the radio can be fixed that are providing bad data.

Also add a new API to get estimated drain and charge times.

Change-Id: Ifc4900fabb8f848f9cda361dce698664ea75f175
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
2c9f5475beabcc1c71d88b7c88d6029c3245be65 21-Apr-2014 Robert Greenwalt <rgreenwalt@google.com> Make sure events handled on same looper

Two handlers are used to call a function, but the init was not forcing them on the
same looper/thread, so we could get synchronization problems as a result.

Moved to a single looper.

Also added finally clauses to clean up if a broadcast throws an uncaught exception.

bug:13399768
Change-Id: I0044e2442335ee45a15588f910064e848cf6ac55
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
43111e897be9f79ababb0ecf99f155695416d956 24-Mar-2014 Dianne Hackborn <hackbod@google.com> Merge "Battery stats: wake locks, radio active, cleanup."
4590e52f3d0558e01322fe4dd55bb612afdfb079 24-Mar-2014 Dianne Hackborn <hackbod@google.com> Battery stats: wake locks, radio active, cleanup.

- Improve wake lock work source updates to also update the current
history tag, in case the new work source gets recorded in the
history.

- Fix bug in recording radio active time that was not distributing
any time to apps.

- No longer hold a wake lock while dispatching data conn active call,
since it comes with its own timestamp.

- Fix issue where the top app was not being cleared while the screen
was off.

- Remove obsolete STATS_LAST stats type.

- Fix bug that was not clearing the total run time when resetting
the stats.

Change-Id: Iabe17a9edf34f762374ae09fcffb8a819cf72e30
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
ff3bb2fe95a7d0158f5a456368eb7fa91069bc23 24-Mar-2014 Chad Brubaker <cbrubaker@google.com> am 7f623d6b: am 9506e84b: am c7726147: am 1fce89d9: am de4e7b49: Merge "Include the interface for clearDnsInterfaceForUidRange" into klp-dev

* commit '7f623d6b9459bc982c49f0a74aa2c9911f8e1dd8':
Include the interface for clearDnsInterfaceForUidRange
a1bd79268be693f04f4adee90673d6ed400cc9fd 21-Mar-2014 Dianne Hackborn <hackbod@google.com> Battery stats: track actually running time

Use the uptime while creating the battery stats history to
generate a new event indicating when the CPU is actually running.
We can do this in combination with the new event reporting when
the CPU comes awake, looking at the difference between the
uptime and elapsed time at that point to determine when it last
when to sleep.

Also use this information to generate a new set of aggregated
states, the uptime caused by each wake reason.

Finally use new radio down timestamp to adjust the times we
compute for radio use. Note that this information is not (yet)
being used to adjust how these are recorded in the history.

Change-Id: I723b3b526c8e7d64de0cac9d1193e04132d5a3e4
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
9506e84b6f1b8a63abd5c7ecd580548386cc9aae 21-Mar-2014 Chad Brubaker <cbrubaker@google.com> am c7726147: am 1fce89d9: am de4e7b49: Merge "Include the interface for clearDnsInterfaceForUidRange" into klp-dev

* commit 'c77261471432e1577586395dd0a6a481ef7431b5':
Include the interface for clearDnsInterfaceForUidRange
c77261471432e1577586395dd0a6a481ef7431b5 21-Mar-2014 Chad Brubaker <cbrubaker@google.com> am 1fce89d9: am de4e7b49: Merge "Include the interface for clearDnsInterfaceForUidRange" into klp-dev

* commit '1fce89d946760a1bcf3a733f55494f963eab00c2':
Include the interface for clearDnsInterfaceForUidRange
0535a9f7aa5d0f875b06845e9af5f6dbfc5c8a19 13-Mar-2014 Ashish Sharma <ashishsharma@google.com> Include elapsed realtime (nanos) of the event in the radio state change notifications.

Bug: 13247811
Change-Id: I3454aa159a68b9087b4762df947b41965b5a3941
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
77b987f1a1bb6028a871de01065b94c4cfff0b5c 27-Feb-2014 Dianne Hackborn <hackbod@google.com> Hold a wake lock while dispatching network activity events.

Also add new API for determining whether the current data network
is active, and thus better scheduling network operations. This
API is designed to not be tied to a mobile network -- regardless
of the network, apps can use it to determine whether they should
initiate activity or wait. On non-mobile networks, it simply always
reports as the network being active.

This changed involved reworking how the idle timers are done so
that we only register an idle timer with the current default
network. This way, we can know whether we currently expect to
get callbacks about the network being active, or should just always
report that it is active. (Ultimately we need to be getting this
radio active data from the radio itself.)

Change-Id: Iaf6cc91a960d7542a70b72f87a7db26d12c4ea8e
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
d0c5b9abed60b7bc056d026bf0f2b2235410fb70 22-Feb-2014 Dianne Hackborn <hackbod@google.com> Improve how battery stats collects network stats.

This optimizes the path for battery stats to collect
per-uid network usage. It now collects wifi and mobile
usage separately, with a path that allows it to recycle
all data structures and filter out stats it isn't
interested in before they come back to java.

This is setting us up for the actual goal, to collect
mobile stats independently each time the mobile radio
goes down, allowing us to distribute mobile radio usage
across uids based on the number of packets they transferred
during a session.

Change-Id: I21a0f517cf087ea5aa8b8dd535e20b46e361a52b
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
d3b21393bfdd9adb6d5936f1f6c04b7c410261de 18-Feb-2014 Jeff Sharkey <jsharkey@android.com> am fef3dd01: am 41185c84: am df47ecaa: am 02a64dae: Merge "Tethering: Skip link local addresses when enabling NAT"

* commit 'fef3dd01fbad923bf7ff509f4ee95312fd7cb4db':
Tethering: Skip link local addresses when enabling NAT
41185c844fa7986ff3e5daa4c11288f6bed1463b 18-Feb-2014 Jeff Sharkey <jsharkey@android.com> am df47ecaa: am 02a64dae: Merge "Tethering: Skip link local addresses when enabling NAT"

* commit 'df47ecaa0973b80c9b97ef9ed3ad7abcfef361c7':
Tethering: Skip link local addresses when enabling NAT
e13c4c0b664dabdc069ca8f9601d96a337eb02f9 12-Feb-2014 Dianne Hackborn <hackbod@google.com> Start tracking radio up time.

We now always turn on network state tracking for mobile,
and push this information down to battery stats.

In battery stats we use this to both log the changes in
the history and keep track of the total time the mobile
radio was active.

Power computation is switched over to using this information
to help determine power use, which will hopefully make it
more accurate (not counting inaccuracies in knowing when it
actually goes down).

Note yet done is aggregating this data per-uid, to better
emphasize which apps are causing the radio to be up. Right
now we just spread the total time across all uids weighted
by the total number of packets they have sent and received.

Also put in the battery stats infrastructure for bluetooth to
address issue #12973036: Improve power_profile.xml

Change-Id: I39d11b7ff6ae4f336f253d1cba308d8569de7e0d
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
9158825f9c41869689d6b1786d7c7aa8bdd524ce 22-Nov-2013 Amith Yamasani <yamasani@google.com> Move some system services to separate directories

Refactored the directory structure so that services can be optionally
excluded. This is step 1. Will be followed by another change that makes
it possible to remove services from the build.

Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
/frameworks/base/services/core/java/com/android/server/NetworkManagementService.java