565992 Commits

Author SHA1 Message Date
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
Lorenzo Colitti
ab638c1edc Expose registerDefaultNetworkCallbackAsUid.
Bug: 165835257
Test: atest FrameworksNetTests
Change-Id: I638ed5cd5273d456919630aba1e22f099df1b36c
2021-03-22 19:50:27 +09: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
Lorenzo Colitti
a3d14561d5 Support calling registerDefaultNetworkCallback for another UID.
This is to be used by privileged components (e.g., JobScheduler)
to request callbacks about the state of other UIDs on the system.

Bug: 165835257
Test: new unit test coverage
Change-Id: I29f155710394e58c14fcef488db6271d8d83033a
2021-03-22 17:52:20 +09:00
junyulai
9fa79d20c7 [VCN15] expose addUnwantedCapability and related APIs
Test: m -j doc-comment-check-docs
Bug: 175662146
Merged-In: I3f2e6a99e015f09cc4405f6804eac4ae33e3dcc7
Change-Id: I3f2e6a99e015f09cc4405f6804eac4ae33e3dcc7
  (cherry-picked from ag/13929102)
2021-03-22 16:51:50 +08:00
Paul Duffin
c130918e25 Remove unnecessary dependency on libcore-platform-compat-config
Bug: 182402754
Test: m droid
Change-Id: I2d8558acf2d61452e1994259dd05a15b2252e577
2021-03-22 08:39:06 +00:00
SongFerngWang
98edbb0bbc KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY change type as IntArray
Bug: 179814490
Test: build pass
Change-Id: Ica29b8aee243168bb7719f01972075d54ff763e9
Merged-In: Ica29b8aee243168bb7719f01972075d54ff763e9
2021-03-22 07:16:59 +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 f08d3d435930c50b8d31ae96344b75493dd476f3.

Reason for revert: <Merge abnormal in automerger>

Change-Id: I0cdb401f4962050bf24dc9d9871d4ef15cf52629
2021-03-22 06:15:02 +00:00
Lorenzo Colitti
7f542a53ca Store the effective UID in NetworkRequestInfo.
This is necessary for privileged components such as
JobScheduler to file NetworkCallbacks on behalf of other
UIDs.

This CL adds the field to NetworkRequestInfo and updates some
of the matching code, but does not set the field to anything
other than the UID that created the request. Thus, it should
cause no behaviour changes.

Bug: 165835257
Test: refactoring with no change in behaviour, passes existing tests
Change-Id: I21a22ed1b851b8511d36f5202c9eac03e7158d3d
2021-03-22 14:52:38 +09:00
Xu Qian
2d33d70352 Fix thread-shared field evades lock acquisition reported by Coverity
Change-Id: Ia351e2ddc79a3f8e1b47ed1e697a2d24b2a3ebe7
2021-03-22 12:59:21 +08:00
Rhed Jao
7a265dc5c0 Adds OWNERS for servicestests/utils-mockito
Bug: 166181423
Test: NA
Change-Id: I0d80b5547e162524246947175dbe6f9e52859fe4
2021-03-22 11:57:03 +08:00
junyulai
37d07f9a91 Replace hidden API usages of NetworkCapabilities
For callers who access hidden APIs of NetworkCapabliities,
replace them with Builder system APIs.

Test: atest FrameworksNetTests
Bug: 182963397
Merged-In: Iaa4e256e43a33bdf08780bdd1a1a8b538058634d
Change-Id: Iaa4e256e43a33bdf08780bdd1a1a8b538058634d
  (cherry-pick from ag/13929753)
2021-03-22 11:22:18 +08: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
Janis Danisevskis
8875f872de Keystore: Fix Device ID attestation test.
Test: atest android.keystore.cts.KeyAttestationTest#testDeviceIdAttestation
Bug: 182606921
Change-Id: Ie8dbc4a2829fb7f70188c5d903e748060c5869ce
2021-03-20 21:29:21 -07: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
Roman Kiryanov
62ecd75d5a Emulator cleanup in ClipboardService.java (openPipe)
Bug: 182436079
Test: presubmit
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: If19859b04d6c5ed27249c31ea55e273f303b3ec4
2021-03-19 19:41:08 -07: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