Commit Graph

12691 Commits

Author SHA1 Message Date
Ken Chen
de5e7aa2ba Switch from networkCreate[Physical/Vpn] to networkCreate
networkCreatePhysical and networkCreateVpn are non-extensible. In order
to pass OEM requested VPN type to Netd, we need to migrate to
networkCreate API.

Modify test code accordingly since networkCreatePhysical and
networkCreateVpn have been deprecated on Netd.

Bug: 171872481
Test: atest FrameworksNetTests
atest atest HostsideVpnTests

Change-Id: I50ab8615346c49559c16e815482e7804a1e765c8
2021-05-11 16:06:54 +08:00
Remi NGUYEN VAN
41869c65a9 Merge "Use connectivity resources in service-connectivity" 2021-04-23 05:42:13 +00:00
Remi NGUYEN VAN
2b41bf80ee Merge "Add AOSP certificates for connectivity resources" 2021-04-23 05:40:58 +00:00
Remi NGUYEN VAN
a4bef5d40b Use connectivity resources in service-connectivity
Migrate resource usage to the connectivity resource package.
For framework resources that have known overlays, keep a fallback until
the overlays can be migrated.

Bug: 182125649
Test: atest FrameworksNetTests
Merged-In: I778d94a5aac0c4e20e78b1ba3a002495c17a38a0
(clean cherry-pick)

Change-Id: I778d94a5aac0c4e20e78b1ba3a002495c17a38a0
2021-04-23 10:36:15 +09:00
Remi NGUYEN VAN
8acce32060 Merge "Add QUERY_ALL_PACKAGES to net integration tests" 2021-04-22 14:38:40 +00:00
Remi NGUYEN VAN
924c94e7cd Add QUERY_ALL_PACKAGES to net integration tests
The permission is necessary for ConnectivityService to obtain its
resource package. As the integration tests run ConnectivityService
in-process, they need the permission.

Bug: 186091860
Test: atest FrameworksNetIntegrationTests
Change-Id: I60cf9b54faddf0ea4cb02146c83c9bba58370749
2021-04-22 22:02:01 +09:00
Remi NGUYEN VAN
821108b3e2 Add AOSP certificates for connectivity resources
Instead of the platform certificate, use a dedicated certificate.

The AOSP certificates are only used for testing as they have known keys,
and are replaced when resigning production images.

Key generated with:
openssl req -x509 -newkey rsa:4096 -nodes -days 999999 -keyout key.pem \
    -out com.android.connectivity.resources.x509.pem
openssl pkcs8 -topk8 -inform PEM -outform DER -in key.pem -out \
    com.android.connectivity.resources.pk8 -nocrypt

Fixes: 184808224
Fixes: 185462051
Test: m
Change-Id: I25cddc8d5ab948da9d3a2dbcd202ece1f61dd5a2
2021-04-22 16:52:19 +09:00
Treehugger Robot
4995a0bbaa Merge "[VCN19] Rename get/setSubIds to get/setSubscriptionIds" 2021-04-22 04:43:26 +00:00
Lorenzo Colitti
82efa81cd7 Merge "Hide NetworkPolicyManager.blockedReasonsToString API." 2021-04-22 02:36:11 +00:00
Treehugger Robot
b808656439 Merge "Do not deduce VCN capability if Builder is derived from request" 2021-04-21 14:06:14 +00:00
junyulai
be1c5ddd2f Do not deduce VCN capability if Builder is derived from request
If the caller constructed the builder from a request, it means
the user might explicitly want the capabilities from the request.
Thus, the NOT_VCN_MANAGED capabilities should not be touched
later.

Test: TH
Fix: 185876442
Change-Id: I92037cc8547fb72de12d6b6402f060f6c98e1853
2021-04-21 19:10:28 +08:00
Treehugger Robot
fccaf80eba Merge "Add the related extra information in the javadoc" 2021-04-21 08:22:43 +00:00
Treehugger Robot
742164747b Merge "Change Connectivity resources SDK version to 30" 2021-04-21 08:00:41 +00:00
Sudheer Shanka
b9c396eef9 Hide NetworkPolicyManager.blockedReasonsToString API.
BLOCKED_REASON_* constants have been moved to ConnectivityManager
and blockedReasonsToString() util method doesn't belong in
NetworkPolicyManager as an API. So, just removing it for now.

Bug: 185967486
Test: treehugger
Change-Id: Ie04044980fdfc7ec772444be13fc659880953bd1
2021-04-21 07:23:54 +00:00
lucaslin
8a8cb5d4ab Add the related extra information in the javadoc
Bug: 185876442
Test: make docs
Change-Id: Ib0abc43e2009dbf5ee7b6c2a076424834d3d53f2
2021-04-21 10:43:15 +08:00
James Mattis
5ab962df61 Merge "Correctly count nri uid request counts" 2021-04-21 02:06:33 +00:00
Nazanin Bakhshi
348f5cb01e Merge "Refactoring and mocking to make sure unit test doesn't call the real service" 2021-04-20 15:44:00 +00:00
Treehugger Robot
55b86dd028 Merge "Roll forward: add a test for ParseException" 2021-04-20 10:03:56 +00:00
Remi NGUYEN VAN
060026feca Merge "Revert "Add a test for ParseException"" 2021-04-20 09:25:07 +00:00
Remi NGUYEN VAN
8cb7d32b1a Update TEST_MAPPING imports for connectivity
Connectivity CTS tests were moved from cts/tests/net to
packages/modules/Connectivity.

