Commit Graph

3178 Commits

Author SHA1 Message Date
Chia-chi Yeh
75cacd5525 VPN: migrate from generic Bundle to our own Parcelable VpnConfig.
Note that VpnConfig is for internal use only.
Also remove hidden methods from ConnectivityManager.

Change-Id: Ic298c4dc9a2c6c452bd8f4be6fa84e7ac489c0c4
2011-06-15 17:08:58 -07:00
Jeff Sharkey
97abbe95cd 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
2011-06-11 22:17:17 -07:00
Jeff Sharkey
837b4ebf7e 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
reboot.

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
2011-06-11 17:55:56 -07:00
Jeff Sharkey
ebbebc73a0 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
2011-06-09 10:14:13 -07:00
Chia-chi Yeh
9a4ad7d52c The service part of the user space VPN support.
The dialogs will be in another change.

Change-Id: I0cdfd2ef21ffd40ee955b3cbde5ada65dbfdb0bc
2011-06-08 14:16:42 -07:00
Robert Greenwalt
269d732e13 resolved conflicts for merge of 510d0a75 to master
Change-Id: Ic4d8aae7dd457457d9cc8ba081b273e425729f86
2011-06-08 10:01:06 -07:00
Jeff Sharkey
512b757b08 Compute range-based usage in NetworkStatsHistory.
When given a start/end range, interpolate between buckets to return
the total network usage.  Used to summarize detailed UID stats.  Method
to combine NetworkStatsHistory regardless of bucket size.  Used to
combine all histories matching a template.

Added tests for both methods.

Change-Id: Ia463910c0ecf7cf08dcf97c658ad99742bd6b882
2011-06-07 23:54:28 -07:00
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
Chia-chi Yeh
ab2c05370e Merge "Do not register the callbacks in the constructor." 2011-06-07 18:18:56 -07:00
Robert Greenwalt
510d0a756a am f17deff9: resolved conflicts for merge of 8de47a2f to honeycomb-LTE
* commit 'f17deff97b290382b9e111e35fc2189ac8ffb75c':
  Reveal some network constants.
2011-06-07 13:12:29 -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
Mike Lockwood
0d5916c21e Move stringToFile utility from ConnectivityService to FileUtils
Change-Id: I59a2dc649d59677f6b5e7ade252587c7c151ec06
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-05-28 13:28:12 -04:00
Jeff Sharkey
0d49ed3ca8 Merge "APIs to profile network usage for current UID." 2011-05-23 18:38:04 -07:00
Chia-chi Yeh
f3204aad8e Do not register the callbacks in the constructor.
Change-Id: Ic7509c35cfb17b022a2af3cc14170942d6510e2d
2011-05-23 15:08:29 -07:00
Robert Greenwalt
1b507045bd am e0f7bc0b: resolved conflicts for merge of dec3dda8 to honeycomb-plus-aosp
* commit 'e0f7bc0b841c0b6a09fb7d5b259a6772b3a53df3':
  Simplfy getActive* calls in ConnectivityService
2011-05-21 21:35:38 -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
Robert Greenwalt
e0f7bc0b84 resolved conflicts for merge of dec3dda8 to honeycomb-plus-aosp
Change-Id: If14c7fc51c4549524c2f39797a902093582bae6d
2011-05-20 15:45:55 -07:00
The Android Open Source Project
991f5f4ec9 Reconcile with honeycomb-release
Change-Id: I83818e0c61f0fcb53b154cd0a85f18924745912f
2011-05-20 14:33:41 -07:00
The Android Open Source Project
969a009cbd Reconcile with gingerbread-release
Change-Id: If7c568d850eaffbcfc237e8b875bc5684c6dc651
2011-05-20 13:50:51 -07:00
Robert Greenwalt
e1544bb9ea Simplfy getActive* calls in ConnectivityService
One had been simplified on GB, but somehow it didn't make it here.
bug: 4463770

Change-Id: Ica51e836b1a7a489526a223168910b8e06c99c2b
2011-05-20 12:23:41 -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
2a4ebb810d am 049694bf: Merge "Reset connection while data state changed." into honeycomb-LTE
* commit '049694bfa249c9238d24e0f635b763a53c179ca2':
  Reset connection while data state changed.
2011-05-19 11:28:36 -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
Kazuhiro Ondo
842c177850 am a9f139c4: am 3a34041f: Linkproperties update via unsol data call state change.
* commit 'a9f139c4f0858bde86febd3d87bdc443c73ac220':
  Linkproperties update via unsol data call state change.
2011-05-18 17:48:37 -07:00
Robert Greenwalt
f024027b55 am 355205c0: Switch to use netd to add/remove routes.
* commit '355205c0cd712fb964cd47ec7f65616808d5ef75':
  Switch to use netd to add/remove routes.
2011-05-18 16:33:16 -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
Kazuhiro Ondo
a9f139c4f0 am 3a34041f: Linkproperties update via unsol data call state change.
* commit '3a34041f8027bf15cb2653c1a46146b605dbb702':
  Linkproperties update via unsol data call state change.
2011-05-18 00:02:31 -07:00
Kazuhiro Ondo
3a34041f80 Linkproperties update via unsol data call state change.
Handles the scenario of radio technology handover with IP continuity.
Once RIL/Modem finished a handover operation, an unsol data call state
change will be send up to FW notifying all link propertes changes.
FW will then re-configure the device with new link properties
including iptable used by Tethering.

Change-Id: I05e29f66ac3db8ba4274d3662642607742ba1d12
2011-05-17 20:53:40 -07:00
Irfan Sheriff
bc7d82560f am ea7aa92a: (-s ours) am 891bdee2: Merge commit \'01ea7f01\' into manualmerge1
* commit 'ea7aa92a95636ac38f13f6249c83939d89c3df1e':
  DO NOT MERGE Add DhcpStateMachine
2011-05-12 17:39:07 -07:00
Irfan Sheriff
ea7aa92a95 am 891bdee2: Merge commit \'01ea7f01\' into manualmerge1
* commit '891bdee2baf3fc7189110c24a1d1b9080e8d1d48':
  DO NOT MERGE Add DhcpStateMachine
2011-05-12 17:37:06 -07:00
Irfan Sheriff
891bdee2ba Merge commit '01ea7f01' into manualmerge1 2011-05-12 17:19:56 -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
Wink Saville
f4c231c4dc am 76a118dd: Merge "Fix initialization of RouteInfo" into honeycomb-LTE
* commit '76a118dd9e1bc8be33e1e22b7264b7f918f6f050':
  Fix initialization of RouteInfo
2011-05-12 14:03:31 -07:00
Chia-chi Yeh
4df51328bd Extract NetworkManagementService out from Tethering to ConnectivityService.
and also some minor refactoring.

Change-Id: I0e74f30ef1b035d9ed37571c512fedc15d05db77
2011-05-11 17:06:07 -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
f490d72195 am e6848fac: Merge "Fix the adding of host routes." into honeycomb-LTE
* commit 'e6848faceff58f84f671dbc73be08ef7890fea09':
  Fix the adding of host routes.
2011-05-10 11:53:57 -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
df6da5c96b am aae781f3: Merge "Add auto-restore timeout for secondary networks." into honeycomb-LTE
* commit 'aae781f32bc769f6275d3cfc200cbbadf3f820f6':
  Add auto-restore timeout for secondary networks.
2011-05-04 10:02:16 -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