Commit Graph

13045 Commits

Author SHA1 Message Date
junyulai
f3ca0ef14c [VCN04] Add Subscription Id set into NetworkCapabilities
This is a generic way to request networks that has different
subId but belongs to the same carrier. For example, cellular
networks with different SIM card, or carrier Wifi that
provided by the operator.

Test: atest NetworkCapabilitiesTest#testSubIds
Test: m doc-comment-check-docs -j
Test: atest CtsNetTestCases
Bug: 175662146

Change-Id: Ifca766f5acc73c285948d6251ec31506d9bb0bcb
2021-03-11 23:03:05 +08:00
Remi NGUYEN VAN
7f11b46a43 Add Ethernet, TestNetworkSpecifier API
Rename StringNetworkSpecifier to EthernetNetworkSpecifier (its only
production user), and make it module-lib API.
The original StringNetworkSpecifier file is actually kept to satisfy
some invalid dependencies; it will be removed separately.

This allows specifying an Ethernet interface with a non-deprecated API:
until this change the only way to do so would be to use
NetworkRequest#setSpecifier(String), which is deprecated.

Similarly, add the TestNetworkSpecifier API for TestNetworkManager, to
replace previous usage of StringNetworkSpecifier. TestNetworkManager is
module API, so TestNetworkSpecifier should be module API too. This
allows tests to request the test interface specifically, without using
the deprecated NetworkRequest#setSpecifier(String).

Bug: 179329291
Test: m
Merged-In: Iee569f5c8bbdc4bc979610e1191308281f3d4620

Change-Id: Iee569f5c8bbdc4bc979610e1191308281f3d4620
2021-03-11 23:02:02 +08:00
Remi NGUYEN VAN
5a6212753b Fix common tests on Q and R
The common tests cannot reference EthernetNetworkSpecifier,
as it did not exist in Q and R yet.

Bug: 179329291
Merged-In: Iec8ef874a3ca6dcc65944bbbaa3575a5ae0f4989
Change-Id: Iec8ef874a3ca6dcc65944bbbaa3575a5ae0f4989
Test: atest CtsNetTestCasesLatestSdk
2021-03-11 23:02:02 +08:00
junyulai
f4bc12fe28 [VCN11] Make requestBackgroundNetwork requires handler
Test: atest FrameworksNetTests android.net.cts.ConnectivityManagerTest
Bug: 175662146
Change-Id: Iac9487e8de8bfdd87fc7a0153b228ae2a7ba4e19
2021-03-11 21:05:27 +08:00
junyulai
6b0a6a22a3 [VCN10] Add new API to listen for highest score network
Test: atest ConnectivityServiceTest#testRegisterBestMatchingNetworkCallback
Bug: 175662146
Change-Id: Ifa411c7b53da789c74fff7e1a95f9c9ebf5bd05c
2021-03-11 21:04:06 +08:00
Lorenzo Colitti
5d6c73b585 Merge "Don't start clatd if disabled by vendor property." am: 91fccfe42f am: 6abc4bec40
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1625702

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I333fba0c9bca40f0cd60d042b4c6ed82e72abaa9
2021-03-11 12:55:46 +00:00
Lorenzo Colitti
6abc4bec40 Merge "Don't start clatd if disabled by vendor property." am: 91fccfe42f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1625702

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6e468f41424104a5e1d757e18bc5a8648c7f6d1d
2021-03-11 12:34:57 +00:00
Lorenzo Colitti
91fccfe42f Merge "Don't start clatd if disabled by vendor property." 2021-03-11 12:22:34 +00:00
Remi NGUYEN VAN
16e9dd5b4f Remove Slog usage in NetworkState
Slog should not be used in unbundled jars as it is a hidden API; use the
standard Log utility instead.

Bug: 172050541
Test: m
Change-Id: I54b2b99b2aedbb5194e9ec24068d2f2ce46d67fc
2021-03-11 21:01:30 +09:00
Remi NGUYEN VAN
1c17c88002 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
Test: m
Change-Id: If14a75439ff332c927dc4114ae0eecb89f53c6c7
2021-03-11 20:49:13 +09:00
Remi NGUYEN VAN
4c63bb2e86 Remove hidden @NetworkType in NetworkInfo
The NetworkType annotation is a hidden telephony symbol, and should be
kept hidden as annotations are disallowed by API guidelines.

Remove its usage in NetworkInfo as users of annotated constants that
build against API stubs are expected not to use the annotation.

