Commit Graph

12606 Commits

Author SHA1 Message Date
Roshan Pius
39ff19da2f resolve merge conflicts of d2c4f1d6c8 to stage-aosp-master
Merged-In: Ib9d7923104ac0a60f6af5a3a2d2b7f13bc0262e3
Change-Id: Ib9d7923104ac0a60f6af5a3a2d2b7f13bc0262e3
2021-03-21 19:20:35 +00:00
Chiachang Wang
9991401b9d [automerger skipped] Revert "Revert "Expose uids related APIs in NetworkRequest and N..." am: 8d81c8d76b -s ours
am skip reason: skip tag Change-Id I107c329d4d7130d488772166eae8b5e7aaa2ff04 with SHA-1 f379ceec8e is already in history

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

Change-Id: I1773af223afb67d522cc05d3658608505340023e
2021-03-21 16:55:29 +00:00
Lorenzo Colitti
dd37a5d576 Merge changes from topic "backport-connectivityresources" am: a31a7b1bf4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645297

Change-Id: Id6e8f89870b70332212e9052168e6f7c2faa3ee3
2021-03-21 16:51:02 +00:00
Lorenzo Colitti
eb0dc8f775 Cherry-pick some test changes from ag/13210542. am: e7963a1d82
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645000

Change-Id: Iebfee24a963aac516bf44ef70128ffdaeec25a45
2021-03-21 16:48:06 +00:00
Remi NGUYEN VAN
00b56b8d0d Add connectivity protos to framework-connectivity am: 953819d7f0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635040

Change-Id: Idebb84324407d0ce2f0066888b14fc22df736515
2021-03-21 16:45:11 +00:00
paulhu
143739703d Remove unused NetworkPolicyManagerInternal in CS am: c850635440
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1646969

Change-Id: I5a838b1017d1648e67576bfd7940ea9161b2c764
2021-03-21 16:43:40 +00:00
Remi NGUYEN VAN
e6fe8b4103 Move connectivity AIDLs to android.net am: 6ed4472b63
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1596272

Change-Id: If61c15ea55ec2081eab7fd2368e77f16ef51c769
2021-03-21 16:41:38 +00:00
Treehugger Robot
d2c4f1d6c8 Merge changes from topics "revert-1645768-revert-1626206-replaceUidRange-MSYTKFNGUE-HIUTVTIGIR", "ti_redaction"
* changes:
  TransportInfo: Add a generic redaction mechanism
  Revert "Revert "Expose uids related APIs in NetworkRequest and N..."
  Revert^2 "Replace the usage of UidRange"
2021-03-21 16:41:13 +00:00
Remi NGUYEN VAN
1f00de9e81 Migrate framework-connectivity internal resources am: 8e12782094
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1641905

Change-Id: I21a5632d566b2ef883c48f60b420fb76d04a3e05
2021-03-21 16:38:40 +00:00
Remi NGUYEN VAN
6f3429172b Add multipath preference, background status API am: 0f91b7a19a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1644388

Change-Id: I4c1a53223c4cce7759b2cc3efb74a6568abcde57
2021-03-21 16:37:02 +00:00
Lorenzo Colitti
a31a7b1bf4 Merge changes from topic "backport-connectivityresources"
* changes:
  Use module resources in NetworkNotificationManager.
  Cherry-pick some test changes from ag/13210542.
  Add connectivity protos to framework-connectivity
  Remove unused NetworkPolicyManagerInternal in CS
  Move connectivity AIDLs to android.net
  Migrate framework-connectivity internal resources
  Expose isUidNetworkingBlocked and isUidRestrictedOnMeteredNetworks
  Add multipath preference, background status API
2021-03-21 15:47:28 +00:00
Lorenzo Colitti
e7963a1d82 Cherry-pick some test changes from ag/13210542.
ag/13210542 switched from using reset() on mResources to using
clearInvocations(). This ensures that only the previous calls are
reset, and that the mock continues to behave according to what
was specified in setUp.

Test: 183097033
Test: test-only change
Merged-In: I35d28c8df341dbbac2774026c6ca749e296c0482
Change-Id: Ieef982d2df50db3014f35f58a77674939ebe0d43
2021-03-21 01:54:51 +09:00
Lorenzo Colitti
2ce7470845 Use module resources in NetworkNotificationManager.
Also make getTransportName non-static so it can access the module
resources.

Also fix a duplicate comment in a resource file.

Bug: 183097033
Test: atest FrameworksNetTests
Test: connected to Wi-Fi with no Internet, observed notification
Change-Id: Ic0d24d36af0b87153d527083f8964ddc6cd78482
Merged-In: Ic0d24d36af0b87153d527083f8964ddc6cd78482
2021-03-21 01:54:51 +09:00
Lorenzo Colitti
cc018f77ec Merge "Copy NetworkNotificationManager resources to conectivity module." am: 4385ef6896
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1644996

