Commit Graph

565776 Commits

Author SHA1 Message Date
Sudheer Shanka
f072281f63 Fix the case where blocked reasons for dataSaver are not considered.
Fixes: 183267528
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideNetworkCallbackTests.java
Merged-In: I3c90c3849261df4c289c398f22661f91f7cf4994
Change-Id: Iba3ff804a74fb482847dd999c2854405b21affd2
2021-03-22 17:36:21 +00:00
Treehugger Robot
79ddf1afb8 Merge "Remove reference of getActiveLinkproperties" 2021-03-22 13:39:40 +00:00
Treehugger Robot
965d021bf5 Merge "Make isDataCapable a public API" 2021-03-22 12:00:20 +00:00
Jack Nudelman
1cc1558ea6 Merge "Add capability for thermal mitigation." 2021-03-22 11:38:10 +00:00
junyulai
2b57c52b03 Remove reference of getActiveLinkproperties
For callers who access the hidden API, replaced with
public APIs.

Test: atest FrameworksNetTests
Bug: 182963397
Merged-In: Ic0e895c77cf3efb78ddc333c4f3b1016cebcfe17
Change-Id: Ic0e895c77cf3efb78ddc333c4f3b1016cebcfe17
  (cherry-picked from ag/13929756)
2021-03-22 18:14:37 +08:00
Lorenzo Colitti
7a2f9c06ca Merge changes I90bf7957,If58524b0
* changes:
  Fix privileged apps calling registerDefaultNetworkCallback.
  Test a bug with NETWORK_SETTINGS+registerDefaultNetworkCallback.
2021-03-22 09:43:53 +00:00
Chiachang Wang
9f1cd40748 Merge "Revert "Correct the logic in NetworkCapabilitiesTest"" 2021-03-22 06:26:33 +00:00
Chiachang Wang
44c49e6c4e Revert "Correct the logic in NetworkCapabilitiesTest"
This reverts commit f08d3d4359.

Reason for revert: <Merge abnormal in automerger>

Change-Id: I0cdb401f4962050bf24dc9d9871d4ef15cf52629
2021-03-22 06:15:02 +00:00
Treehugger Robot
efbd8b3961 Merge "Correct the logic in NetworkCapabilitiesTest" 2021-03-22 02:20:19 +00:00
Remi NGUYEN VAN
1077770f78 Merge "Remove Preconditions usage in TestNetworkSpecifier" 2021-03-22 01:40:44 +00:00
Remi NGUYEN VAN
9cb39acfef Merge "Revert "Revert "Remove connectivity dependency on Preconditions""" 2021-03-22 01:40:28 +00:00
Remi NGUYEN VAN
2ff7a8e1b3 Merge "Add TEST_MAPPING for Connectivity" 2021-03-22 01:39:51 +00:00
Treehugger Robot
405801f0fc Merge "Move trimV4AddrZeros to libs/net" 2021-03-22 01:37:06 +00:00
Remi NGUYEN VAN
335a968b65 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
496d5dca27 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
805b39b2d9 Merge "Add SystemMessages protos to Connectivity" 2021-03-21 23:58:00 +00:00
Jayachandran Chinnakkannu
bc71009366 Merge "Swap parameters in QosCallback#registerQosCallback" 2021-03-21 21:02:36 +00:00
Treehugger Robot
bf516b9e11 Merge "Add new @SystemApi for specifying AddressType and IRK" 2021-03-21 20:15:38 +00:00
Lorenzo Colitti
ae67988721 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
d22c7588d7 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
SongFerng Wang
cfa02cd687 Merge "The phone didn't reload the allowed Network Type" 2021-03-21 16:45:59 +00:00
Treehugger Robot
403b7fd0b0 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
Lorenzo Colitti
744e27a39e 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
Hui Wang
98763306a2 Merge "Add VoPS support info for NR" 2021-03-21 04:12:52 +00:00
Martin Brabham
045fe260e1 Add new @SystemApi for specifying AddressType and IRK
Bug: 178234318
Test: compiles and runs
Tag: #feature
Change-Id: Ib67e681af01260df98602003b2aca47963494c6f
2021-03-20 15:13:24 -07:00
Lorenzo Colitti
8b77bf790c 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
250710c687 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
4cc71277cd Merge "Copy NetworkNotificationManager resources to conectivity module." 2021-03-20 13:52:46 +00:00
Remi NGUYEN VAN
3b0736735b 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
279b33817f 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
3a680dc897 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
4f8084867e 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
Lorenzo Colitti
f969377a96 Expose isUidNetworkingBlocked and isUidRestrictedOnMeteredNetworks
These methods are used by ConnectivityService for synchronous
calls such as getActiveNetworkInfo, isActiveNetworkMetered, etc.