Bug: 182451544
Test: m
Change-Id: I6658c1faa147c527c989b87d67f1af166c488dde
2021-03-11 20:29:10 +09:00
Remi NGUYEN VAN
642d6abe9d Remove hidden INVALID_RESOURCE_ID in unused param
INVALID_RESOURCE_ID is a hidden API so its usage should be avoided.
The current usage is for an unused parameter, so just use a literal instead.

Bug: 182451544
Change-Id: I066d9c34f735434adee4ee72e8a7fe1ceb900c3c
Test: m
2021-03-11 10:57:01 +00:00
lifr
1c0d9b29ff [CS17]Remove useless code(AsyncChannel) from ConnectivityService
The caller of AsyncChannel has been deleted in the last commit
(Remove legacy network factories), so the useless code of
AsyncChannel should also be deleted.

Bug: 170917042
Test: atest FrameworksNetTests
Change-Id: I6ce164fe5e3d592f1ed63753e8d3c0086bf61fa2
2021-03-11 09:57:41 +00:00
Lorenzo Colitti
61aec97dc9 Merge "Unbreak extraInfo values returned to apps." am: 877ef7634f am: a035f85997
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1624040

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I99ea36c50a38dfc54b69ec5ad46d11d50e458925
2021-03-11 09:25:48 +00:00
Lorenzo Colitti
a035f85997 Merge "Unbreak extraInfo values returned to apps." am: 877ef7634f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1624040

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib6560b94331f477cd7ea9df3c8f766b1eec49dfa
2021-03-11 08:26:47 +00:00
Remi NGUYEN VAN
04e1000ef5 Move ParseException to Connectivity
ParseException is a public API class used to support Connectivity APIs,
so it should be in the same API surface as connectivity.

Bug: 181512874
Test: m
Change-Id: Ie1213de0d0facc8f409f7b4c2553abb382e4afbf
2021-03-11 17:19:18 +09:00
Lorenzo Colitti
877ef7634f Merge "Unbreak extraInfo values returned to apps." 2021-03-11 08:06:03 +00:00
Remi NGUYEN VAN
cb49506e77 Remove usage of hidden InetSocketAddress constructor
The constructor is a hidden API, and used in a code path that can
never happen.
Replace it with a thrown exception (which should never be thrown either).

Bug: 170598012
Change-Id: Ie2c671c1a75accb8e94b08de9901d14b72caaf7e
Test: m
2021-03-11 07:43:43 +00:00
paulhu
e84e5fa270 Stop using PackageManagerInternal in PermissionMonitor
- Replace the PackageManagerInternal#getPackageList() with
receiving PACKAGE_{ADDED|REMOVED} intent.
- Also remove the onPackageChanged method because the traffaic
permissions(INTERNET, UPDATE_DEVICE_STATS) are not changed after
package changed(Disable or enable package).

Bug: 176788468
Test: atest FrameworksNetTests
Change-Id: I5505d1c77db66a7e65fc336ea0e99846e78c6b36
2021-03-11 07:16:11 +00:00
Lorenzo Colitti
3732b76a96 Merge "Set extraInfo on cellular TestNetworkAgents." am: ab2f3d3cb5 am: c612271990
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1624039

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id194278af5a07dea4d0641c0884c46e77c931938
2021-03-11 04:33:28 +00:00
Lorenzo Colitti
c612271990 Merge "Set extraInfo on cellular TestNetworkAgents." am: ab2f3d3cb5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1624039

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I66af2cf6b6cd286993fa3328c5cc52d8bba3beb9
2021-03-11 03:57:11 +00:00
Lorenzo Colitti
ab2f3d3cb5 Merge "Set extraInfo on cellular TestNetworkAgents." 2021-03-11 03:31:49 +00:00
Aaron Huang
a100290e51 Merge "Remove IBatteryStats from ConnectivityService module" am: f3827cf444 am: 433b9738b3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1623262

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iddff8e1ac79c589ddf34518b2e8f9627be25c550
2021-03-11 02:21:11 +00:00
Chiachang Wang
622c64b409 Merge "Remove hidden APIs usage regarding to dump" am: f4956c7502 am: 9ffb4d5e8b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1622625

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4152e7cfdc14d4372319e66a67b117a94aedc80b
2021-03-11 02:19:33 +00:00
Aaron Huang
433b9738b3 Merge "Remove IBatteryStats from ConnectivityService module" am: f3827cf444
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1623262

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibb2e02126cfaf13360e23e43f6f15a8a8254121a
2021-03-11 02:17:59 +00:00
Aaron Huang
f3827cf444 Merge "Remove IBatteryStats from ConnectivityService module" 2021-03-11 02:04:41 +00:00
Chiachang Wang
9ffb4d5e8b Merge "Remove hidden APIs usage regarding to dump" am: f4956c7502
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1622625

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I95aa9931607301a61dfee801de32242f75528d0b
2021-03-11 02:03:11 +00:00
Chiachang Wang
f4956c7502 Merge "Remove hidden APIs usage regarding to dump" 2021-03-11 00:28:54 +00:00
Chiachang Wang
9ddf7d3c36 Remove hidden APIs usage regarding to dump
Classes inside the incoming connectivity module will not be able
to access hidden APIs. The hidden DUMP_FLAG_PRIORITY_* flags
usage should be replaced. It was used to control the dump
priority. DEFAULT priority for services which is treated the
same as NORMAL priority. ConnectivityServiceInitializer took
both NORMAL and HIGH. It trigger different information dumped.
It's replaced with dumpsys that does not send "--dump-priority"
arguments to the service. Thus, design is replaced with
local parsing inside ConnectivitySerivce to provide equivalent
dump.

