Commit Graph

154 Commits

Author SHA1 Message Date
Jeff Sharkey
21062e7c7e Map network identity using ConnectivityService.
Instead of deriving network identity based on raw subsystem broadcasts,
listen for updates from ConnectivityService.  Added atomic view of all
active NetworkState, and build map from "iface" to NetworkIdentity set
for stats tracking.

To avoid exposing internal complexity, INetworkStatsService calls use
general templates.  Added TelephonyManager mapping to classify network
types using broad labels like "3G" or "4G", used to drive templates.

Cleaned up Objects and Preconditions.

Change-Id: I1d4c1403f0503bc3635a59bb378841ba42239a91
2011-06-07 23:09:25 -07:00
Robert Greenwalt
f17deff97b resolved conflicts for merge of 8de47a2f to honeycomb-LTE
Change-Id: I8193235a4c7e574635e17b2eb05bb5420a3c6749
2011-06-07 12:45:41 -07:00
Jeff Sharkey
d26449fd76 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
2011-06-01 17:44:52 -07:00
Jeff Sharkey
921ebf2ee5 Policy and rules work for ConnectivityManager.
Teach ConnectivityManager about UID-specific rules derived from policy,
such as rejecting network traffic on "paid" interfaces.  Calls that
return NetworkInfo now filter based on any REJECT rules in effect for
the calling UID.  (Added uid parameter if callers that still want all
interfaces.)

Changed NetworkPolicyManager to derive rules based on current policy
combined with PowerManager and ActivityManager status, which it passes
to ConnectivityService for eventual enforcement through netd.  When
rules change the usability of a NetworkInfo for a specific UID, it also
dispatches CONNECTIVITY_ACTION broadcasts to that UID.  Combined paid
and background policy together to match current working definition.

Change-Id: I797ea49439fcc487cfe2cbc16703d4b91ceb9af6
2011-06-01 17:00:42 -07:00
Robert Greenwalt
6a9d45449d Reveal some network constants.
Since we've already decided to inc the sdk version we should try to get these in too.

bug:4500218
Change-Id: I6dcb401bf30f1b06f02be0a93681a190d7ee5775
2011-05-31 12:06:08 -07:00
Jeff Sharkey
f65d11df61 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
2011-05-21 15:02:58 -07:00
Wink Saville
1dc369c378 am 2a4ebb81: am 049694bf: Merge "Reset connection while data state changed." into honeycomb-LTE
* commit '2a4ebb810d66b0afa75647b978febf7d337c5f78':
  Reset connection while data state changed.
2011-05-19 11:32:27 -07:00
Wink Saville
049694bfa2 Merge "Reset connection while data state changed." into honeycomb-LTE 2011-05-19 11:25:45 -07:00
Jean-Baptiste Queru
65727c9c5d Merge f024027b
Change-Id: I70fc4382f832d1a2bded8a5ee7d9b96fac77879b
2011-05-19 07:54:53 -07:00
Wink Saville
f23fb20d13 Reset connection while data state changed.
Check data call states and reset connection if any link properties changed.


Change-Id: I008aea969378648192852161959fdf4aad6211a1
2011-05-18 15:59:04 -07:00
Robert Greenwalt
355205c0cd Switch to use netd to add/remove routes.
Also adds support for v6 routes and for removing single routes.

Change-Id: I1c4f08c7938371090944d8d6f603e1e0d6d70c01
2011-05-18 15:25:43 -07:00
Irfan Sheriff
9cfe6197fb DO NOT MERGE Add DhcpStateMachine
Add DhcpStateMachine for interation with dhcpcd

- Supports wakeup and renewal on dhcp
- Supports multiple controllers to use the state machine
  simultaneously
- Optionally, a controller can request a notification prior
    to DHCP request/renewal being sent

Change-Id: I5324814b19ff19863aa6fa89f1e3f0a202930c98
2011-05-12 14:10:11 -07:00
Wink Saville
a8f3f7c298 am f4c231c4: am 76a118dd: Merge "Fix initialization of RouteInfo" into honeycomb-LTE
* commit 'f4c231c4dcadd4633881c23ecea7327deec61c85':
  Fix initialization of RouteInfo
2011-05-12 14:08:05 -07:00
Kazuhiro Ondo
efa66d9fe9 Fix initialization of RouteInfo
IPv6 gateway is not correctly set in RouteInfo

Change-Id: I24b1ab71a64e3097c9ba641899240fc27847b86c
2011-05-11 16:02:00 -07:00
Robert Greenwalt
b5c62b6230 am f490d721: am e6848fac: Merge "Fix the adding of host routes." into honeycomb-LTE
* commit 'f490d72195d330e1232a9025ebe029158f68f5f6':
  Fix the adding of host routes.
2011-05-11 13:07:38 -07:00
Robert Greenwalt
bd49221570 Fix the adding of host routes.
We used to just add