Bug: 185751610
Change-Id: Id4efd99c419706a52ad5d708888097bd6312d4e6
Test: treehugger is needed to test
2021-04-20 07:10:41 +00:00
Remi NGUYEN VAN
96dc675760 Roll forward: add a test for ParseException
The test simply creates an exception and verifies that it has the
required fields.

The constructor tests are only run on S+ as they are not part of the
API before that.

Change-Id: Ic30a34d3203c1b40923ba783a34f0cfed53a07ae
Test: atest FrameworksNetTests
2021-04-20 16:04:33 +09:00
Remi NGUYEN VAN
7696391a92 Revert "Add a test for ParseException"
This reverts commit 98bab00fc9.

Reason for revert: Test broken on R: b/185751610

Change-Id: I9f5d25c0ba81011848ab3cf7ec44aa329fbb3b0f
2021-04-20 16:04:33 +09:00
markchien
bcce2a5d52 Change Connectivity resources SDK version to 30
S tethering module fail to sideload in R platform because package
manager fail to parse S version sdk in R platform.

Bug: 182409819
Test: m
Change-Id: I35c63e4bfe7657afe1e7364926ab139b042b403e
Merged-In: I35c63e4bfe7657afe1e7364926ab139b042b403e
2021-04-20 06:21:04 +00:00
James Mattis
fff0b7ce6d Correctly count nri uid request counts
Correctly count nri uid request counts in the per-app functionality in
connectivity currently used by set profile and set oem network
preference APIs. Previously, upon creation, nris would be created prior
to removing them. This would cause the uid request counts to
artificially increase and incorrectly throw an error if the request
count limit was hit even though in actuality an apps request count was
valid.

E.g., if there was an existing request for per-app functionality and
its owning app made a change to the per-app requests, it would double
count the existing requests. If the current count was say, one under the
limit, an error would be thrown even though it was being replaced which
should have resulted in no net change to the request count limit if
working correctly.

This patch will allow for the requests to be removed prior to creation
so that request counts are tabulated correctly.

Bug: 185849563
Bug: 183785319
Test: atest FrameworksNetTests
Change-Id: I13da0c81256cc02bea6aff2fe1ef99d6f6b0e764
2021-04-19 19:28:23 -07:00
Nazanin
8d18299e28 Refactoring and mocking to make sure unit test doesn't call the real service
Bug: 180938364
Test: utest
Change-Id: Ic6a5a84c1d985fa02f8cf52c8c2ff144669b30c1
2021-04-19 17:12:05 -07:00
junyulai
3c409e8ce7 [VCN19] Rename get/setSubIds to get/setSubscriptionIds
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215036
Merged-In: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
Change-Id: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
  (cherry-picked from ag/14198665)
2021-04-19 17:41:01 +08:00
Chiachang Wang
8df8f29f8b Merge "Update the permission check for dump" 2021-04-19 05:37:09 +00:00
Remi NGUYEN VAN
dfb51531e6 Merge "Add a test for ParseException" 2021-04-19 04:57:31 +00:00
Chiachang Wang
70348a2672 Update the permission check for dump
ServicePermissionsTest#testDumpProtected expects to see nothing
from dump() if the caller does not have the required permission.

After the refactor the ConnectivityService#dump(). It does not
leak real information for those callers without permission but
show the title of dumpsys, i.e. it shows "DUMP OF SERVICE HIGH
connectivity". This breaks the test since the test expects to
see nothing.

Move the permission check to the front of dump call stack since
there is no way to call other private dump related methods.

Bug: 185425662
Test: atest android.security.cts.ServicePermissionsTest
Test: adb shell dumpsys connectivity
Change-Id: I173c968a4f1c4d6f618ed87725a6ccda8d309988
2021-04-19 11:09:15 +08:00
Junyu Lai
bd7b4a4a65 Merge "[VCN20] Change requestBackgroundNetwork argument order" 2021-04-16 16:04:31 +00:00
Lorenzo Colitti
6e535a1294 Merge "Don't expose raw IBinder APIs." 2021-04-16 07:22:13 +00:00
Aaron Huang
7b38530eac Merge "Handle null pointer cases in ConnectivityService" 2021-04-16 07:06:37 +00:00
junyulai
e576c085c3 [VCN20] Change requestBackgroundNetwork argument order
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215095
Merged-In: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
Change-Id: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
  (cherry-picked from ag/14198667)
2021-04-16 00:16:21 +08:00
Aaron Huang
6a16a415d9 Handle null pointer cases in ConnectivityService
If a method is called by adb command "service call"
with no parameters. It will cause to crash because
of a null object reference.

Add a null check for them to avoid system server crash.

Bug: 172885426
Test: FrameworksNetTest
      adb shell service call connectivity #
