Commit Graph

2689 Commits

Author SHA1 Message Date
Treehugger Robot
1ad27ef2a1 Merge "[FUI17] Migrate NetworkStatsService to use NetworkStateSnapshot" 2021-03-02 13:21:32 +00:00
junyulai
125631330d [FUI17] Migrate NetworkStatsService to use NetworkStateSnapshot
This change migrates NetworkStatsService and related code to use
NetworkStateSnapshot which is used for replacing the NetworkState.

This patch also changes some formating which is suggested by
the linter.

Test: FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I547da8f411cb45bdadc376ac3cadf3f3c55bb282
2021-03-02 20:08:53 +08:00
Remi NGUYEN VAN
1bc09ccb14 Move UidRange to connectivity
UidRange is a data class that is an implementation detail of
Connectivity. Move it to the connectivity boundary.

Remaining usages of UidRange outside of Connectivity (in VPN) should be
migrated to other classes, like Range<Integer> or UidRangeParcel.

Bug: 181512874
Test: m
Change-Id: I6f2e3685ad1c07171dd90480d1e546329de8732d
2021-03-02 15:35:36 +09:00
Junyu Lai
18f51bd23d Merge "[FUI08] Create NeworkStateSnapshot" 2021-02-26 10:53:36 +00:00
junyulai
8f1eb24a94 [FUI08] Create NeworkStateSnapshot
Since NetworkState has UnsupportedAppUsage APIs that cannot
be changed, create another class for follow-up patches
to expose as system API.

Test: NetworkStateSnapshotTest
Bug: 174123988
Change-Id: I54ef872847f34166aa34a79f6178c90ac12b6c72
2021-02-26 11:57:06 +08:00
Chris Weir
dbedad0dd5 Merge "Add support for tracking PANS data usage" 2021-02-25 21:37:42 +00:00
Lucas Lin
1e70c22af9 Merge changes I852e3a53,I86755647,I0ed8b0c6
* changes:
  Remove unused INetworkManagementService from IpSecService
  Use NetdUtils instead of NetworkManagementService in Vpn
  Use NetdUtils instead of NetworkManagementService in IpSecService
2021-02-22 06:49:39 +00:00
Chris Weir
f8f291cb7b Add support for tracking PANS data usage
Adds support for tracking oemManagedNetwork types (OEM_PAID and
OEM_PRIVATE).

Bug: 174485293
Test: atest NetworkTemplateTest NetworkStatsCollectionTest
NetworkStatsObserversTest NetworkStatsServiceTest NetworkIdentityTest
Test: verify that the bytes go up in PansTest app only when
`ping -I eth2 8.8.8.8` is run as root.

Change-Id: I78660a835f16265ba8e44bb84332c6633dd72b84
2021-02-17 20:32:53 -08:00
Remi NGUYEN VAN
037a730efd Split parcelable .aidl files to aidl-export
The one-line "parcelable X" files need to be imported by targets that do
not build against SDK (the SDK has prebuilt definitions), so prepare a
dedicated directory for them.
This avoids having users of the classes include the whole src/
directory, which could contain definitions for classes that are not part
of the public API, so should not be imported.

Also move back to frameworks/base/core some .aidl definitions that
were separated from their associated class.

Bug: 171540887
Test: m
Merged-In: I7432fe4c87cd3cab04dcb6185c9a4f3f84376549
Change-Id: I7432fe4c87cd3cab04dcb6185c9a4f3f84376549
2021-02-18 01:17:04 +00:00
Yan Yan
441e35f612 [API] Expose IpSecTunnelInterface#setUnderlyingNetwork
This API is required to perform MOBIKE. This API allows an IPsec
peer to change the underlying network of its established IPsec
tunnel without re-establishing the tunnel.

Bug: 169855650
Test: atest IpSecManagerTunnelTest (new tests added)
Change-Id: Ifc8ad902cbfbe4ad07e715f2fef0faa1bf9d68f3
2021-02-10 14:52:18 -08:00
Yan Yan
a2f3b49f10 Update underlying network of IpSecTunnelInterface
Bug: 169855650
Test: atest IpSecManagerTunnelTest
Change-Id: I6d1b8d0e49f89c67ddc2caf4ba63fb0b1eb062c0
2021-02-10 14:51:43 -08:00
Junyu Lai
5e1ec81e2f Merge changes from topic "removeNI"
* changes:
  [FUI07] Stop making NetworkState with NetworkInfo from external callers
  [FUI06] Stop using NetworkInfo in NetworkState from external callers
