Commit Graph

10847 Commits

Author SHA1 Message Date
lucaslin
42f8a914cf Use local defined constants for notification channels
ConnectivityService mainline module cannot call the members
inside SystemNotificationChannels.java. So use the local defined
constants instead.

Bug: 172040168
Test: atest FrameworksNetTests
Test: Manual test NO_INTERNET, SIGN_IN, PARTIAL_CONNECTIVITY,
      VPN_ALWAYS_ON notifications.
Change-Id: I223b207c4346e8239dee78e50dd2b0532a3e55b0
2020-11-02 11:53:16 +08:00
Paul Hu
bc2369abe9 Merge "Replace NotificationManager @hide APIs" 2020-10-30 03:36:40 +00:00
Chalard Jean
e4d25c4287 Merge "Fix a bug where modern network agents start in UNKNOWN" 2020-10-29 12:31:03 +00:00
Chalard Jean
3a7110e160 Fix a bug where modern network agents start in UNKNOWN
Modern network agents are supposed to have the following
lifecycle :
• Construct the agent
• Declare itself to connectivity by calling #register()
• Possibly do some setup
• Declare connected by calling #markConnected()
• Declare disconnected by calling #unregister()

Internally ConnectivityService still manages the state
with deprecated NetworkInfo, which has a lot of possible
detailed states, most of which are now unused. Internally,
the steps above translate to the states below :
• When the agent calls #register() it starts in state
  CONNECTING
• When it calls #markConnected() it goes to CONNECTED
• When it calls #unregister() it goes to DISCONNECTED which
  triggers the flow that disconnects it immediately
• ConnectivityService also synthesizes the SUSPENDED state
  under some situations, but that's not relevant here.

The translation above is done by the NetworkAgent class,
which translates #register(), #markConnected() and
The only valid lifecyle for new agents is thus :

CONNECTING → CONNECTED → disconnect
                 ↕         ↑
             SUSPENDED ───┘

Note that in the above scheme, there is no space for the
UNKNOWN state, which is only used by legacy network agents.
However, the constructor for NetworkInfo still starts with
UNKNOWN. Ideally the constructor for NetworkInfo would set
the info to CONNECTING instead, but this would be a very
visible change in behavior affecting many apps (especially
their tests), so for backward compatibility we can't do
that.

New network agents however don't expose their NetworkInfo
to the client code, so they can just be made to start in
CONNECTING the way it was meant.

Note that this didn't really have a concrete impact beyond
printing some logs as by and large the ConnectivityService
code handles UNKNOWN and CONNECTING the same way, or more
exactly it handles transitions to CONNECTED from UNKNOWN
and CONNECTING in the same way. The exception to this is
VPNs, which are not using the new agent API yet, and the
upcoming conversion is why this fix is actually needed now.

Bug: 170904131
Test: FrameworksNetTests NetworkStackTests
Test: new test in aosp/1460705
Change-Id: Ib7d906a7b29a0b9f000b90bc78558a7402852fa3
2020-10-29 12:30:44 +00:00
Treehugger Robot
04710577a4 Merge "Replace hidden NMS permission control API" 2020-10-29 07:03:37 +00:00
Xiao Ma
7167773060 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
cbcc4ae04c 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
3fa68ae83a Merge "Replace hidden NMS interface to network API" 2020-10-29 05:02:21 +00:00
paulhu
117bde44fa 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
edb833a1a5 Replace hidden NMS permission control API
Replace the hidden setNetworkPermission NMS APIs with accessing
INetd directly for the incoming ConnectivityService mainline.

Bug: 170598012
Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk
Change-Id: I37ed1003355677b98cbb741f774ba0fa4d193572
2020-10-28 14:38:18 +08:00
Chiachang Wang
6d5c0e714b Replace hidden NMS API for setting MTU
Replace the hidden NMS setMtu API with calling INetd directly
for incoming ConnectivityService mainline.

Bug: 170598012
Test: atest FrameworksNetTests
Test: manually connect and disconnect network
Change-Id: I6a51d8033b3354824d4cfb953c2bbe3055d00102
2020-10-28 14:38:18 +08:00
Chiachang Wang
f83a718af1 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
1b7ae75c11 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
James Mattis
4fcbb03489 Add OEM_PRIVATE NetworkCapability
Adding network capability to be used with networks to be only used by
OEM apps.

Bug: 171505922
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest
Change-Id: Ib55ebec0e178b6317d92f17e1aff060dacdfb2b1
2020-10-27 13:14:06 -07:00
Xiao Ma
ed0fdd959d 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
7f8bb808a8 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
Paul Hu
c04c6aaf58 Merge "Replace PendingIntent @hide APIs" 2020-10-26 07:32:56 +00:00
Treehugger Robot
de9d06b653 Merge "Add a mutability flag to the PendingIntent" 2020-10-23 09:49:27 +00:00
lucaslin
c3bc747513 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
Treehugger Robot
da47bb159d Merge "Address comments on aosp/1448415" 2020-10-21 07:05:49 +00:00
Chiachang Wang
0725c5791e Merge "Do not use hidden SystemProperties.set" 2020-10-21 07:00:56 +00:00
Chalard Jean
2669b29f1d Address comments on aosp/1448415
Adds the necessary jarjar rules to FrameworksTestNet and
removes the test for CompareResult which has moved to its
right place.