These calls must call into NPMS and acquire the NPMS lock because
they are synchronous. They cannot use the stale copy of the
policy rules maintained by ConnectivityService, because if they
did, races like the following could occur:

1. App gets broadcast/callback/....
2. App calls isActiveNetworkMetered or other synchronous method.
3. ConnectivityService's copy of the rules is out of date, so the
   call returns stale information that the UID is still blocked.
4. The app thinks it has no networking, and does not call the
   synchronous method again until some other event occurs,
   potentially much later.

Bug: 176289731
Test: passes existing tests in ConnectivityServiceTest
Change-Id: I4ad0ca60431fe3702be85332530b6e93728d55e7
Merged-In: I4ad0ca60431fe3702be85332530b6e93728d55e7
2021-03-20 22:23:23 +09:00
Remi NGUYEN VAN
00b8d2cf37 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
576e9036d6 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
Kevin Han
4dfa5f8db4 Merge changes from topic "app_hibernation_permission"
* changes:
  Add API to get hibernating packages
  Add MANAGE_APP_HIBERNATION permission
2021-03-20 01:37:29 +00:00
Andy Hung
64e333a250 Merge "AudioTrack: get/setStartThresholdInFrames" 2021-03-20 01:04:28 +00:00
Treehugger Robot
258ecb55a5 Merge "Return 0 instead of throwing RuntimeException from getSmsCapacityOnIcc" 2021-03-20 00:28:35 +00:00
Chienyuan Huang
4a47532570 Merge "Le Scan: Add ambient discovery mode (1/2)" 2021-03-20 00:26:04 +00:00
Peter Collingbourne
efad4dcd74 Merge "Support MTE and GWP-ASan features in proto tombstones." 2021-03-19 23:42:23 +00:00
Josh Gao
680aaa9195 Merge "Switch to bionic's pidfd_open." 2021-03-19 22:42:22 +00:00
Tej Singh
d5127dceb0 Merge changes from topic "tej_isolate_protologging"
* changes:
  Remove network transport from core/proto
  Move service/enums.proto to proto_logging
  Add usb and networkcapabilities back to core/proto
2021-03-19 22:20:47 +00:00
Treehugger Robot
55fe87b2f6 Merge changes from topic "bluetooth_oob_api"
* changes:
  Fix CTS Failure
  Bluetooth: Modify and append to the Out-of-Band API
2021-03-19 21:13:18 +00:00
Christian Wailes
d6c3dfb3ff Merge "Update OWNERS file" 2021-03-19 20:59:11 +00:00
Roshan Pius
adee4b7b7e 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
Jeff Sharkey
d702544c9f Merge "OWNERS for a few Voice Interaction files." 2021-03-19 19:21:48 +00:00
Shuzhen Wang
171249e857 Merge "Camera: Fix a removal-while-iterate bug" 2021-03-19 18:34:00 +00:00
Kevin Han
f0df72a9c7 Add API to get hibernating packages
Add API to AppHibernationService to get hibernating packages so
Settings can access this information.

Bug: 175829330
Test: atest AppHibernationServiceTest
Change-Id: Icd186807c19ece55a21fc4d240d2f0132951af82
2021-03-19 10:38:16 -07:00
Kevin Han
152e389bae Add MANAGE_APP_HIBERNATION permission
Add permission for app hibernation state manipulation.

Bug: 183058954
Test: run hibernation job and confirm the API works for
PermissionController

(cherrypick of ag/13909632)

Merged-In: Id57ee57f49710d0b8a49a4ec561800db43089f87
Change-Id: Id57ee57f49710d0b8a49a4ec561800db43089f87
2021-03-19 10:37:05 -07:00
Yan Wang
08d5380762 Merge "Remove the reading of APK file." 2021-03-19 16:55:54 +00:00