2021-02-09 03:37:59 +00:00
junyulai
64b1cfb7db [FUI06] Stop using NetworkInfo in NetworkState from external callers
This is achieved by:
  1. Use legacy network type inside NetworkState to replace the
     needs of referencing NetworkInfo.getType().
  2. Let getAllNetworkState only return networks with isConnected()
     equals true. This allows callers such as NPMS or NSS does not
     have to reference to NetworkInfo.isConnected().

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I1c4eb08d18ca973eb8f41d06258872eabc0006b8
2021-02-08 21:40:49 +08:00
lucaslin
d66e608a5d Remove unused INetworkManagementService from IpSecService
IpSecService is no longer using any methods of
INetworkManagementService, so remove it from IpSecService
and related files.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I852e3a534e0ffd26b4b22420754f3ec8a6f153ad
2021-02-08 08:05:00 +00:00
lucaslin
ff6fe7ba53 Use NetdUtils instead of NetworkManagementService in IpSecService
NetdUtils has the same method(e.g. setInterfaceUp) as
NetworkManagementService so using the one inside NetdUtils instead
and try to remove NetworkManagementService from IpSecService in
the following commit.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I0ed8b0c678b067a655b51b938b6b40eadd985321
2021-02-08 16:01:56 +08:00
Roman Kalukiewicz
61a6c947ff Add @Nullable to Object#equals()
This is a partial cherry-pick of change:
I5eedb571c9d78862115dfdc5dae1cf2a35343580

for connectivity classes.

Bug: 170883422
Test: m
Merged-In: I5eedb571c9d78862115dfdc5dae1cf2a35343580
Change-Id: I7dc661863b73f4198ddb4f3a1566583d0f07db3c
2021-02-05 07:28:44 +00:00
junyulai
b17ea56d30 [FUI21] Move scrubSubscriberId to utils class
This patch also removes the functionality of returning
original subscriberId in eng build since it is not really useful.

Test: atest NetworkIdentityUtilsTest
Bug: 174123988
Change-Id: I721457e571aa9403a2200b3e4261b4895e4f7a3e
2021-02-02 23:45:54 +08:00
junyulai
005f79c2d7 [FUI20] Expose UnderlyingNetworkInfo as system Api
Test: atest android.net.UnderlyingNetworkInfoTest
Bug: 174123988
Change-Id: Id602fbe744669f472d27fb466d00dcc601bd8f17
2021-02-02 23:12:10 +08:00
Lorenzo Colitti
32141be3dd Merge "Revert "Expose IPsec tunnel APIs from @SystemApi to public APIs"" 2021-02-01 15:33:11 +00:00
Lorenzo Colitti
388f41621f Revert "Expose IPsec tunnel APIs from @SystemApi to public APIs"
This reverts commit 160aac3fa0.

Reason for revert: not necessary, since VCN already has access to system APIs

Bug: 174606949
Test: revert with no conflicts
Change-Id: Ife2d0fc08c540265d52cdf930d0b6df005990ac8
2021-02-01 08:13:32 +00:00
Remi NGUYEN VAN
b71fc45e17 Move module sources to packages/Connectivity
Files that are planned to be part of the connectivity module are grouped
in packages/Connectivity, so they can be built separately and moved in
one operation with their history into packages/modules/Connectivity.

This places the files in the existing framework-connectivity-sources
filegroup instead of the current framework-core-sources filegroup. Both
are used the same way in framework-non-updatable-sources.

Bug: 171540887
Test: m
Change-Id: I62d9d91574ace6f5c4624035d190260c3126b91e
2021-02-01 11:52:14 +09:00
junyulai
0592b920cb [FUI04] Refactor VpnInfo
As a preparation of exposing system API. This patch does some
harmless refactoring, which includes:
  1. Change raw arrays into lists according to API guidelines.
  2. Write test.
  3. Rename class to UnderlyingNetworkInfo.
  4. Rename vpnIface to iface.
  5. Make underlyingIfaces @NonNull in order to adapt new
     unparceling code.
  6. implement equals and hashCode for testing.

Test: atest android.net.UnderlyingNetworkInfoTest
Bug: 174123988

Change-Id: I405c21e57c4af8a12a9dd0a1749b9e6690f87045
2021-01-29 17:44:32 +08:00
junyulai
67c69ad73f [FUI03] No-op refactoring of VpnInfo
As a preparation of exposing system API. This patch does some
harmless refactoring, which includes:
  1. Move VpnInfo to android.net
  2. Add nullability annotations
  3. Make members final

Bug: 174123988
Test: TH
Change-Id: I1530bb45d0e84c28c6deac33596bc686058afc0d
2021-01-27 15:03:06 +08:00
Chiachang Wang
a034331a56 Expose UdpEncapsulationSocket.getResourceId()
ConnectivityManager.createSocketKeepalive() will need to get
the socket resource ID as a parameter for creating a new
NattSocketKeepalive. ConnectivityManager is a part of incoming
ConnectivityService mainline, so expose getResourceId() as an
API since the hidden APIs are not accessible for a mainline
module. This API should not be exposed to apps, so make it a
MODULE_LIBRARIES system API.

