Commit graph android_packages_modules_Co.../core/java/android
Message SHA1
Merge "Move Keepalive out of IpSecTransform.Builder" am: af3fb3efe4 am: bbb4b05a64
am: b9d614d4df

Change-Id: Ic554e34d9b16f522156bc7e8b176f96693e8e32c

nharold   authored and   android-build-merger   commited 2018-01-25 07:59:57 +00:00
c20e9c8b4b
Move Keepalive out of IpSecTransform.Builder
The lifecycle of Keepalive offloading is, unfortunately
different from that of an IpSecTransform. Because starting
a keepalive is fundamentally asynchronous, and isn't valid
until after a transform exists, it will now be a separate
optional procedure that may succeed or fail. It remains
linked with a Transform by the need for a Transform to exist
in order to initiate a Keepalive.

Bug: 38350389
Test: compilation
Change-Id: Ia76fccee41f86d694dff436043293d0c0762c041

Nathan Harold   commited 2018-01-24 19:32:04 -08:00
b559164017
Merge "Add TunnelInterface API and KernelResourceRecords" am: e02b700032 am: e1aa92f1c1
am: 5c3eb9ce8e

Change-Id: I955d5090171f08e4fa20eac5bdfe761132b87d35

Benedict Wong   authored and   android-build-merger   commited 2018-01-24 09:54:06 +00:00
45828d7122
Merge "Add xfrm mark in IpSecConfig" am: 6b3456b253 am: 4077e802ad
am: fc2bcb4153

Change-Id: Ibaee9700cc6befdf6bbdb792cb673611e571d19a

Benedict Wong   authored and   android-build-merger   commited 2018-01-24 09:48:25 +00:00
f86780fa1f
Add TunnelInterface API and KernelResourceRecords
This change adds one KernelResourceRecord type (TunnelInterfaceRecord),
and adds methods for the creation of TunnelInterfaces, as well as the
application of Transforms to the given TunnelInterfaces

As part of the generation of ikeys/okeys, a ReserveKeyTracker manages a
java bitset to avoid collisions and reserve/release keys.

Bug: 63588681
Test: Compiles, CTS, unit tests all pass on AOSP_marlin
Change-Id: I9e9b6455e27073acd4491eae666aa966b3b10e0f

Benedict Wong   commited 2018-01-24 07:24:27 +00:00
8bc907311b
Merge "Add xfrm mark in IpSecConfig"
Benedict Wong   authored and   Gerrit Code Review   commited 2018-01-24 05:53:29 +00:00
6b3456b253
Merge "Expose applyTunnelModeTransform as a system API" am: d056f32bd9 am: c2253ff48d
am: 82d8e1a25d

Change-Id: Ia1f81f5696814f5b9479882e1102a5f8508a4512

Benedict Wong   authored and   android-build-merger   commited 2018-01-24 02:58:17 +00:00
7ea128e242
Expose applyTunnelModeTransform as a system API
Simple change to expose systemAPI for applyTunnelModeTransform

Bug: 36033193
Test: All CTS, unit tests passing
Change-Id: I2d857c048bc0dc80c3949387f946b1f5adf0527e

Benedict Wong   commited 2018-01-23 23:25:54 +00:00
03e732a299
Support passing a template to NetworkStatsManager queries.
Currently, NetworkStatsManager queries and callbacks only allow
selecting network traffic based on network identifiers:
networkType, subscriptionId and networkId.  The code ends up
converting these into a template under the hood.

Now that templates can express more fine-grained queries (e.g.,
select only roaming traffic, or select only traffic that's not
on the default network) add a hidden method to pass in a
template. This should have no security implications, as all the
access controls are performed in NetworkStatsService.

Bug: 35142602
Test: android.app.usage.cts.NetworkUsageStatsTest passes
Change-Id: Iab4afa26b34544299d2a9c501c1b0feb470e90a9
Merged-In: Iab4afa26b34544299d2a9c501c1b0feb470e90a9

Lorenzo Colitti   commited 2018-01-23 18:38:48 +09:00
f1b197b23b
Add metered, roaming, and defaultNetwork info to NetworkTemplate.
This will allow data usage clients to query for and receive
callbacks on data usage matching these conditions.

Bug: 35142602
Test: atest FrameworksNetTests
Change-Id: I4d985a2734eeab7ee454c09cc2098b6b3c671c23
Merged-In: I4d985a2734eeab7ee454c09cc2098b6b3c671c23