Change-Id: I97d371fc7c299828c34d1d60965e9f4959e685a3
2021-03-20 14:30:22 +00:00
Lorenzo Colitti
4385ef6896 Merge "Copy NetworkNotificationManager resources to conectivity module." 2021-03-20 13:52:46 +00:00
Remi NGUYEN VAN
953819d7f0 Add connectivity protos to framework-connectivity
The protos are built separately by framework-connectivity from framework
protos, keeping only android.net protos for the connectivity jar.

Bug: 171860710
Test: m framework-connectivity.impl
Change-Id: I2c4a37ff2ee9e8efde49885feeafa27dcff7ca2c
Merged-In: I2c4a37ff2ee9e8efde49885feeafa27dcff7ca2c
2021-03-20 22:51:35 +09:00
paulhu
c850635440 Remove unused NetworkPolicyManagerInternal in CS
ConnectivityService doesn't call any NPMI methods, so remove all
usage from CS.

Bug: 170598012
Test: atest FrameworksNetTests
Test: atest FrameworksNetIntegrationTests
Change-Id: I8719ef2e96e7db9da2894b467b9e7a1bc09de386
Merged-In: I8719ef2e96e7db9da2894b467b9e7a1bc09de386
2021-03-20 22:51:35 +09:00
Remi NGUYEN VAN
6ed4472b63 Move connectivity AIDLs to android.net
java_sdk_libraries and apexes need to contain bootclasspath classes
under predefined packages. Tethering currently uses android.net, so make
sure all the connectivity bootclasspath classes are under android.net.

This avoids maintaining two packages for the tethering APEX, where
com.android.connectivity.aidl is only used by internal AIDL files.

Bug: 182984842
Test: m
Change-Id: I611f1941698c574e37aea912ee76dadc8b32e41a
Merged-In: I611f1941698c574e37aea912ee76dadc8b32e41a
2021-03-20 22:51:35 +09:00
Remi NGUYEN VAN
8e12782094 Migrate framework-connectivity internal resources
Use ServiceConnectivityResources instead.
Start by creating resources in the ServiceConnectivityResources package
to match the internal configuration, and common overlays.

Bug: 182125649
Test: device boots, has connectivity
Change-Id: I77a3efca2cd644f9828db1ed5d3cae8070fb8363
Merged-In: I77a3efca2cd644f9828db1ed5d3cae8070fb8363
2021-03-20 22:35:16 +09:00
Remi NGUYEN VAN
0f91b7a19a Add multipath preference, background status API
Add APIs for getMultipathPreference and getRestrictBackgroundStatus.
Both are used by Connectivity to back the external
ConnectivityManager.getRestrictBackgroundStatus, and
ConnectivityManager.getMultipathPreference APIs.

Test: atest CtsNetTestCases
      atest ConnectivityServiceTests
      atest NetworkPolicyManagerServiceTest
Bug: 176289731
Change-Id: I8a03162b2f6691086bb64e75ffd354cdfca7f86a
Merged-In: I8a03162b2f6691086bb64e75ffd354cdfca7f86a
2021-03-20 22:23:16 +09:00
Lorenzo Colitti
f40003c502 Copy NetworkNotificationManager resources to conectivity module.
The localized resources were automatically generated with:

===========
export OLDRES=core/res/res
export NEWRES=packages/Connectivity/service/ServiceConnectivityResources/res
export FILE=services/core/java/com/android/server/connectivity/NetworkNotificationManager.java