Bug: 172183305
Test: m ; flash and boot up
Test: adb bugreport ; adb dumpsys connectivity
Change-Id: Ib3c9d8692eb4382cd106734a1a716df6f48ffca4
2021-03-11 00:28:47 +00:00
James Mattis
964b84a14d Merge "frameworks: add test group for auto tests" am: 5845859186 am: de47d2e4d1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1595037

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I72c3237b5dcd0e074f1bb0f327ee64fd21be5b28
2021-03-10 16:37:54 +00:00
Lorenzo Colitti
4c9e202a44 Don't start clatd if disabled by vendor property.
Fix: 182333299
Test: new unit tests
Change-Id: Ic15dc4fff6a13aa916e3d2dc6203829e96ddeda4
2021-03-11 00:59:14 +09:00
Lorenzo Colitti
386f9a3662 Unbreak extraInfo values returned to apps.
These were broken by aosp/1553463, which made filterNetworkInfo
unconditionally call setDetailedState with a reason of "" and an
extraInfo of null.

Fix both synchronous getter APIs (e.g., getNetworkInfo) and
CONNECTIVITY_ACTION broadcasts by calling a new
filterForLegacyLockdown method that behaves similarly to how the
now-deleted LockdownVpnTracker#augmentNetworkInfo used to behave.

While I'm at it, move back to private a method that was public
only because LockdownVpnTracker used it.

Fix: 181855958
Test: new unit test coverage
Change-Id: I2c7b88fcec9dd36b45cb51db8d19b3ee8bad44a6
2021-03-11 00:59:14 +09:00
James Mattis
de47d2e4d1 Merge "frameworks: add test group for auto tests" am: 5845859186
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1595037

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7027594488771b408db82639fc6703c42beef186
2021-03-10 15:58:44 +00:00
Aaron Huang
d86d581712 Revert^2 "Refactor setCurrentProxyScriptUrl to a void method"
setCurrentProxyScriptUrl is used by ProxyTracker which is
included in connectivity service mainline module. To make
this method @SystemApi in follow-up patch, change this
from a boolean method to a void method. Moving the send or
not send broadcast logic to caller because it can know
whether it needs to send a broadcast or not.

The original change was reverted because it broke DeviceOwnerTest
and HostsideVpnTests. The new patch fixes no broadcast sent bug.
The logic was reversed when a PAC file URL is empty so the
broadcast did not send when proxy change.

Bug: 179225084
Bug: 177035719
Test: FrameworksNetTests
      CtsHostsideNetworkTests:HostsideVpnTests#testSetProxy
      CtsHostsideNetworkTests:HostsideVpnTests#testBindToNetworkWithProxy
      CtsHostsideNetworkTests:HostsideVpnTests#testNoProxy
      CtsDevicePolicyManagerTestCases:DeviceOwnerTest#testProxyPacProxyTest
      CtsDevicePolicyManagerTestCases:DeviceOwnerTest#testProxyStaticProxyTest

Change-Id: I029c33913264bfee336a559c4bd048ddd027322b
2021-03-10 23:19:12 +08:00
James Mattis
5845859186 Merge "frameworks: add test group for auto tests" 2021-03-10 15:12:49 +00:00
Lorenzo Colitti
ad4e8837af Set extraInfo on cellular TestNetworkAgents.
This makes the test more realistic, since telephony always puts
the APN name in the extraInfo field. It also makes it easy to
test that various APIs properly return the extra info without
plumbing a new parameter through TestNetworkAgentWrapper,
NetworkAgentWrapper, and InstrumentedNetworkAgent.