Lorenzo Colitti   commited 2018-01-23 18:38:48 +09:00
75ec1aed18
Add the defaultNetwork element to the netstats.proto.
This is in its own commit because AOSP has diverged from internal
master.

Bug: 35142602
Test: builds, boots
Change-Id: I75fc85b961bc919e3d6c2adce6d6861c6f2c8379
Merged-In: I75fc85b961bc919e3d6c2adce6d6861c6f2c8379

Lorenzo Colitti   commited 2018-01-23 18:38:48 +09:00
0ba426b8a1
Add getDefaultNetwork to the NetworkStats public API.
This allows an app using the public API to know whether the
traffic in a particular bucket was on the default network
(i.e., the network was selected by the system), or not (i.e.,
the network was selected by the app).

Bug: 35142602
Test: builds, boots
Test: added coverage to NetworkUsageStatsTest CTS test, still passes
Change-Id: I9f6669908fa119743b9c0aa0c31a03e5ebafa7db
Merged-In: I9f6669908fa119743b9c0aa0c31a03e5ebafa7db

Lorenzo Colitti   commited 2018-01-23 18:28:07 +09:00
92a946d09f
Merge "Support passing a template to NetworkStatsManager queries."
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2018-01-23 04:02:58 +00:00
1d81c1317f
Merge "Remove obsolete NetworkStats.Entry constructor." am: ebb1d92eb8 am: cdeb50aa48
am: 56cc2e9765

Change-Id: Id6a664fd5ad8c182468b742e810e65afee248ad5

Lorenzo Colitti   authored and   android-build-merger   commited 2018-01-23 02:35:08 +00:00
942df30e22
Merge changes I4d985a27,Ic6f2bc18
* changes:
  Add metered, roaming, and defaultNetwork info to NetworkTemplate.
  Unbreak frameworks-net tests broken by missing libutilscallstack.

Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2018-01-23 00:28:39 +00:00
ecf2a65eb7
Merge "Remove obsolete NetworkStats.Entry constructor."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2018-01-23 00:15:15 +00:00
ebb1d92eb8
Merge "Rename create/delete transform methods" am: da6956a702 am: 5b71c4a0a5
am: f5aae7f1a3

Change-Id: Ie07b0b608b3dfcbfc4228a15e26fe6f6559315f9

Benedict Wong   authored and   android-build-merger   commited 2018-01-22 20:03:48 +00:00
f9040dea3b
Merge "Rename create/delete transform methods"
Benedict Wong   authored and   Gerrit Code Review   commited 2018-01-22 17:57:15 +00:00
da6956a702
Support passing a template to NetworkStatsManager queries.
Currently, NetworkStatsManager queries and callbacks only allow
selecting network traffic based on network identifiers:
networkType, subscriptionId and networkId.  The code ends up
converting these into a template under the hood.

Now that templates can express more fine-grained queries (e.g.,
select only roaming traffic, or select only traffic that's not
on the default network) add a hidden method to pass in a
template. This should have no security implications, as all the
access controls are performed in NetworkStatsService.

Bug: 35142602
Test: android.app.usage.cts.NetworkUsageStatsTest passes
Change-Id: Iab4afa26b34544299d2a9c501c1b0feb470e90a9

Lorenzo Colitti   commited 2018-01-22 22:30:27 +09:00
81bd73ba98
Add metered, roaming, and defaultNetwork info to NetworkTemplate.
This will allow data usage clients to query for and receive
callbacks on data usage matching these conditions.

Bug: 35142602
Test: atest FrameworksNetTests
Change-Id: I4d985a2734eeab7ee454c09cc2098b6b3c671c23

Lorenzo Colitti   commited 2018-01-22 21:41:20 +09:00
e47bf09f9b
Merge changes from topic "multipath-datausage"
* changes:
  Add the defaultNetwork element to the netstats.proto.
  Add getDefaultNetwork to the NetworkStats public API.

Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2018-01-21 16:07:29 +00:00
d5059166ac
Remove obsolete NetworkStats.Entry constructor.
The only caller is telephony code, and it's being fixed in this
topic.

Bug: 35142602
Test: builds, boots
Change-Id: Ia77a1c2c297037f311c2355610c206cd8e3192c4