Bug: 172183305
Test: make update-api
Change-Id: Ic0722352ea186fcb18a2d91cc3969f771fde9e86
2021-01-27 09:27:26 +08:00
Treehugger Robot
6fe4b878e5 Merge changes I713bc2ec,Ib9ab07c9
* changes:
  [FUI05] Remove wimax data usage unit test
  [FUI14] Get SSID from NetworkCapabilities
2021-01-26 13:13:24 +00:00
junyulai
c44d11ccec [FUI14] Get SSID from NetworkCapabilities
This allows subsequent patches to remove the need of exposing
SSID in NetworkState.

Test: atest NetworkStatsServiceTest
Bug: 174123988
Change-Id: Ib9ab07c9610954c9a5de035a3aefbf6d0bb0b53b
2021-01-22 23:58:14 +08:00
Yan Yan
160aac3fa0 Expose IPsec tunnel APIs from @SystemApi to public APIs
Since IKE APIs to negotiate IPsec tunnel migration (MOBIKE) are
public, all IPsec tunnel APIs should also be public so that public
callers are able to create, manage and migrate IPsec tunnels

Bug: 174606949
Test: atest IpSecManagerTunnelTest
Change-Id: I86aec334cfc937953f9c2b411cc55862032aae4d
2021-01-21 10:45:24 -08:00
Jeff Sharkey
1f69d15939 Pivot network statistics to use DataInput/Output.
Using these generalized interfaces is more flexible, since it enables
us to pivot the implementation being used internally.  In particular,
an upcoming CL will pivot them to use a more efficient alternative.

This is a no-op refactoring.

Bug: 176777285
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Ibd4717174cf1f136e9d5d80172ecb6e493265306
2021-01-06 18:48:12 -07:00
Remi NGUYEN VAN
be4248226c Merge "Register ethernet listeners on specific Executors" 2020-12-28 07:12:45 +00:00
Serik Beketayev
c809f6176b [Mainline] Migrate ProxyInfo
Bug: 173455434
Test: atest FrameworksNetTests
Change-Id: I924aed710b62a0c91b888a9e04ac2c90cdfd88d0
2020-12-23 22:15:51 -08:00
Baligh Uddin
67ba9e1d66 Migrate frameworks/base/wifi & frameworks/base/packages/OsuLogin
Migrate to packages/modules/Wifi.  This CL will be presubmit tested
once migration is complete.  This CL drops the code from
frameworks/base/wifi and migrated to packages/modules/Wifi.
Also adjusts visibility rules in frameworks/base/Android.bp
Bug: 137323948
Test: TH
Merged-In: I9031a37c84e17c2cf5c0552d1b33e8fd59216b92

Change-Id: I4ad80b1584f9f80dffed7786739b80f3aaf88cdc
2020-12-23 23:47:49 +00:00
Remi NGUYEN VAN
7adf0e84b8 Merge "Split NetworkUtils and NetworkUtilsInternal" 2020-12-23 01:19:27 +00:00
Chalard Jean
1c1883133b Move module utils to the module package.
Test: FrameworksWifiTest FrameworksNetTest
Change-Id: If5d1e4a58fb2d6d9544e6d01995dabe445cf1f25
Merged-In: I067eeecd458c34b7f2fbfa439072682661ac750c
2020-12-16 11:44:22 +09:00
Remi NGUYEN VAN
55838a8292 Register ethernet listeners on specific Executors
Have users of EthernetManager#addListener specify an Executor instead of
running callbacks on ConnectivityThread.
For existing clients, run callbacks on the common BackgroundThread.

This change in behavior is fine because addListener is not an API, the
threading model in Q was to run callbacks on the looper of the thread
that first created EthernetManager (so there is already no guarantee on
which thread is used), and the only users are in Settings.

ConnectivityThread is moving to a connectivity-specific JAR, so it
should not be used by external classes.

Bug: 174436414
Test: Ethernet client / tethering working
      atest TetheringIntegrationTests
Change-Id: Ic9a959f89915329f79eeeaa0a210ad50811d1291
2020-12-15 17:57:32 +09:00
Xin Li
efafd46947 Merge "DO NOT MERGE - Merge Android R QPR1" 2020-12-10 02:18:27 +00:00
Xin Li
449272426d DO NOT MERGE - Merge Android R QPR1
Bug: 172690556
Merged-In: Ib81ba3288a986546bc570c3759c55d026add591a
Change-Id: I2acfeb6cfc83a80056a685355cc367a5514da069
2020-12-09 17:55:44 -08:00
Serik Beketayev
6f3c1295e9 Merge "[Mainline Migration] Migrate NetworkUtils" am: a086c295e7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1498168

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icc0a49e76f87a741f4410b53e9a40012e37fde36
2020-12-10 00:08:03 +00:00
Remi NGUYEN VAN
8ce3c4680d Split NetworkUtils and NetworkUtilsInternal
NetworkUtils is planned to move to a dedicated JAR for connectivity
classes, while NetworkUtilsInternal would stay in the
frameworks-minus-apex JAR, in the com.android.internal.net package.