Change-Id: I8748fc5c6a7a6e82db3581e3026a3f75909a357e
2021-04-16 00:15:25 +08:00
Chiachang Wang
7e1afe7650 Merge "Remove hidden method link in public addRoute API" 2021-04-15 11:26:41 +00:00
Lorenzo Colitti
b35d038d99 Don't expose raw IBinder APIs.
APIs should not expose raw IBinder objects.

Fix: 184735751
Test: builds, boots
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Test: atest CtsNetTestCases:android.net.cts.DnsResolverTest
Change-Id: Ia0c4170def31123f0b79318fec2cfe02e4fcd3bf
2021-04-15 18:47:21 +09:00
Chiachang Wang
9ebe6cfeb3 Remove hidden method link in public addRoute API
The build will complain after moving connectivity framework code
outside framework because the hidden methods/members accesses are
not allowed anymore. Link to a hidden class will not work since
it's not visible in public.

Bug: 182859030
Test: make docs
Change-Id: I5726f80be7cf92b648ce851d9601d5f58bc2b647
2021-04-15 16:21:00 +08:00
lucaslin
df2a314d6c Add test for [set|is]BypassableVpn
Bug: 182963397
Test: 1. atest CtsNetTestCases:NetworkAgentConfigTest
      2. atest CtsNetTestCasesLatestSdk:NetworkAgentConfigTest
Change-Id: I0250a0313d3a7561ab8efa851fbc06f5bce11185
2021-04-15 15:44:01 +08:00
Remi NGUYEN VAN
98bab00fc9 Add a test for ParseException
The test simply creates an exception and verifies that it has the
required fields.

Test: atest FrameworksNetTests
Change-Id: I76ded2ac3f93ff3910bba3f1e4f1c17092e35372
2021-04-14 09:37:30 +00:00
Bill Yi
24c6eaea15 Merge "Merge RQ2A.210405.006 to aosp-master - DO NOT MERGE" 2021-04-14 04:59:51 +00:00
Bill Yi
51f05deb78 Merge RQ2A.210405.006 to aosp-master - DO NOT MERGE
Merged-In: I735b41ed53ce7d374b5d36c4aee79f73d0334234
Merged-In: I9999bfe514fffa9f300643e74942db5ae556670a
Change-Id: If4b670a158e561d8feb03e12aef2d295c5109d43
2021-04-13 19:36:45 -07:00
Lorenzo Colitti
1479494fd5 Add @RedactionType annotations to VpnTransportInfo.
This is in response to API council feedback.

Test: m
Bug: 185226718
Change-Id: I63d7249e7d14ac00558f311a3583f6adbf80e3d9
2021-04-14 00:28:19 +09:00
Chiachang Wang
4bc8b1386f Merge "Make getUid a method on UserHandle itself instead of static" 2021-04-13 08:15:47 +00:00
Chiachang Wang
045961b828 Merge "Add SDK version check to skip S added API test" 2021-04-13 04:30:36 +00:00
Chiachang Wang
d2bce7b6e3 Add SDK version check to skip S added API test
NetworkAgentConfigTest is a part of CtsNetTestCasesLatestSdk.
It will be used in mainline test with a R build. Test will
fail with method not found error. Add a version check to skip
the S added API tests.

Test: atest NetworkAgentConfigTest in R and S device
Fix: 185151127
Change-Id: Ib372e68afa99af455eb2713c8f6f1c8ef1d4cfdf
2021-04-13 10:18:36 +08:00
Lorenzo Colitti
f6f74d517f Merge "Add debug logging to requestRouteToHostAddress." 2021-04-12 14:24:58 +00:00
Chiachang Wang
3cbfc11c93 Merge "Rename APIs in NetworkAgentConfig.Builder" 2021-04-12 14:10:46 +00:00
Chiachang Wang
3d1e89d298 Rename APIs in NetworkAgentConfig.Builder
As API review feedback, rename disableProvisioningNotification()
to setEnabledProvisioningNotification and disableNat64Detection()
to setEnabledNat64Detection. Also, update code in caller side
accordingly.

Bug: 184735772
Test: make update-api ; atest FrameworksNetTests
Change-Id: If7305634863d1503c967e5593ebd0c8af2174bea
2021-04-12 17:27:47 +08:00
paulhu
7fafd1827f Remove TcpRepairWindow from module-lib API
Both TcpRepairWindow and TcpKeepaliveController(user) are in the
connectivity module, so TcpRepairWindow doesn't need to be
the module-lib API. Thus, remove TcpRepairWindow from
module-lib API.

Bug: 172183305
Test: m update-api
Change-Id: I8fde726f8ad73637e6deab69ea83b3699bb2cf45
2021-04-12 14:26:55 +08:00
Lorenzo Colitti
7e27c5412f Add debug logging to requestRouteToHostAddress.
Results in:

04-10 00:52:44.887  1511  2362 D ConnectivityService: requestRouteToHostAddress /192.0.2.3 [101 CELLULAR] ok=true

Bug: 182963397
Test: atest ConnectivityManagerLegacyTest
Change-Id: I4eeb17dd9096705d959516018aedb9173ff97023
2021-04-10 01:04:05 +09:00