2353 Commits

Author SHA1 Message Date
Paul Hu
a1c0a06580 Merge "Replace Context @hide APIs" 2020-11-05 08:05:09 +00:00
Paul Hu
a80bc72775 Merge "Replace AppOpsManager @hide APIs" 2020-11-05 08:03:55 +00:00
Eran Messeri
bdd52cb48b 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
paulhu
431415622d Replace Context @hide APIs
Connectivity service module is using some Context @hide APIs but
they are not able to call after CS becomes a mainline module.
Thus, replace them with similar System APIs.

Bug: 170593746
Test: atest FrameworksNetTests
Test: Manully check that receiving intent and starting activity
      can work normally.
Change-Id: I0f5b53ce0da4e3fc0f927896e9a9e444048401bd
2020-11-04 00:02:42 +08:00
paulhu
c2139ed7e0 Replace AppOpsManager @hide APIs
Connectivity service module is using some AppOpsManager @hide
APIs but they are not able to call after CS become a
mainline module. Thus, replace them with similar System APIs.

Bug: 170593746
Test: atest FrameworksNetTests
Change-Id: I51f66b64fcc3ebdbc2fddff8371eb8d9ff134137
2020-11-03 22:27:16 +08:00
paulhu
8d9a5ebb61 NetworkNotificationManager gets NotificationManager locally
It's confusing that NetworkNotificationManager uses
NotificationManager to put up notifcation which is passed from
ConnectivityService. And that NotificationManager should be
gotten from a context with UserHandle.ALL because the
notification should notify to all users. But the future developer
may not know this and pass incorrect NotificationManager
probably. Therefore, adjust the design that
NetworkNotificationManager will get NotificationManager locally.

Bug: 170593746
Test: atest FrameworksNetTests
Change-Id: Id65c998052b7b223171c5194ea46b49d7e84729d
2020-10-30 03:37:50 +00:00
Paul Hu
ff4b8b180c Merge "Replace NotificationManager @hide APIs" 2020-10-30 03:36:40 +00:00
Xiao Ma
8e8460b4b3 Merge changes from topic "revert-1353490-revert-1323251-ipv6_prov_loss_quirk_parcelable-DVBHZDYMHA-MDHWFKJABZ"
* changes:
  Add jarjar rule for IPv6ProvisioningLossQuirk.
  Revert "Revert "Test IPv6ProvisioningLossParcelable in the NetworkAttributes"""
2020-10-29 05:39:16 +00:00
Chiachang Wang
b524e17519 Merge changes I6a51d803,I162fae5c
* changes:
  Replace hidden NMS API for setting MTU
  Replace hidden NMS default network configuration API
2020-10-29 05:03:43 +00:00
Chiachang Wang
2a40529747 Merge "Replace hidden NMS interface to network API" 2020-10-29 05:02:21 +00:00
paulhu
8fad618b9b Replace NotificationManager @hide APIs
Connectivity service module is using some NotificationManager
@hide APIs but they are not able to call after CS become a
mainline module. Thus, replace them with similar System APIs.

Bug: 170593746
Test: atest FrameworksNetTests
Change-Id: I2644867cfc01d8d651c7029134294a9d44fdb471
2020-10-28 16:24:37 +08:00
Chiachang Wang
1ee4a7485c Replace hidden NMS interface to network API
Replace the hidden NMS addInterfaceToNetwork and
removeInterfaceFromNetwork with calling INetd directly for
incoming ConnectivityService mainline.

Bug: 170598012
Test: atest FrameworksNetTests
Test: manually connect and disconnect network
Change-Id: I0f1f866be2f8084b992b340aeabfb5d62420686b
2020-10-28 14:38:18 +08:00
Chiachang Wang
ffa7b2f12c Replace hidden NMS default network configuration API
Replace the hidden setDefaultNetId and clearDefaultNetId NMS
APIs with accessing INetd directly for the incoming
ConnectivityService mainline.

Bug: 170598012
Test: atest FrameworksNetTests
Test: manually connect and disconnect wifi
Change-Id: I162fae5ca444207a037e5ac4bf8fa0a77a648ca1
2020-10-28 14:38:18 +08:00
Xiao Ma
391474ee97 Add jarjar rule for IPv6ProvisioningLossQuirk.
A new stable parcelable IPv6ProvisioningLossQuirk added in network
stack module, which is used to record the network quirk info which
causes IPv6 provisioning loss, e.g. the router lifetime in RA is 0
and the default route will be removed from LinkProperties.

Previously this change breaks CtsStrictJavaPackagesTestCases due to
a jarjar rule is missed. Also rename the package name based on the
revert change.

Also include slight stable AIDL package and variable rename.

Bug: 157534516
Test: atest CtsStrictJavaPackagesTestCases FrameworksNetTests
Change-Id: Ic2f6b75beefb574f7e2fb4c157667e7734eccd05
2020-10-27 08:04:29 +00:00
Xiao Ma
42c643a2e5 Revert "Revert "Test IPv6ProvisioningLossParcelable in the NetworkAttributes"""
Test IPv6ProvisioningLossParcelable in the NetworkAttributes.