Change-Id: I991e4cc976cc2932887dd3242fd50e013d521b0a
2011-05-10 11:27:46 -07:00
Robert Greenwalt
e7dcc1362f am df6da5c9: am aae781f3: Merge "Add auto-restore timeout for secondary networks." into honeycomb-LTE
* commit 'df6da5c96bc18cff1785fc30d639b2fe73110fe8':
  Add auto-restore timeout for secondary networks.
2011-05-04 12:47:30 -07:00
Robert Greenwalt
aae781f32b Merge "Add auto-restore timeout for secondary networks." into honeycomb-LTE 2011-05-04 09:59:30 -07:00
Robert Greenwalt
20f819c64b Add auto-restore timeout for secondary networks.
Settable per network so you can have not timeout for some and some for others.
If you set the old NETWORK_RESTORE_DELAY_PROP_NAME system property
(android.telephony.apn-restore) it will override this value.

Change-Id: Icca706fdc74245dce679209116660e5dc4b05d23
2011-05-03 19:10:26 -07:00
Robert Greenwalt
b0d1452d58 resolved conflicts for merge of 90faa5de to master
Change-Id: I8df9d5d07588fbd70e417dae567be26f645b74b6
2011-05-02 14:41:57 -07:00
Irfan Sheriff
52b5163b83 am 78204ba5: am 8ab6a6d4: Merge "Add DhcpStateMachine for interation with dhcpcd" into honeycomb-LTE
* commit '78204ba57cf9f907a70f943f140f88a02bc51efe':
  Add DhcpStateMachine for interation with dhcpcd
2011-05-02 13:29:36 -07:00
Robert Greenwalt
5afb46660c Merge "Add RouteInfo objects for tracking routes." into honeycomb-LTE 2011-05-02 13:26:52 -07:00
Robert Greenwalt
5a901298ed Add RouteInfo objects for tracking routes.
Used to have list of gateways for default routes, but general static routes
should be supported.

Change-Id: I01730142c6139f2b833b9d48f5381d2d320b69f6
2011-05-02 11:17:30 -07:00
Irfan Sheriff
204cec7dd5 Add DhcpStateMachine for interation with dhcpcd
- Supports wakeup and renewal on dhcp
- Supports multiple controllers to use the state machine
  simultaneously
- Optionally, a controller can request a notification prior
  to DHCP request/renewal being sent

Change-Id: I3a9d7e6a02ff26be3a86ddca6964683ad3c28f93
2011-04-30 12:58:51 -07:00
Robert Greenwalt
ef903acab4 am 8177aee2: am ef568c97: Merge "Make new networkAttribute parameter non-optional." into honeycomb-LTE
* commit '8177aee2dc06601701d0ed8e8efb20ed787e6153':
  Make new networkAttribute parameter non-optional.
2011-04-26 01:35:39 -07:00
Robert Greenwalt
2240524be9 Make new networkAttribute parameter non-optional.
Dependencymet sets the default dep-met value for the network.  Should
be set to true unless you know what you're doing.

Change-Id: Ifa3765a97615f5333da07bce9defdb8600275129
2011-04-25 16:04:45 -07:00
Robert Greenwalt
f76c55d289 Expose more net types to the public.
Ethernet and bluetooth.

Change-Id: Ic499709ffa151c0f27aef497373a8de7289e3e7f
2011-04-22 18:09:03 -07:00
Elliott Hughes
c944a7dedc More native code cleanup.
Don't keep unused global references to classes, don't throw exceptions
when an exception is already pending, and fix a (harmless) misunderstanding
about how GetStringChars works.

Change-Id: Ie445036f057daa8a1c76aceb7bad2a84fb81d820
2011-04-12 11:28:59 -07:00
Benoit Goby
6cec7f3535 Add support for USB Ethernet adapters
Change-Id: I6ae34a32d0e1b6f21c484b8639c3e7ce086e568d
2011-04-11 16:33:43 -07:00
Robert Greenwalt
f7ca6f7ddf am 1a087f0f: resolved conflicts for merge of 2879f735 to honeycomb-plus-aosp
* commit '1a087f0f01e4ea6900e5d922df68cbe908d6d1c9':
  Add external dependency API.
2011-04-07 14:22:03 -07:00
Robert Greenwalt
2879f7352b Merge "Add external dependency API." into honeycomb-LTE 2011-04-07 13:02:28 -07:00
John Wang
a8191da467 am f2cc9d1c: am 5d6f1167: Merge "Make LinkProperties comparable." into honeycomb-LTE
* commit 'f2cc9d1c7a54d92ed5d8357253963db4b614d203':
  Make LinkProperties comparable.
2011-04-07 12:48:17 -07:00
John Wang
3e567d5c3a Make LinkProperties comparable.
Add equals() and hashcode() to LinkProperties and related fields.

Bug:3501569
Change-Id: Ifa737a67c16867ac43cf76bf618a483e612a189e
2011-04-07 12:36:56 -07:00
Robert Greenwalt
34848c0192 Add external dependency API.
An APN will not be connected to if some external dependency is not met.

