Commit Graph

13045 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
02e5fcf301 Merge "Add SystemMessages protos to Connectivity" am: cf638d345b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1626204

Change-Id: I8648b09a97485dcecac2e5075d605e79a730ec3f
2021-03-22 03:20:45 +00:00
Jayachandran Chinnakkannu
f3f342370a Merge "Swap parameters in QosCallback#registerQosCallback" am: fce4049a1d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1628901

Change-Id: I2c371b6f1dc25f84a389480e46d9d582e9da148b
2021-03-22 03:18:17 +00:00
Treehugger Robot
58f4cdf3b3 Merge "Correct the logic in NetworkCapabilitiesTest" 2021-03-22 02:20:19 +00:00
Remi NGUYEN VAN
afdb6a7347 Merge "Remove Preconditions usage in TestNetworkSpecifier" 2021-03-22 01:40:44 +00:00
Remi NGUYEN VAN
aa1d743312 Merge "Revert "Revert "Remove connectivity dependency on Preconditions""" 2021-03-22 01:40:28 +00:00
Remi NGUYEN VAN
b2fe416e82 Merge "Add TEST_MAPPING for Connectivity" 2021-03-22 01:39:51 +00:00
Treehugger Robot
33b1df7ec4 Merge "Move trimV4AddrZeros to libs/net" 2021-03-22 01:37:06 +00:00
Remi NGUYEN VAN
508d3cf1d6 Remove Preconditions usage in TestNetworkSpecifier
Preconditions is a hidden API utility. It can be easily replace by
inline checks.

Bug: 177046265
Test: m
Change-Id: I3f722075fb9c74e12e40348ba4faad2f0fa67178
Merged-In: I3f722075fb9c74e12e40348ba4faad2f0fa67178
2021-03-22 00:02:10 +00:00
Remi NGUYEN VAN
acd6de1364 Revert "Revert "Remove connectivity dependency on Preconditions""
Preconditions.checkNotNull is deprecated to be replaced by
Objects.requireNonNull, and other methods can easily be replaced by
inline checks.

Preconditions is an internal API class that should not be used by
unbundled jars.

Bug: 177046265
Change-Id: I3a67d266b32142c034520acbcdc30f7213db5e13
Merged-In: I3a67d266b32142c034520acbcdc30f7213db5e13
Test: m
2021-03-22 00:01:43 +00:00
Remi NGUYEN VAN
cf638d345b Merge "Add SystemMessages protos to Connectivity" 2021-03-21 23:58:00 +00:00
Jayachandran Chinnakkannu
fce4049a1d Merge "Swap parameters in QosCallback#registerQosCallback" 2021-03-21 21:02:36 +00:00
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
7d909af3bb [automerger skipped] Revert "Revert "Expose uids related APIs in NetworkRequest and N..." am: 8d81c8d76b -s ours am: 9991401b9d -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: Iecaae6936535a5c00d1a895c1410d2f0e5531261
2021-03-21 17:30:02 +00:00
Lorenzo Colitti
a043655e3a Merge changes from topic "backport-connectivityresources" am: a31a7b1bf4 am: dd37a5d576
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645297

Change-Id: I5d547c23baf7798e09d9d9aad188f094ebfe4cfe
2021-03-21 17:29:33 +00:00
Lorenzo Colitti
c62368fd7a Fix privileged apps calling registerDefaultNetworkCallback.
When registerDefaultNetworkCallback is called by an app that has
NETWORK_SETTINGS, the UID of the app is forgotten and the request
that is filed has an empty UID set. This results in that request
matching networks that have UID ranges that do not include it,
e.g., VPNs.

Fix this by ensuring that the UID ranges are properly set.

Bug: 165835257
Test: updated specific tests for this bug
Change-Id: I90bf79573342c144d1cfbc2f61a3155fdd5b1fa7
2021-03-22 02:29:29 +09:00
Lorenzo Colitti
28a89348a9 Cherry-pick some test changes from ag/13210542. am: e7963a1d82 am: eb0dc8f775
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645000

Change-Id: I22e26261dcc59274c4286271409ee63c1760b074
2021-03-21 17:29:29 +00:00
Lorenzo Colitti
053b2a2737 Test a bug with NETWORK_SETTINGS+registerDefaultNetworkCallback.
Currently, if a process with NETWORK_SETTINGS registers a default
network callback, its uid will be ignored and replaced with an
empty list of UIDs. This means it will incorrectly match VPNs
with any UID range.

Add a test for this bug to make it easier to review the upcoming
change that fixes it.

Bug: 165835257
Test: test-only change
Change-Id: If58524b01fdd60045fb7236d17dedf31fb563f99
2021-03-22 02:29:29 +09:00
Remi NGUYEN VAN
30c4960d7e Add connectivity protos to framework-connectivity am: 953819d7f0 am: 00b56b8d0d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635040

Change-Id: Ieaa65408c13f5224b23cae8a4cebf79b4d7ed676
2021-03-21 17:29:25 +00:00
paulhu
634e8a5b2a Remove unused NetworkPolicyManagerInternal in CS am: c850635440 am: 143739703d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1646969

Change-Id: I8e19008eb864b2cafc1725e96b85c51372913c22
2021-03-21 17:29:21 +00:00
Remi NGUYEN VAN
909eb08445 Move connectivity AIDLs to android.net am: 6ed4472b63 am: e6fe8b4103
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1596272

Change-Id: I6cf9779f473b623d9aea6e67e1c57e2d6731617d
2021-03-21 17:29:17 +00:00
Remi NGUYEN VAN
50fab6449d Migrate framework-connectivity internal resources am: 8e12782094 am: 1f00de9e81
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1641905

Change-Id: If36c3148d1a8c487ca3f25fa65e9b593f4e4d19d
2021-03-21 17:29:14 +00:00
Remi NGUYEN VAN
3f139e72f6 Add multipath preference, background status API am: 0f91b7a19a am: 6f3429172b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1644388

Change-Id: I437cb3ab5a778004c7bc03156b74e9e04f93b55b
2021-03-21 17:29:04 +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
db1ad4da2b Merge "Copy NetworkNotificationManager resources to conectivity module." am: 4385ef6896 am: cc018f77ec
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1644996

Change-Id: Ie3ebc18ad8f2848313f9e238744252dbee723ff3
2021-03-20 15:09:31 +00: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
efcd8e96e7 Merge "Fix InetAddressCompat exception handling" am: cd37173df6 am: ef16d9420d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645300

Change-Id: Ib33b1d69e8480ba1ee2193671a88ed91d624d4bc
2021-03-19 18:01:07 +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
c7968e73a8 Add TEST_MAPPING for Connectivity
The TEST_MAPPING triggers connectivity tests in other paths.

Bug: 183198868
Change-Id: I8d9b0450ea4b3ef3e5115d1f858b1aa7badef742
Test: Needs treehugger for testing
2021-03-19 16:03:14 +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
48c2c5949f Merge "Add startCaptivePortalApp to system API" am: 9e18198cc5 am: b01cafdb08
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1639899

Change-Id: I7e82a2a8efb13b960b8f79b9646fcac07c7ac569
2021-03-19 12:26:42 +00: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