Also make the extraInfo and the legacyType available to tests.
This will be used in future tests that assert the contents of
extraInfo.

Bug: 181855958
Test: test-only change
Change-Id: If4eddb6cd9e70bb33e10d72aceebaea843244246
2021-03-10 23:33:08 +09:00
Aaron Huang
14ad9a91c0 Create a service-connectivity-pre-jarjar library
This is needed for FrameworksNetTests because it inculdes
service-connectivity. Without this library, the service-connectivity
is already jarjar-ed which will cause the util classes couldn't be
found when running the tests. So let the tests inculde the pre-jarjar
version and service-connectivity applies the jarjar to this library.

Bug: 177046265
Test: FrameworksNetTests
Change-Id: I1acd95ff9bec99b918646e8ec3a57f3ef156e2ca
Merged-In: I1acd95ff9bec99b918646e8ec3a57f3ef156e2ca
2021-03-10 22:25:45 +08:00
Paul Hu
6ae3110de3 Merge "Replace PendingIntent#getIntent" am: e0b54f9303 am: c80147e92b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1615190

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9f4cb9ff8e42373e7ebf71b3d4559b768ebfdbe7
2021-03-10 04:32:26 +00:00
Paul Hu
c80147e92b Merge "Replace PendingIntent#getIntent" am: e0b54f9303
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1615190

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2e8256d6d33eb819904b8f972134bc4cd843e43f
2021-03-10 02:43:38 +00:00
Paul Hu
e0b54f9303 Merge "Replace PendingIntent#getIntent" 2021-03-10 02:13:11 +00:00
Chalard Jean
5962bf322b Merge "Fix a bug where listen callbacks would not be called" am: 3b50ce7a6f am: d7e0f35a90
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1620900

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2edd1b12be6d2b1cb3c8bc4fdecd83364c813301
2021-03-10 01:46:40 +00:00
Chalard Jean
d7e0f35a90 Merge "Fix a bug where listen callbacks would not be called" am: 3b50ce7a6f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1620900

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I14a640aa21b464e7d6ced3086986e0dd79eaa019
2021-03-10 01:07:50 +00:00
Chalard Jean
3b50ce7a6f Merge "Fix a bug where listen callbacks would not be called" 2021-03-10 00:32:58 +00:00
Jun
76df56c7e3 frameworks: add test group for auto tests
Adding a seperate test tag into postsubmit so as to identify which tests
we want to run for automotive builds.

Test: atest --test-mapping [src]:auto-postsubmit
bug: 179917339
Change-Id: I3860fb6bf4f4174fad26cce5f7d6b43fd6494c0f
2021-03-09 15:54:39 -08:00
Remi NGUYEN VAN
1eebf4f7bd Use ParcelDescriptor.fromSocket instead of getFileDescriptor
Socket.getFileDescriptor$ is a hidden API. Instead, replace it with
ParcelDescriptor.fromSocket, which was created to handle such use-cases.

Bug: 170598012
Change-Id: I9e218e4ec29d2b7fe5d2faeb1c2e1cafc63dc923
Test: m
2021-03-09 23:54:03 +00:00
Aaron Huang
c3f79207ef Remove IBatteryStats from ConnectivityService module
Currently ConnectivityService calls the methods in
BatteryStatsService through BatteryStatsManager so
IBatteryStats can be removed from ConnectivityService.

Bug: 171686421
Test: FrameworksNetTests
Change-Id: I559369c9900e8100cdae187bc9cec603ed85a131
2021-03-09 21:39:17 +08:00
Zoey Chen
868044d483 Merge changes from topic "PSL_TelephonyCallback" am: f619c9967d am: df270afdb6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1614981

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic26eea861f33d75b7b5ef62aa411532e52cac51b
2021-03-09 11:51:08 +00:00
Aaron Huang
2314dd2d90 Merge changes I1d1f0d2d,Ifbd4a978 am: 77ed87e072 am: 9b58ed12cc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1475901

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7386dfb19911f1b9db39df3b809d18742cc13a75
2021-03-09 11:49:50 +00:00
Zoey Chen
df270afdb6 Merge changes from topic "PSL_TelephonyCallback" am: f619c9967d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1614981

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Idd41c34f9e4dff1ca7930a9fc2a6f06ec8c316ba
2021-03-09 11:24:06 +00:00
Aaron Huang
9b58ed12cc Merge changes I1d1f0d2d,Ifbd4a978 am: 77ed87e072
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1475901

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I156b9230ef2ea495a6d1661c3f618de4a9c2ac2a
2021-03-09 11:14:40 +00:00