for i in $OLDRES/values-*/strings.xml; do
    outfile=$NEWRES/${i#core/res/res/}
    outdir=$(dirname $outfile)

    if egrep -q "$regex" $i || egrep -q "$strarrayregex" $i; then
        mkdir -p $outdir

        cat << EOF > $outfile
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2021 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
EOF

        egrep $regex $i >> $outfile

        egrep -A $strarraylines "$strarrayregex" $i >> $outfile

        echo "</resources>" >> $outfile
    fi
done
===========

The text to the the base resources file was added manually from
the output of:

===========
egrep -B 2 $regex core/res/res/values/strings.xml  | grep -v -- ^--
egrep -B 2 -A 6 $strarrayregex core/res/res/values/strings.xml  | grep -v -- ^--
===========

The drawables were copied from the Wifi resources and from the
framework resources.

Test: m
Bug: 183097033
Change-Id: I99c0d28069dd1a13d452105b0a83a03a833232a2
Merged-In: I99c0d28069dd1a13d452105b0a83a03a833232a2
2021-03-20 21:37:58 +09:00
Roshan Pius
147951ce63 TransportInfo: Add a generic redaction mechanism
This replaces the existing mechanism for redacting location sensitive
fields with a more extensible mechanism. Currently supported redactions
are for the following permissions:
i. ACCESS_FINE_LOCATION
ii. LOCAL_MAC_ADDRESS
iii. NETWORK_SETTINGS

Also, removed WifiInfo from ConnectivityServiceTest to reduce cross
dependencies on wifi code.

Bug: 156867433
Bug: 162602799
Test: atest android.net
Test: atest com.android.server
Change-Id: I2bb980c624667a55c1383f13ab71b9b97ed6eeab
2021-03-19 20:15:21 +00:00
Treehugger Robot
ef16d9420d Merge "Fix InetAddressCompat exception handling" am: cd37173df6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645300

Change-Id: I1d65d6b011e5ce585835e1c9df9eea0afb74b0f4
2021-03-19 17:21:29 +00:00
Remi NGUYEN VAN
cb5c2e141e Fix InetAddressCompat exception handling
Fix InetAddressCompat exception handling to throw the original exception
in case of InvocationTargetException, rather than wrapping in a generic
IllegalStateException.

Bug: 183198868
Test: Test device with and without connectivity
Change-Id: Idc4d678afe9f20f920d7061790af4203ab75be26
2021-03-19 23:56:27 +09:00
Chiachang Wang
b01cafdb08 Merge "Add startCaptivePortalApp to system API" am: 9e18198cc5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1639899

Change-Id: I2efbc3276ccce8df4d77c06dc2d50bd4d2bed9b5
2021-03-19 11:59:16 +00:00
Chiachang Wang
9e18198cc5 Merge "Add startCaptivePortalApp to system API" 2021-03-19 11:30:20 +00:00
Chalard Jean
4ff025d8a5 Merge "[NS03] Mix in other CS-managed properties" am: dc2fed3454
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556101

Change-Id: I7b904af6c34190f53378cc1acc518840b527d434
2021-03-19 10:52:23 +00:00
Lucas Lin
e988cf4321 Merge "Expose getCapabilities" am: 0f441f7bdd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1641919

Change-Id: Ie524f7538aa7a7048c55097c0995d8c6194dc682
2021-03-19 10:49:12 +00:00
Treehugger Robot
e58eafa8c4 [automerger skipped] Merge "Reland "Add an API to listen for changes in network blocked status of an uid."" am: cd3ea1f002 -s ours
am skip reason: skip tag Change-Id Ib9949b8619c6b148f73630b314c4113d76c31ec1 with SHA-1 cc8f26dea8 is already in history

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

Change-Id: I19a6e876187a5cf64a00c3f2dac15c8bec8f2911
2021-03-19 10:46:12 +00:00
Chalard Jean
dc2fed3454 Merge "[NS03] Mix in other CS-managed properties" 2021-03-19 10:32:46 +00:00
Lucas Lin
0f441f7bdd Merge "Expose getCapabilities" 2021-03-19 10:24:25 +00:00
Treehugger Robot
cd3ea1f002 Merge "Reland "Add an API to listen for changes in network blocked status of an uid."" 2021-03-19 10:12:15 +00:00
Chiachang Wang
3ff1e2fe49 Merge "Send a Network instead of network id for wifi no internet dialog" am: 94dc99ea38
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1644766

Change-Id: I676152104fafb5c4e1b93f0e39fa39e43dd6891c
2021-03-19 08:27:56 +00:00
Aaron Huang
2f04604df2 Merge "Remove hidden API usage from ProxyTracker" am: ed15b01b0d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1646966

Change-Id: I2d609875a3a31586626a82dddbfcb015bf5ca0bf
2021-03-19 08:27:14 +00:00
Lorenzo Colitti
18e2734d2f Merge "Ensure all calls to getCallingUid use the version in mDeps." am: a6b1b9d110
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635320

Change-Id: I6719b51b78ace57bc36f4dba738c0c420947a8bf
2021-03-19 08:24:59 +00:00
Chiachang Wang
94dc99ea38 Merge "Send a Network instead of network id for wifi no internet dialog" 2021-03-19 07:54:24 +00:00
Aaron Huang
ed15b01b0d Merge "Remove hidden API usage from ProxyTracker" 2021-03-19 07:50:27 +00:00
Lorenzo Colitti
a6b1b9d110 Merge "Ensure all calls to getCallingUid use the version in mDeps." 2021-03-19 07:36:52 +00:00
Chalard Jean
211f271ce4 Merge "[NS02] Mix in validation of the score" am: a5323dd580
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556100

Change-Id: I229c3033a16d6b7f11f1b3f02351cc0d2153d199
2021-03-19 06:05:28 +00:00
Aaron Huang
d1a8c71ed9 Remove hidden API usage from ProxyTracker
Connectivity mainline module cannot use HandlerExecutor because it
is a hidden API. So, replace it with alternative.

Bug: 177035719
Test: FrameworksNetTests
Change-Id: I228a8a2e3479b0af1e977d13f877a565f0789a7e
2021-03-19 06:03:08 +00:00
Chalard Jean
a5323dd580 Merge "[NS02] Mix in validation of the score" 2021-03-19 05:39:40 +00:00
Chalard Jean
67b66080a0 [NS03] Mix in other CS-managed properties
These properties are necessary to figure out the maximum
score of a network.

Test: FrameworksNetTests
Change-Id: I48dce20ad4a80597039393dca607e8da829b2a61
2021-03-19 13:50:56 +09:00
Chalard Jean
6bde0e5c04 [NS02] Mix in validation of the score
Test: FrameworksNetTests FrameworksWifiTests NetworkStackTests
Change-Id: I9cac3a05ad0c4008599973b12d2c5e4c02233a5c
2021-03-19 13:50:56 +09:00
Treehugger Robot
cbb8786faf Merge "CaptivePortalData: use CharSequence in VenueFriendlyName API" am: f678876c62
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1640985

Change-Id: I26db95ad9d91dec40a62b7e4c4c0b77133ddb5d3
2021-03-19 04:42:53 +00:00
Treehugger Robot
f678876c62 Merge "CaptivePortalData: use CharSequence in VenueFriendlyName API" 2021-03-19 04:13:36 +00:00
Chiachang Wang
8d81c8d76b Revert "Revert "Expose uids related APIs in NetworkRequest and N..."
Revert^2 "Add shims for NetworkRequest"

b72b3ca768fc25ef72dc78f1396b08447b8ef5c6

NetworkRequest is moving into the incoming connectivity mainline
module. The hidden setUids becomes inaccessible outside the
module. Shims for support cts in different API levels will need
to use it to verify the behavior of NetworkRequest. Thus, expose
it to the API surface.

Also, VPN uses getUids and setUids to control network
capabilities. Networkcapabilities is a part of incoming
connectivity mainline module but VPN is not. Thus, exposing these
two methods are needed to allow VPN to continue using it.

Test: make update-api
Bug: 172183305

Change-Id: I4b8e1aa558e3459a932535f9901f4ae86b0ecb67
Merged-In: I107c329d4d7130d488772166eae8b5e7aaa2ff04
2021-03-19 02:12:17 +00:00
Chiachang Wang
16cbb7423a Revert^2 "Replace the usage of UidRange"
f0b9889ccf

UidRange is used in a shared way between ConnectivityService
and VPN through the use of NetworkCapabilities. UidRange will
be part of the ConnectivityService mainline but Vpn.java will
stay in the framework. We need a way to replace the APIs using
UidRange, or to make UidRange system API. The only really
relevant surface here is NetworkCapabilities#{setUids, getUids}.
The need for UidRange could be replaced by an integer Range, so
replace the usage of UidRange by a integer Range in
NetworkCapabilities#{setUids, getUids} and update the relevant
callers.

Bug: 172183305
Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk

Change-Id: I0f679fb5fb8f4fe26461ca4912ca1fdfe7f43c9e
Merged-In: I4e5aec6ef1ea02e038fcd7ed117a3b67b69c5cb9
2021-03-19 02:11:07 +00:00
Chiachang Wang
ef52aade37 Send a Network instead of network id for wifi no internet dialog
It's a refactor work for incoming connectivity mainline. The
network information contained in the no internet notification
action was placed the target network id. The receiver which is
Settings will need to construct the network from the network id
using the hidden Network constructor. Since Network is moving
into module, Settings will not be able to access it. Apps should
use Network instead of network id, so just send the network
object to Settings.

Bug: 172183305
Test: manually test with no internet dialog and check the
      behavior and log
Test: atest FrameworksNetTests
Change-Id: I68acc70a26a27eeeb9ab7af068a459905839f942
2021-03-19 02:08:01 +00:00
Remi NGUYEN VAN
2aec625379 Merge "Add InetAddressCompat" am: e1da163302
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645289

Change-Id: I6946ca309ae923a637f5e5f0ad73c91b26b3c376
2021-03-19 00:39:34 +00:00
Remi NGUYEN VAN
b1155aa195 Merge "Move network selection utils to Connectivity" am: f0f68f5561
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645291

Change-Id: I452591707a97b501f189fa9f61e90da842fa3734
2021-03-19 00:35:03 +00:00