Bug: 171540887
Test: m, boots, wifi working
      atest FrameworksNetTests
Change-Id: I3d38d72ad23a4bf84af823c7baeb6fed25c0665f
2020-12-07 19:41:49 +09:00
Serik Beketayev
7f507337a7 [Mainline Migration] Migrate NetworkUtils
Migrating makeStrings(), numericToInetAddress() APIs

Bug: 173089079
Test: atest FrameworksNetTests
Change-Id: Ie914fd41bc3ce16d07f5d2768b89ce805b9245a9
2020-12-06 22:33:04 -08:00
Treehugger Robot
1453310967 Merge "Remove NATT keepalive from IpSecTransform" am: ef8a605c6f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1512881

Change-Id: I6a0e26ee28e1b9bb0906c840826b7a9ddc88a818
2020-12-04 03:56:01 +00:00
Remi NGUYEN VAN
f055bbd349 Merge "Set NetworkIdentity subscriberId on all networks" am: 1ded24221e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1512877

Change-Id: I6ebe5b398a14c85fe32b1b497c381963377dcdbe
2020-12-04 03:18:57 +00:00
Treehugger Robot
ef8a605c6f Merge "Remove NATT keepalive from IpSecTransform" 2020-12-04 02:07:56 +00:00
Remi NGUYEN VAN
9ae6c505e7 Merge "Remove hidden API usage in metrics toString" am: 179419f810
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1512876

Change-Id: Ie5c89993c019770cdf71818565ed86f50fe9fcd1
2020-12-03 03:47:27 +00:00
Remi NGUYEN VAN
f565045348 Set NetworkIdentity subscriberId on all networks
Instead of setting NetworkIdentity.subscriberId only on telephony
networks, set it when provided on any network. At the moment only
telephony is expected to have a subscriberId in its NetworkState anyway,
and while there are plans for other network agents (wifi) to have a
subscriberId, it should also be set in that case.

This allows NetworkIdentity to stop depending on hidden network type
APIs to determine if the network is mobile.

Bug: 174436414
Test: atest FrameworksNetTests
Change-Id: I4f09987f8737d1801342eb5d6d7c2b9968b466b0
2020-12-02 18:11:16 +09:00
Remi NGUYEN VAN
25f710ae47 Remove hidden API usage in metrics toString
Remove usage of hidden NetworkType, transport APIs in toString()
implementations of metrics and data usage classes.

The toString implementations can log the transports or network type as
hex or raw indices. While slightly less readable, the metrics classes
and network type APIs are deprecated.

Bug: 174436414
Test: m
Change-Id: I79239a540b66dadd3bbe0a997960530878331358
2020-12-02 18:10:59 +09:00
Xin Li
2ce0eab1c3 Merge rvc-qpr-dev-plus-aosp-without-vendor@6881855
Bug: 172690556
Merged-In: I78222391b83a4add8e964340ec08bb8a1306e1c6
Change-Id: I28bbf40820674675ccf765c912aa8140d3f74ab2
2020-12-02 00:38:58 -08:00
Remi NGUYEN VAN
75244b7d08 Remove NATT keepalive from IpSecTransform
The code is unused, and based on ConnectivityManager#startNattKeepalive,
which is deprecated.

Bug: 174436414
Test: atest FrameworksNetTests
Change-Id: I08c6c1baec668a304d971bb6f2328891a5611e6a
2020-11-30 17:24:10 +09:00
Junyu Lai
2cdfa304d2 Merge "Expose getTx/RxBytes in TrafficStats" am: 6ef6648cd9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1440245

Change-Id: I69eb11657318438dbe794da849182a08e1847f94
2020-11-25 04:14:46 +00:00
junyulai
3154d517c9 Expose getTx/RxBytes in TrafficStats
Test: atest FrameworksNetTests TrafficStatsTest
      atest android.net.cts android.net.wifi.cts
Bug: 164965653
Change-Id: I17b9d0bc2404c5727d4c4530ad941439b7b71a54
2020-11-24 12:11:08 +08:00
Aurimas Liutikas
8f02f86962 Merge "Remove legacy style metalava suppression" am: e1bb600fc7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1421698

Change-Id: I86186f315dbac925c11f99993dd71703bd12d6ca
2020-11-16 17:58:37 +00:00