Commit Graph

2674 Commits

Author SHA1 Message Date
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
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
Aurimas Liutikas
9de1e0e438 Remove legacy style metalava suppression
@SuppressLint("Doclava125") is a legacy way of suppressing
RequiresPermission check. Updating to the new style of suppression
so metalava no longer has to support the legacy mode.

sed -i "s/@SuppressLint(\"Doclava125/@SuppressLint(\"RequiresPermission/" \
core/java/android/app/admin/DevicePolicyManager.java \
core/java/android/hardware/hdmi/HdmiControlManager.java \
core/java/android/hardware/location/ContextHubManager.java \
core/java/android/hardware/usb/UsbDeviceConnection.java \
core/java/android/net/TrafficStats.java \
core/java/android/os/RecoverySystem.java \
core/java/android/os/storage/StorageManager.java \
core/java/android/service/persistentdata/PersistentDataBlockManager.java \
location/java/android/location/LocationManager.java \
media/java/android/media/AudioManager.java \
telecomm/java/android/telecom/TelecomManager.java \
telephony/java/android/telephony/CarrierConfigManager.java \
telephony/java/android/telephony/TelephonyManager.java \
wifi/java/android/net/wifi/RttManager.java \
wifi/java/android/net/wifi/WifiScanner.java

Test: make
Exempt-From-Owner-Approval: No-op change
Merged-In: I6d5df95cfca2950ea86872d2f0afc1ba828841dc
Change-Id: I6d5df95cfca2950ea86872d2f0afc1ba828841dc
2020-11-12 18:30:12 -08:00
Junyu Lai
24d691f04d Merge changes I6a48d4db,I6741c41c,Ifec6bde5,Icd0717c5 am: 07cfc92259
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1490617

Change-Id: I5545dddcb5c8499ac9c53325cbafd424124429e1
2020-11-12 09:02:13 +00:00
Junyu Lai
07cfc92259 Merge changes I6a48d4db,I6741c41c,Ifec6bde5,Icd0717c5
* changes:
  Remove unused variables
  Return offloaded traffic when querying from TrafficStats API
  Add hardware tethering traffic in testTethering test
  Remove unused getTetherStats
2020-11-12 08:45:15 +00:00
junyulai
a545c35fa4 Remove unused variables
From aosp/537809, variables that used to fetch realtime
stats are defined in NetworkStatsService. These varialbles
are filled by JNI in boot up stage in order to keep
definitions sync with native layer.

However, there is still a copy in TrafficStats.java, and this
copy cannot be filled in boot-up stage since it is in app
process. Besides, making a binder call to fetch these
constants from service is considered an overkill.

Thus, since there is no caller to these variables and callers
should use definitions in TrafficStats, remove these variables.

Test: atest FrameworksNetTests
Bug: 16229221
Change-Id: I6a48d4dbb1b824cfc6c4a47395b2a76aa28cf5c9
2020-11-12 14:22:31 +08:00
junyulai
ea2363294f Return offloaded traffic when querying from TrafficStats API
TrafficStats API are being used for querying realtime network
statistics for years. However, on certain devices, some network
traffic are produced by hardware components and not be
able to seen by kernel counters.

Thus, include statistics for those missing network traffic is
necessary. Note that the included statistics might be stale
since polling newest stats from hardware might impact system
health and not suitable for TrafficStats API use cases.

Test: atest FrameworksNetTests TetheringTests
Bug: 16229221

Change-Id: I6741c41cb5145ca8748f9b083b9c15e7e2735681
2020-11-12 14:22:31 +08:00
Mathew Inwood
6b8c99737d Merge "Add maxTargetSdk restriction to unused APIs." am: db3bb00d7b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1468245

Change-Id: I35f65987f7f9287cf03418e9feb27c81f4fd1878
2020-11-09 15:09:11 +00:00
Mathew Inwood
db3bb00d7b Merge "Add maxTargetSdk restriction to unused APIs." 2020-11-09 14:41:20 +00:00
junyulai
e3be94d65c Remove unused getTetherStats
Before Android R, getTetherStats were used to collect tethering
iface stats of all clients who extends ITetheringStatsProvider,
which typically contains NetdTetheringStatsProvider and
OffloadController.

However, this always returns 0 since Android R, because:
  1. OffloadController implemented NetworkStatsProvider and no
     longer reports stats through getTetherStats.
  2. NetdTetheringStatsProvider always return 0 by design since
     non-offloaded iface tethering stats are already included
     in native iface stats.

This change is a no-op refactoring to remove unused
getTetherStats and update test which is not pratical.
Fix for offloaded tethering stats will be in follow-up CLs.

Test: atest FrameworksNetTests TetheringTests
Bug: 162292214
Change-Id: Icd0717c5c2807ae3bd98626b897e4b148f142815
2020-11-06 19:02:44 +08:00
Eran Messeri
a8efd2bc0c DO NOT MERGE: Introduce DPMS shim for active DO/PO check am: 0c94b53855
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1486196

Change-Id: I79e090d92c5bf17993f8e4f710581675eb72f2a9
2020-11-04 12:24:40 +00:00
Eran Messeri
0c94b53855 DO NOT MERGE: Introduce DPMS shim for active DO/PO check
Introduce a shim into DevicePolicyManagerInternal &
DevicePolicyManagerService so that NetworkStatsAccessTest would not
diverge from internal development branches.

The DevicePolicyManagerService refactoring on the internal branch
removed isActiveAdminWithPolicy in favour of isActiveDeviceOwner and
isActiveProfileOwner.

These methods are being made available in AOSP for
NetworkStatsAccessTest.

Bug: 170459325
Test: atest NetworkStatsAccessTest
Change-Id: Ic7e0898989fb8222aaba2b35436765c04eb3250c
2020-11-04 10:07:06 +00:00
Mathew Inwood
fe2fed741e Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
2020-11-04 09:45:53 +00:00
Treehugger Robot
3672e620c9 Merge "Apply FLAG_IMMUTABLE to the PendingIntent in NetworkStatService.java" am: 2c0bf15a21
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1481721

Change-Id: I175f062b3d7f5ead9cbab6142ba1a126ce311d45
2020-11-03 00:34:39 +00:00
Ashwini Oruganti
c5c6f28294 Apply FLAG_IMMUTABLE to the PendingIntent in NetworkStatService.java
Broadcast intents sent by AlarmManager are immutable; the system
dispatches them without customization.

Fixes: 171815343
Test: TH
Change-Id: I35ccfc0f69fd98b5803da74d9eb12902b351acc7
Merged-In: I35ccfc0f69fd98b5803da74d9eb12902b351acc7
2020-10-30 10:49:45 -07:00
Treehugger Robot
31afdad66a [automerger skipped] Merge "Restructure Module code [ com.android.tethering ]" am: c8769826af -s ours
am skip reason: Change-Id Ib4a3a7a14d7d0e544aadf1bfb21ad390f1ba76a7 with SHA-1 62822a92cd is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1479716

Change-Id: I47de082b8e60278e8baa8381a384001d636e6f90
2020-10-30 09:13:35 +00:00
Baligh Uddin
b6caaa4c1e Restructure Module code [ com.android.tethering ]
Code Migration from frameworks/base/packages/Tethering ->
packages/modules/Connectivity/Tethering

BUG: 167962976
Test: m com.android.tethering + TH
Merged-In: Ib4a3a7a14d7d0e544aadf1bfb21ad390f1ba76a7
Change-Id: Ifae56d991b43c02f1e3496abbafc87d1869add8a
2020-10-30 05:44:59 +00:00