Lorenzo Colitti   commited 2018-01-21 23:01:35 +09:00
9ab3929812
Merge "Add Tunnel Interface APIs to IpSecManager" am: a82dbcb3c7 am: 696cff166c
am: e7e979071c

Change-Id: I094751d965b679e85a0f200b2382f1715d69e400

nharold   authored and   android-build-merger   commited 2018-01-19 20:25:18 +00:00
1b818c5bc4
Merge "Add Tunnel Interface APIs to IpSecManager"
nharold   authored and   Gerrit Code Review   commited 2018-01-19 19:43:17 +00:00
a82dbcb3c7
Rename create/delete transform methods
CreateTransportModeTransform and DeleteTransportModeTransform are both
agnostic as far as which mode of transform it creates/deletes. As such,
to facilitate the implementation of tunnel mode, this patch renames them
to CreateTransform and DeleteTransform, along with all test names.

Bug: 63588681
Test: frameworks/base unit tests and CTS tests run, passed
Change-Id: I1f015eb7ad0e85fca966658a9402485ca2b44091

Benedict Wong   commited 2018-01-19 10:43:01 -08:00
0fff56eae5
Add the defaultNetwork element to the netstats.proto.
This is in its own commit because AOSP has diverged from internal
master.

Bug: 35142602
Test: builds, boots
Change-Id: I75fc85b961bc919e3d6c2adce6d6861c6f2c8379

Lorenzo Colitti   commited 2018-01-20 02:26:58 +09:00
76a6f956dd
Add getDefaultNetwork to the NetworkStats public API.
This allows an app using the public API to know whether the
traffic in a particular bucket was on the default network
(i.e., the network was selected by the system), or not (i.e.,
the network was selected by the app).

Bug: 35142602
Test: builds, boots
Test: added coverage to NetworkUsageStatsTest CTS test, still passes
Change-Id: I9f6669908fa119743b9c0aa0c31a03e5ebafa7db

Lorenzo Colitti   commited 2018-01-20 02:26:58 +09:00
b8e79f3312
Merge changes Id8776d14,Ifa291c62,I5ea9d200 am: c48f4cb7f1 am: b36b423230
am: 0d74e0554c

Change-Id: I12108d96e29bfe71406106c2af950a6d6a9f8351

Lorenzo Colitti   authored and   android-build-merger   commited 2018-01-19 16:46:11 +00:00
d99f4ff71f
Track and persist in stats whether traffic is on the default network.
This change adds the defaultNetwork to the ident based on current
system networking state, and persists that value to flash.

Bug: 35142602
Test: runtest frameworks-net
Test: downloaded files using default/non-default networks while watching dumpsys netstats
Change-Id: Id8776d149b2977548a9eb455ad4926af55e25aba

Lorenzo Colitti   commited 2018-01-19 19:49:16 +09:00
ab7807a5bb
Add the default network to NetworkStats and NetworkStatsCollection.
This allows us to maintain NetworkStats entries that track
whether the traffic was on the default network.

At the moment, the stats collection code always passes in
DEFAULT_NETWORK_NO. However, this value is a no-op, since it is
not persisted to disk. Only the ident, the uid/set/tag, and the
packet/byte/operation counters are persisted.

A future change will add defaultNetwork to the ident and start
persisting it.

Bug: 35142602
Test: runtest frameworks-net
Change-Id: Ifa291c62c0fa389b88e5561086a29dcd7cee2253

Lorenzo Colitti   commited 2018-01-19 19:49:16 +09:00
3e85855083
Pass all default networks to NetworkStatsService
This will allow NetworkStatsService to treat traffic on these
networks differently from traffic where the app selects a network
that is not the default.

Bug: 35142602
Test: runtest frameworks-net
Change-Id: I5ea9d200d9fb153490c6108bb9390bf152f297da

Lorenzo Colitti   commited 2018-01-19 16:40:10 +09:00
28d1a529d5
Add xfrm mark in IpSecConfig
Bug: 63589600
Test: runtest frameworks-net
Change-Id: I2d38d781b8b31d8bf39fd4e9a7e31509f15a9e16

Di Lu   commited 2018-01-18 15:23:56 -08:00
3fef704896
Add Tunnel Interface APIs to IpSecManager
Add a new interface and a new management object,
IpSecTunnelInterface to the IpSecManager surface.
This object will be used to control IPsec tunnels.