Bug: 157534516
Test: atest NetworkStackTests

This reverts commit_3740bfadadaaf268f92aaf35dd92e4ce432b39cb

Reason for revert:
Roll forward the previous change, as the CtsStrictJavaPackagesTestCases
breakage has been addressed by adding the jarjar rule in wifi module.

Change-Id: Ib4d70ce557cad98643c811b219f51e9b68179ee8
2020-10-27 07:49:05 +00:00
lucaslin
6a297b8aac Using Context#getSystemService instead of ServiceManager#checkService
ConnectivityService is going to be a mainline module, it can only
use formal APIs or @SystemApi. So use public API -
Context#getSystemService() instead of hidden API -
ServiceManager#checkService().

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I9824caa7aec57e70f0ba405fcce39f9bc068732d
2020-10-23 03:07:07 +00:00
Chiachang Wang
8c6ec17bac Merge "Do not use hidden SystemProperties.set" 2020-10-21 07:00:56 +00:00
Chiachang Wang
39c509f8b3 Do not use hidden SystemProperties.set
ConnectivityService is going to become a mainline module, and
it will not able to use hidden method anymore. Thus, use
alternative new sysprop as API to control the tcp init rwnd
value.

Bug: 170917042
Test: adb shell getprop net.tcp_def_init_rwnd and check if
      value is set correctly
Test: atest FrameworksNetTests
Change-Id: If9e99c88de50b6829721b0dfacc430a3b53c7728
2020-10-20 19:35:01 +08:00
Chiachang Wang
806eae49ff Remove unused MockableSystemProperties from DnsManager constructor
DnsManager does not use MockableSystemProperties to communicate
with netd to configure the dns server anymore. ConnectivityService
does not need to take it into DnsManager as a parameter. Thus,
clean up the unused code.

Bug: 33308258
Test: atest FrameworksNetTests
Change-Id: I2ac89944391f7d1fd5d67f26cf7f2b11a4a4cf84
2020-10-20 15:46:30 +08:00
Aaron Huang
bfceacea50 Merge "Create service-connectivity.jar" 2020-10-20 06:09:41 +00:00
Yan Yan
a80fb3bbe6 Merge changes from topic "new-ipsec-api"
* changes:
  Expose new algorithms as public API
  Add new mandatory IPsec algorithms
2020-10-16 22:30:37 +00:00
Aaron Huang
944025aef2 Create service-connectivity.jar
Create a new target service-connectivity to split
ConnectivityService from services.core.

Add ConnectivityServiceInitializer for initializing
ConnectivityService and add systemReady() in
ConnectivityManager so that SystemServer can call systemReady()
through ConnectivityManager which won't change current behavior.

Bug: 158268939
Test: make target-java, make host-java
      atest FrameworksNetIntegrationTests
      atest FrameworksNetTests
      make, device can boot,
      atest CtsStrictJavaPackagesTestCases
      wifi and mobile data work.
Change-Id: I99401772ba9c1c34adca20040da3c7c72d86ddd9
Merged-In: Ie732bfaf381404af0bb599ca2f421a96e7aa4257
2020-10-16 22:46:14 +08:00
Chiachang Wang
d15eccf22a Stop setting the legacy net.dnsX system properties
These have been locked down via SELinux for a while and thus
they should be safe to delete at this point.

Test: atest FrameworksNetTest
Bug: 33308258
Bug: 148724751
Change-Id: I3a1e9c6ad92c8d2367e0048e5d6cd7d06bbc6e80
2020-10-16 08:19:25 +00:00
Yan Yan
27267b655c Add new mandatory IPsec algorithms
This CL adds new mandatory IPsec algorithms and allows
OEM to enable them on old devices using resource overlay