Test: FrameworksTestNet
Change-Id: I50e51e72268e432a65a831aa5eebd606584ac721
2020-10-21 13:54:02 +09:00
Anton Hansson
64b87b5aa5 Merge "Remove @TestApi from @SystemApi symbols" 2020-10-20 13:45:13 +00:00
Chiachang Wang
06e08ac406 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
c1215d3d46 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
a2d7ef0a8a Merge "Create service-connectivity.jar" 2020-10-20 06:09:41 +00:00
Anton Hansson
9a6fd906e6 Remove @TestApi from @SystemApi symbols
I ran these commands:
    cd frameworks/base
    grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \
        's/\@SystemApi[\s\n]+(\@\w+[\s\n]+)?\@TestApi/\@SystemApi\1/gs'
    grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \
        's/\@TestApi[\s\n]+(\@\w+[\s\n]+)?\@SystemApi/\1\@SystemApi/gs'

Bug: 171179806
Test: m checkapi
Change-Id: I772790b783b0a8730b8bf680c9e569a886b8d789
Merged-In: I772790b783b0a8730b8bf680c9e569a886b8d789
2020-10-19 16:41:01 +01:00
Chalard Jean
bc1d304dcf Merge "Remove unused methods from LinkProperties." am: 561107dd24
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1448415

Change-Id: I7adcc9920cc2bdebe9a1dc22f32ce0955a4524dd
2020-10-19 09:50:44 +00:00
Chalard Jean
561107dd24 Merge "Remove unused methods from LinkProperties." 2020-10-19 09:37:26 +00:00
Yan Yan
05fa7073b9 Merge changes from topic "new-ipsec-api" am: 3a07def46d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1398433

Change-Id: I074e1cc2d9b8e38d242c4a1c9b2176d3b8338774
2020-10-16 22:52:03 +00:00
Yan Yan
3a07def46d 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
9601189364 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
Bernie Innocenti
6baa1bf147 Merge "Stop setting the legacy net.dnsX system properties" am: 61da71aa03
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1229561

Change-Id: Id30674df53eead41a626eef81a0d7e449dfd7c83
2020-10-16 14:03:43 +00:00
Chiachang Wang
4273f77922 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
Chalard Jean
4d6c93d315 Remove unused methods from LinkProperties.
LinkProperties.compare{Dnses,ValidatedPrivateDnses,AllRoutes,
AllInterfaceNames} actually have no users.

Test: LinkPropertiesTest
Change-Id: Ic54ab3c5520fbbc2be1309aeaf1e5a7857dbd194
2020-10-16 15:32:19 +09:00
Yan Yan
94e7673031 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
Treehugger Robot
420e60a135 Merge "Add imports to networking test mapping" am: 3956c37ce2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1461982

Change-Id: I835d9c17377cee5adcc5f44cff3e1d4f0774aaa2
2020-10-15 11:07:41 +00:00
Treehugger Robot
3956c37ce2 Merge "Add imports to networking test mapping" 2020-10-15 10:21:25 +00:00
Remi NGUYEN VAN
aabe9cc987 Add imports to networking test mapping
Ensure that appropriate networking tests are triggered when submitting
changes in the frameworks/base directories.

Change-Id: Ibf8b567fa7721299120b0a6c6836dd770d92a9fc
Test: treehugger runs TEST_MAPPING tests
2020-10-15 09:16:40 +00:00
Treehugger Robot
29b63c7ccb Merge "Fix a typo in a comment" am: e7be8034b6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1459885

Change-Id: I9174acc91209d83526901587bf4603d61aa30acc
2020-10-14 11:24:43 +00:00
Treehugger Robot
e7be8034b6 Merge "Fix a typo in a comment" 2020-10-14 10:54:25 +00:00
paulhu
2af502226a Replace PendingIntent @hide APIs
Connectivity service module is using some PendingIntent @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
      Manually test notifications can show normally.
Change-Id: I92ab7216f5fd46d449b6d8f80d3441f8966ac890
2020-10-14 15:23:25 +08:00
Chalard Jean
c9fc48652a Fix a typo in a comment
Test: is not necessary for fixing typos in comments
Change-Id: Idf48d2649e728cafda5c1ca32d21102094cf23f5
2020-10-14 04:56:20 +00:00
paulhu
6f94c0f756 Add a mutability flag to the PendingIntent
It's soon going to be required for apps targeting S+ to specify
explicitly either FLAG_MUTABLE or FLAG_IMMUTABLE when creating
a PendingIntent. Thus, add a mutability flag to the
PendingIntent that doesn't specify it before.

Bug: 170602021
Bug: 170766590
Test: atest FrameworksNetTests
Change-Id: I56581033c0a1b450b6626112cdae5e5d9aac873f
2020-10-14 11:44:39 +08:00
Chiachang Wang
d1fff43886 Merge "Use system api for shell command handling" am: e07b484c22
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1456126

Change-Id: I322bbe2f711f8c50efe9d50056787c0e60051fbb
2020-10-13 09:29:47 +00:00
Chiachang Wang
e07b484c22 Merge "Use system api for shell command handling" 2020-10-13 08:41:40 +00:00
Chiachang Wang
77ae8a0bca Use system api for shell command handling
ConnectivityService should not use ShellCommand since it's @hide
which does not accessible in mainline modules. Replace it with
system api for mainline.

Bug: 170598012
Test: adb shell cmd connectivity airplane-mode enable
Test: adb shell cmd connectivity airplane-mode disable
Change-Id: I47e7a371c19eb18eac643fe9a2ab481bec5743c2
2020-10-13 08:41:24 +00:00
TreeHugger Robot
e9320762f1 Merge "Merge ab/6749736 in stage." into stage-aosp-master 2020-10-13 03:31:35 +00:00
Junyu Lai
db624043d5 Merge "Support dynamically update IMSI" am: 59f6e81b10
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1418348

Change-Id: Id06d5d37ad5f12e689643c916548e9a59089eb3b
2020-10-13 03:22:09 +00:00
Junyu Lai
59f6e81b10 Merge "Support dynamically update IMSI" 2020-10-13 02:41:47 +00:00