-Add IpSecTunnelInterface object
-Add methods to create and use an IpSecTunnelInterface
-Update the IpSecTransform builder to create Tunnel
 mode IpSecTransform objects (usable with an IpSecTunnel)

Bug: 36033193
Test: compilation
Change-Id: Ib6948b12c15c93674234dc36288058ae44435b90

Nathan Harold   commited 2018-01-17 16:14:17 -08:00
67e7673adf
Merge "IpSec - API Tweak for removeTransportModeTransform" am: 6725ff729b am: d58b237445
am: a2411eb8ee

Change-Id: I479c24d9ac5d4b022ec6310395fdb4274cfd5598

nharold   authored and   android-build-merger   commited 2018-01-17 20:50:14 +00:00
002831b7c0
Merge "Prevent Closure of Underlying Socket FDs" am: 3cff120fcb am: 31f05d66ca
am: 5a653d2ec7

Change-Id: I3ab796cc17d5ee2e4a2c8838bac2ada4831c755f

nharold   authored and   android-build-merger   commited 2018-01-17 10:14:43 +00:00
77af60dd1d
Make Transforms Unidirectional am: 5a19b9500d am: f4fc2714c2
am: ab40c5ac15

Change-Id: I608be255a307891ec3fe2d97cda817d75240c95c

Nathan Harold   authored and   android-build-merger   commited 2018-01-17 10:03:31 +00:00
ff097d9e93
IpSec - API Tweak for removeTransportModeTransform
Because IpSecTransforms are now unidirectional,
and because the only mechanism for removing Transforms
removes it from both directions, the API can no longer
use the Transform parameter to meaningfully validate
that the caller had applied a transform. Since that
functionality was as-yet unimplemented and is now
infeasible, the transform parameter is removed.

Bug: 72079356
Test: cts - IpSecManagerTest; runtest frameworks-net
Change-Id: If19b0d34bdc6daf31a40d6d62bff326dcbca08c0

Nathan Harold   commited 2018-01-17 01:11:46 -08:00
0d483b76f3
Prevent Closure of Underlying Socket FDs
The version of applyTransportModeTransform() and
removeTransportModeTransform() that accepted
Socket and DatagramSocket were closing the underlying
FDs upon return. It's unclear whether this is due to
a behavior change elsewhere in ParcelFileDescriptor,
but either way, converting to using getFileDescriptor$
and then calling dup() explicitly rather than relying
on ParcelFileDescriptor seems like a better idea anyway.

Bug: 72047396
Test: CTS - IpSecManagerTest.testCreateTransform()
Change-Id: Ia2f02564e1289f25bf113dbb861fcfd2240537a7

Nathan Harold   commited 2018-01-16 21:30:20 -08:00
3167625a15
Make Transforms Unidirectional
Convert the IpSecTransform from being a bi-directional
pair of SAs to a unidirectional single SA. This CL
also removes the concept of "direction from SAs meaning
that a IpSecTransform may now be applied to a socket
in either direction.

-Make transforms unidirectional
-Add Convert allocateSpi() to use destination rather
 than direction and remote address
-Remove directionality from builders for IpSecTransform
-Change applyTransportModeTransform() to take a
 direction in which to apply the transform object.
-Additional minor naming updates
-Restrict IpSecConfig to only print keys on eng builds
-Move DIRECTION constants to IpSecManager
-Add sourceAddress parameter to IpSecTransform to provide
 additional guarantees about the source address of data;
 (explicit failure rather than implicit failure).
-Move SPI to the build() method of IpSecTransform

Bug: 71717213
Test: runtest frameworks-net, CTS - IpSecManagerTest
Change-Id: I0824b37f443f4b8c62536d9801238c63ed8f2a1c

Nathan Harold   commited 2018-01-16 11:08:31 -08:00
5a19b9500d
Merge "Add validation to IpSecConfig algorithm setters" am: 53e5d21924 am: c93df5ca1c
am: c135035ab6

Change-Id: I7ff85771945c68025ce8d66ca85313bac087b3a5

Benedict Wong   authored and   android-build-merger   commited 2018-01-09 21:23:35 +00:00
3de5545763
Merge "Add validation to IpSecConfig algorithm setters"
Benedict Wong   authored and   Gerrit Code Review   commited 2018-01-09 18:18:28 +00:00
53e5d21924
Merge changes from topic "ipsec-resource-id-cleanup" am: 2b36299c73 am: d7319df4d0
am: f81e9dcf6a