Bug: 161716062
Test: FrameworksNetTests:IpSecAlgorithmTest
Change-Id: Ib827b05ea27dbe61b14ad236e858f825293ed994
2020-10-15 17:35:17 -07:00
Junyu Lai
5d2e89e03d Merge "Support dynamically update IMSI" 2020-10-13 02:41:47 +00:00
junyulai
e60d9a82c9 Support dynamically update IMSI
Currently, NetworkStatsSubscriptionsMonitor will skip the
listener registration until the IMSI is available to deal
with SIM PIN locked case. However, this solution can only
handle the case that IMSI changes from/to null. And it also
relies on the assumption that IMSI never changes for a subId.

Thus, support dynamically update IMSI to handle IMSI changes
more robustly.

This patch also address leftover comments at ag/12400327.

Test: enable SIM PIN and manually test
Test: atest NetworkStatsSubscriptionsMonitorTest#testSubscriberIdUnavailable
Test: atest NetworkStatsSubscriptionsMonitorTest#testSubscriberIdChanged
Test: ./out/host/linux-x86/bin/statsd_testdrive 10082
Bug: 160941101

Change-Id: I625a5b10ee4806f6fee99c2d9d6c5e7977ff785e
2020-10-12 15:31:02 +08:00
Lorenzo Colitti
392b52f49f Merge "Speculatively fix L2TP keepalive issues by reducing mtu" 2020-10-12 00:40:44 +00:00
Remi NGUYEN VAN
e842db3548 Merge "Move IpUtils to frameworks/libs/net" 2020-10-09 00:13:40 +00:00
Chiachang Wang
8c1372ed1d Update to positive logic to better match the method naming
The method checkInterfacePresent seems that should return if the
interface is present or not, but it actually return an opposite
result. It may confuse the caller. E.g. The override method in
VpnTest assume it always returns true in the test. It will fail
the vpn start flow due to interface gone.

Bug: 169215213
Test: atest FrameworksNetTess
Change-Id: I3e9a64f0900336b8205674b94db68f090b4e9ff9
2020-10-07 06:48:15 +00:00
Remi NGUYEN VAN
6387974158 Move IpUtils to frameworks/libs/net
The utility classes are useful for mainline modules and their tests, for
example IpClientIntegrationTest.

Bug: 168868607
Test: m && atest NetworkStaticLibTests
Change-Id: If2b1613aa18a7990391e2d31cc2951ca93f1cf3c
2020-10-05 14:38:19 +09:00
Benedict Wong
5113da7e85 Speculatively fix L2TP keepalive issues by reducing mtu
This change reduces MTU/MRU values for racoon/pppd from 1400 to 1388 in
an attempt to fix keepalive issues experienced in the field.

Bug: 119076193
Test: Speculative change, original issues were not reproducible.
Change-Id: I7731503260fdc8bcbc6c5fcda6991ead6fb7c52e
2020-09-28 20:55:55 -07:00
Benedict Wong
9df1022c7a Merge "Provide more feedback to Settings when sessions fail" 2020-09-25 17:25:02 +00:00
Benedict Wong
1d0275d98b Provide more feedback to Settings when sessions fail
This change updates the VPN state when IKEv2 sessions fail, and when
configuration errors occur.

Bug: 162289824
Test: Manual testing with IKEv2/PSK
Change-Id: I2e8c6f421d2898f97b0ac422b2276edf9ef923f1
2020-09-24 23:32:09 -07:00
junyulai
08ea47d0a1 Skip stop if keepalive is already in stopping state
In current design, crash has been generated when stop function
has been re-entered to catch unexpected behavior. However,
it is possible to re-enter stop function if the network
disconnection occurs after stopping.

Thus, skip stop if keepalive is already in stopping state.

Test: atest ConnectivityServiceTest#testNattSocketKeepalives \
      --rerun-until-failure 60000
Bug: 167332570
Change-Id: Ic7068ad3dc990e957c37b8d87d48ebb6469b101f
2020-09-17 19:51:34 +08:00
Xin Li
628590d7ec Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: I3d92a6de21a938f6b352ec26dc23420c0fe02b27
Change-Id: Ifdb80563ef042738778ebb8a7581a97c4e3d96e2
2020-08-31 21:21:38 -07:00
Junyu Lai
6d7c1854a8 Merge "Notify the keepalive is stopped after the slot has been released" 2020-08-28 10:12:44 +00:00
Treehugger Robot
b74cd6eb18 Merge "Skip RAT type listener registration if IMSI is not available" 2020-08-25 19:55:09 +00:00
junyulai
781bce9c7f Skip RAT type listener registration if IMSI is not available
Currently, if SIM is inserted but IMSI is not available, such
as SIM PIN locked state. Information of such SIM will still
be available but IMSI is not. Which makes
NetworkStatsSubscriptionMonitor failed to store IMSI locally
for later RAT type query. Hence, NETWORK_TYPE_UNKNOWN is
always returned for such SIM.