bug:3486704
Change-Id: I7d94df343b260013efd11faa978deb13f07f1389
2011-04-07 12:28:37 -07:00
Brian Carlstrom
587274ea3a Don't use local ref for cached jclass reference in JNI code
Change-Id: Id45b2acb358a819f2fd332e99f3a095f6fc7299b
related-to-bug: 4241138
2011-04-06 10:04:20 -07:00
Robert Greenwalt
dab2c6223e Do not merge: Add some input checking to prevent problems
Adding nulls can cause unhappiness.  It's suspected as a cause of 3495045.

bug:3495045
Change-Id: I925c965ef64032fc57849bf15fe9b11f4bc99351
2011-03-14 12:25:09 -07:00
Wink Saville
b7c92c720f Do not merge: Revert the revert of "LTE Changes for Telephony including Multiple PDN support and IPV6 support"
This reverts commit bbba216fe3
and is the first of the LTE commits in master being back ported
to the LTE branch.

Change-Id: I17d4a1b779ed74bc7dfb409d2c1a30f60fdb27c7
2011-03-14 12:25:04 -07:00
Wink Saville
bbba216fe3 DO NOT MERGE: Revert "LTE Changes for Telephony including Multiple PDN support and IPV6 support"
This reverts commit f6b7669493.

Change-Id: Ifc4e9aaccb54e065a36380710694cd6e4d347636
2011-03-03 09:53:52 -08:00
Robert Greenwalt
0ce55042b4 Add some input checking to prevent problems
Adding nulls can cause unhappiness.  It's suspected as a cause of 3495045.

bug:3495045
Change-Id: I1d83a5461caa0b8de9602f93a40681e7963b915e
2011-03-02 17:03:37 -08:00
Wink Saville
f6b7669493 LTE Changes for Telephony including Multiple PDN support and IPV6 support
Added init for CDMAPhone.java

Change-Id: I2392b5ad3382ee1993537b8477ef00dd036c6fe9
2011-02-24 18:23:36 -08:00
Elliott Hughes
3064b9e18e Use InetAddress.parseNumericAddress.
Bug: 3300307
Change-Id: I4ebfe533056e67931db1117e934596ba7b5c8b75
2011-02-15 17:11:29 -08:00
Robert Greenwalt
7fae12cc19 Remove more use of netmask
bug:2542681
Change-Id: Ifd75672739ee8262d4df22afd8173e4f3f67260d
2011-02-14 14:32:33 -08:00
Robert Greenwalt
5c733977a4 Update LinkProperties treatment of gateways
A link can have multiple gateways (think ipv4/ipv6 for a trivial example).
.

bug:3438810
Change-Id: I28c90a6947cd50b82e5ca9a0113148f98b3f4dd8
2011-02-11 11:06:23 -08:00
Robert Greenwalt
f2b39b4773 am 996d60e3: resolved conflicts for merge of 36165a67 to honeycomb-plus-aosp
* commit '996d60e3a5abe29479b741bd1b346977e4c101aa':
  Add some network types that OEM's are asking for.
2011-01-29 09:35:28 -08:00
Robert Greenwalt
996d60e3a5 resolved conflicts for merge of 36165a67 to honeycomb-plus-aosp
Change-Id: I7a3445f7df2a66c70f630fa63ceb4ae150d70963
2011-01-29 09:32:04 -08:00
Robert Greenwalt
36165a676a am 6b739dc7: Merge "Add some network types that OEM\'s are asking for." into gingerbread
* commit '6b739dc7292452227cdd8abd90658f4db8f0ce70':
  Add some network types that OEM's are asking for.
2011-01-29 06:55:38 -08:00
Robert Greenwalt
9d07781cb6 Add some network types that OEM's are asking for.
Adding them hidden so that if OEM's are rolling their own at least they can
use the same values.  Will mark them unhidden in a future sdk release.

bug:3395729
Change-Id: I90eabe036a96e1aa7c8cac49ca51efd9b1776a0c
2011-01-28 14:48:37 -08:00
Robert Greenwalt
52ef39aff1 Fix the build
Check for null before trying to make InetAddresses.

Change-Id: I3228eea32eb455437dd76be2de56a913884f3f6e
2011-01-27 10:49:27 -08:00
Robert Greenwalt
3ec1eeea3a Get rid of manual int->ipv4 string generation
bug:2542681
Change-Id: I67919d7b5dc8d72eeb2dfb9e3906210b1951d4fb
2011-01-26 13:57:24 -08:00
Robert Greenwalt
7baf8a8f08 Make the interface with DHCP IPv6 capable.
It doesn't work (yet) for IPv6, but we can remove v4-centric notions from the framework.

bug:2542681
Change-Id: I21c058f5c88d07706c9265bf0ea902fc90357e56
2011-01-26 09:10:01 -08:00