Change-Id: Ib96b30bcb1b47c23d0a18cf043dd042409c61322

nharold   authored and   android-build-merger   commited 2018-01-08 20:29:11 +00:00
8dddc0d093
Add DataUnit to clarify SI-vs-IEC units.
Mirrors the design of TimeUnit and ChronoUnit which many developers
are already familiar with, making it easy to pick up and use.

Yes, this is an enum.

Bug: 70915728
Test: bit FrameworksCoreTests:android.util.DataUnitTest
Change-Id: Id0cfdac5c81ed89c3c9ece23c964acba4a4f8471

Jeff Sharkey   commited 2018-01-07 19:06:01 -07:00
a6886af481
Add validation to IpSecConfig algorithm setters
Adds checks to ensure that users can only set the correct types of
algorithms for the Authentication, Encryption and Authenticated
Encryption algorithms.

Bug: 65223935
Test: Added tests in IpSecConfigTest, and passed on aosp_marlin-eng
Change-Id: I462c77d9eb5710b8d03a48866453649d3b6fc6bf

Benedict Wong   commited 2018-01-04 16:56:40 -08:00
70867e55f7
IpSec Invalidate the Resource IDs on close()
To facilitate error checking we should invalidate
the resource IDs of all objects when we close() them.
Today, the resource ID is invalidated on the Transform
object but not on the SPI or Encap Socket. This CL
unifies the behavior.

Bug: 70641274
Test: cts - IpSecManagerTest
Change-Id: I28caec3e913902c748c6a50b4ef742ccef8b1b09

Nathan Harold   commited 2018-01-04 15:28:29 -08:00
5e8544685d
Merge "Use NetworkStatsService to get stats for apps" am: 8469cd614d am: fa7f4015fc
am: 2e6aabced1

Change-Id: I90ce68a72afbf596e28d987e925795709d24dd52

Chenbo Feng   authored and   android-build-merger   commited 2017-12-21 19:49:25 +00:00
fa05f2bf30
Use NetworkStatsService to get stats for apps
Move the native implementation of TrafficStats to NetworkStatsService
and apps need to get the NetworkStatsService binder interface from
system_server in order to get the network usage stats since boot. This
implementation can hide the detail of retrieving network traffic
information from apps and the NetworkStatsService can choose which
methoed it use to get the data depending on the kernel version of the
device.

Bug: 30950746
Test: CtsNetTestCases -t android.net.cts.TrafficStatsTest
Change-Id: I53bbefd19aa0b783b9b4b42ea4d76db3e9ec07a3

Chenbo Feng   commited 2017-12-19 19:57:44 -08:00
aa7ba31c8e
Merge "[ipsec-qtaguid] Tag sockets upon creation of encap sockets" am: cd534c6990 am: 8caa274ade
am: 073572a677

Change-Id: I4140f386687c579044f9b5fe59dd7e05f86000fe

Benedict Wong   authored and   android-build-merger   commited 2017-12-19 00:41:55 +00:00
0ee0b691f7
[ipsec-qtaguid] Tag sockets upon creation of encap sockets
Added calls to tag encap sockets to that of the UID for which the encap
socket is being created on behalf of. This ensures that all data
accounting generated for the UDP-encap-ESP socket is correctly billed to
the right UID.

Bug: 62994731
Test: New tests added to IpSecServiceTest.java, passing
Change-Id: I15365ea9c982fd7b4e3cdeff314ddfba2289c86e

Benedict Wong   commited 2017-12-18 19:46:06 +00:00
083faee14a
[CHERRY-PICK] API for apps to tag sockets with their own UID.
This enables app A to create a socket, pass it to app B, and have
app B accept blame for the traffic performed on that socket.

Also adds helpful public APIs for tagging raw FileDescriptor sockets
instead of making developers go through shady SocketImpl wrappers.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AppSecurityTests#testAppFailAccessPrivateData
Bug: 63932076
Change-Id: I08925c843974675fc82e4080cec2eaab9ab7cd41
Merged-In: I08925c843974675fc82e4080cec2eaab9ab7cd41
(cherry picked from commit 4e164f9e94)

Jeff Sharkey   authored and   Benedict Wong   commited 2017-12-18 19:44:40 +00:00
1fb74318cf