Skip the registration until the IMSI is available. This is safe
since there will be another onSubscriptionsChanged event when
that happens.

Test: enable SIM PIN and manually test
Test: atest NetworkStatsSubscriptionsMonitorTest#testSubscriberIdUnavailable
Test: ./out/host/linux-x86/bin/statsd_testdrive 10082
Bug: 160941101
Merged-In: I408379b3c432d9e62e0837d6b4f6551cc7838e29
Change-Id: I408379b3c432d9e62e0837d6b4f6551cc7838e29
(cherry-picked from ag/12400327)
2020-08-25 18:03:38 +08:00
Paul Hu
50bb631f03 Merge "Revert "[RFPM03] Check permission by uid."" 2020-08-20 08:24:30 +00:00
Paul Hu
aad5331ee2 Merge "Revert "[RFPM04] Adjust hasRestrictedNetworkPermission method"" 2020-08-20 08:14:48 +00:00
Paul Hu
f8115452a7 Merge "Revert "[RFPM05] Add UidNetdPermissionInfo class"" 2020-08-20 06:25:06 +00:00
Paul Hu
7e947abcb5 Revert "[RFPM03] Check permission by uid."
This reverts commit ab4ad20eef8cb3176801f3a2a08ae635d869fa53.

Reason for revert: Regression in SW.  Bug:162499840

Change-Id: Ic93e762e41a728f66e200e5bc8e40ebe4c7b44f7
2020-08-20 06:23:16 +00:00
Paul Hu
2878288b3a Revert "[RFPM04] Adjust hasRestrictedNetworkPermission method"
This reverts commit 29100e889200c6d74ee7a120a1c356e2c89e48e2.

Reason for revert: Regression in SW.  Bug:162499840

Change-Id: I96bf28ffc9f2d8f3838cb6d2dac16f89a70177ed
2020-08-20 06:23:00 +00:00
Paul Hu
93b5848141 Revert "[RFPM05] Add UidNetdPermissionInfo class"
This reverts commit 26263b3cd0f6855f6e38ab22da7d8e883133a5f4.

Reason for revert: Regression in SW.  Bug:162499840

Change-Id: I0e846efcc4fc06b53d97b2007e0d8e8f97c6ac10
2020-08-20 03:10:08 +00:00
junyulai
eed8c6bb26 Notify the keepalive is stopped after the slot has been released
Currently, the callbacks of stopping were fired when stop procedure
is started, because the upper layer apps only care about the reason
of stopping instead of stopping result. Thus, there is no need to
wait for the result comes back. However, this behavior generates
races if apps want to re-start keepalive immediately since the
resources are not released yet.

Fix: 134891441
Fix: 140305589
Test: atest com.android.server.ConnectivityServiceTest#testPacketKeepalives \
      --rerun-until-failure 1000

Change-Id: I987776a9211a50e964c4675b747bc10e203750f1
2020-08-20 11:00:08 +08:00
Chalard Jean
b1a3247ab4 Merge "Rename Kotlin util files to not include the Kt suffix" 2020-08-13 03:52:47 +00:00
Chiachang Wang
2dd299c5db Merge "Update language to comply with Android's inclusive language guidance" 2020-08-12 09:30:11 +00:00
Paul Hu
06697e0c43 Merge "[RFPM05] Add UidNetdPermissionInfo class" 2020-08-12 06:17:46 +00:00
Chiachang Wang
97698a6fc5 Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code
for reference.

Bug: 161896447
Test: m ; atest FrameworkNetTests
Change-Id: Ib6b4c9526992c31e05e82be80e2b9b86bc0b57ef
2020-08-12 12:23:59 +08:00
paulhu
26263b3cd0 [RFPM05] Add UidNetdPermissionInfo class
Add UidNetdPermissionInfo class to store netd permission info of
each uid. Use the bit mask for combining all netd permission into
one value which can update and get the uid permission easily.
Moreover, aosp/1340042 add carryover package info into this class
which centralizes all netd permissions relevant data.

Bug: 132784544
Test: atest FrameworksNetTests
Change-Id: I3b81ea2a5017e8f4d0d603144a33c9b08640d7ba
2020-08-12 10:33:18 +08:00