Commit Graph

11601 Commits

Author SHA1 Message Date
James Mattis
60b84b216b Adding multilayered requests to NetworkRequestInfo
Updating NetworkRequestInfo for "multilayered requests" functionality so that
requests can support a network hierarchy. I.e., requests network
with capability A first and if not available, request network with
capability B. This CL is the first step in adding that support by
updating the request object from a single request to a collection.

Bug: 171991028
Test: atest FrameworksNetTests
atest NetworkStackTests
atest FrameworksNetIntegrationTests
atest NetworkStackIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I64a124802986e4cf4aa7de158c6690fdf9851cb2
2020-11-05 13:55:50 -08:00
Paul Hu
1d8f82be44 Merge "Replace Context @hide APIs" am: 9869d309a6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1458063

Change-Id: I914ee12abdcba7c53fb868425592d6458a797e23
2020-11-05 08:53:01 +00:00
Paul Hu
e0c53d6fe1 Merge "Replace AppOpsManager @hide APIs" am: 55f45703ad
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1469126

Change-Id: I6222db7e8f966d7df17de9c46b5e26e715ecccf2
2020-11-05 08:45:52 +00:00
Paul Hu
9869d309a6 Merge "Replace Context @hide APIs" 2020-11-05 08:05:09 +00:00
Paul Hu
55f45703ad Merge "Replace AppOpsManager @hide APIs" 2020-11-05 08:03:55 +00:00
James Mattis
1d41ff3469 Merge "Adding @IgnoreUpTo for testOemPrivate" am: df86206d82
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1487452

Change-Id: I92bd7437dede4ae4a4bb27dfbf68a5ae74553811
2020-11-05 05:24:33 +00:00
James Mattis
4ebbddcf54 Adding @IgnoreUpTo for testOemPrivate
Adding @IgnoreUpTo for NetworkCapabilitiesTest.testOemPrivate so that
this test can run on previous releases.

Bug: 172400600
Bug: 171505922
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest
Change-Id: Ibc728c986ad6faeed78c631ca2675956b95c6ac1
2020-11-04 16:52:11 -08:00
Eran Messeri
63f53792de DO NOT MERGE: Introduce DPMS shim for active DO/PO check am: f8f47c569d
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
f8f47c569d 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
e1a17baab9 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
lucaslin
ec9ab79f1a Use hasIpv[4|6]DefaultRoute instead of hasIPv[4|6]DefaultRoute
ConnectivityService is going to be a mainline module, it can only
use formal APIs or @SystemApi. So use @SystemApi
hasIpv4DefaultRoute and hasIpv6DefaultRoute instead of
hasIPv4DefaultRoute and hasIPv6DefaultRoute.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: I67e5fa234fbb6d0b9739ae3295eb0b0ea108f582
2020-11-04 01:29:53 +00:00
paulhu
edd411a28d 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
8dc153e6e7 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
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
Treehugger Robot
f1ad7f45ff Merge "NetworkNotificationManager gets NotificationManager locally" am: a13966feea
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1459882

Change-Id: I1a3b685f04d7b4d7d5a028015e94742c83db2dc8
2020-10-30 10:37:17 +00:00
Paul Hu
511a42e9f3 Merge "Replace NotificationManager @hide APIs" am: bc2369abe9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1452435

Change-Id: I58d1c42c112855e43df6d6af4cd6e10373cff2bb
2020-10-30 04:00:36 +00:00
paulhu
539aa9a22c 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
bc2369abe9 Merge "Replace NotificationManager @hide APIs" 2020-10-30 03:36:40 +00:00
Chalard Jean
7de19bdcf0 Merge "Fix a bug where modern network agents start in UNKNOWN" am: e4d25c4287
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1460964

Change-Id: I69c5b8712791491552879c6d5aba5352ea03adfc
2020-10-29 13:10:05 +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
e2e4f1cc38 Merge "Replace hidden NMS permission control API" am: 04710577a4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1473957

Change-Id: I44840dc0c5ab4421976f606afcced0573e3dfe60
2020-10-29 07:34:41 +00:00
Treehugger Robot
04710577a4 Merge "Replace hidden NMS permission control API" 2020-10-29 07:03:37 +00:00
Xiao Ma
944185cd60 Merge changes from topic "revert-1353490-revert-1323251-ipv6_prov_loss_quirk_parcelable-DVBHZDYMHA-MDHWFKJABZ" am: 7167773060
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1460265

Change-Id: I49ce3e1c7794dc6db0e410cba481eb98144bc4e5
2020-10-29 06:17:22 +00:00
Xiao Ma
662b48fa37 Revert "Revert "Test IPv6ProvisioningLossParcelable in the NetworkAttributes""" am: 7f8bb808a8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1460264

Change-Id: Ie13b2bb8037d85ab4782e06cfc31e108397fc78b
2020-10-29 06:09:44 +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