summaryrefslogtreecommitdiff
path: root/tests/net/common/java
AgeCommit message (Collapse)Author
2021-05-13Move net unit tests to packages/ConnectivityRemi NGUYEN VAN
Move the tests together with packages/Connectivity code, so both can be moved to packages/modules/Connectivity together. Also reorganize unit tests in a unit/ directory, as other tests (integration/, common/ etc.) have been added in tests/net since they were created. This makes the directory structure consistent. Test: atest FrameworksNetTests Bug: 187814163 Ignore-AOSP-First: needs per-branch move for merge conflicts Change-Id: I254ffd1c08ec058d594b4ea55cbae5505f8497cc
2021-05-11Do not automatically redact TransportInfo objects.Lorenzo Colitti
Currently, NetworkCapabilities always redacts the TransportInfo objects it contains whenever a defensive copy is made. This makes it impossible to make a defensive copy on a TransportInfo parcelled from another process without redacting it. Stop redacting by default; instead rely on ConnectivityService explicitly calling NetworkCapabilities' redacting constructor when it returns a NetworkCapabilities object to an app via a callback or synchronous call. This is currently done by - createWithLocationInfoSanitizedIfNecessaryWhenParceled, which is called from callCallbackForRequest, getNetworkCapabilities, and getDefaultNetworkCapabilitiesForUser. - getNetworkCapabilitiesWithoutUids, which is used when sending ConnectivityDiagnosticsManager callbacks. In this method, unconditionally redact all information, which is what the code did previously due to the default redaction setting for empty NetworkCapabilities objects being REDACT_ALL. Bug: 183938194 Test: atest NetworkCapabilitiesTest Test: atest FrameworksNetTests CtsNetTestCases HostsideVpnTests Change-Id: I3108ee94cb0930958e071ba678c3554525b0db82
2021-05-08Rename unwanted capabilities to forbidden capabilities.Lorenzo Colitti
Addresses API council feedback. Bug: 184890428 Test: atest FrameworksNetTests CtsNetTestCases Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest on R device Change-Id: Id7c68fbf56ee08fcad8e8e3aacf037fa1885936b
2021-04-28Rename *Iface* APIs to *Interface*Aaron Huang
Address API review feedback, other APIs have been refering to these as "interface" instead of "iface" so migrate the APIs named *Iface* to *Interface*. Bug: 183972554 Test: atest android.net.UnderlyingNetworkInfoTest Change-Id: I38b476e762fb57fa88c4a789092d0af6f5330d80
2021-04-22Fix netId testing on Q and RRemi NGUYEN VAN
Do not call getNetId() on Q as it did not exist yet. Add a separate test for getNetId(), only run after Q. Also add testing for getNetIdForResolv and fromNetworkHandle on Q and R. Bug: 185731396 Test: atest NetworkTest Change-Id: I03f9eb0c94b09dc285018e9887fe20d95a93ae45
2021-04-20Merge "Roll forward: add a test for ParseException" am: 1f43a69d91 am: ↵Treehugger Robot
80deff6a5c am: 890dbd1205 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1679759 Change-Id: I7b1b1be4fa5bcda94b653dffbc99db65384079ad
2021-04-20Merge "Revert "Add a test for ParseException"" am: fe737812ce am: f35d4a2d44 ↵Remi NGUYEN VAN
am: 44775a141e Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1679758 Change-Id: I9257db040086870412833e8cfb14596f6ac17288
2021-04-20Roll forward: add a test for ParseExceptionRemi NGUYEN VAN
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-20Revert "Add a test for ParseException"Remi NGUYEN VAN
This reverts commit 54e707a62e9ef45ac89c295f03571a67eac0bf29. Reason for revert: Test broken on R: b/185751610 Change-Id: I9f5d25c0ba81011848ab3cf7ec44aa329fbb3b0f
2021-04-19Merge "Add a test for ParseException" am: 68090c1373 am: ae15a30cf0 am: ↵Remi NGUYEN VAN
cbdfe0587e Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1675625 Change-Id: I303ef3cdfaddf6b7a4aea661dbbceb7ab8d3eeca
2021-04-19Merge "Add a test for ParseException"Remi NGUYEN VAN
2021-04-16Merge "[VCN19] Rename get/setSubIds to get/setSubscriptionIds" into sc-devJunyu Lai
2021-04-15Merge "Add test for [set|is]BypassableVpn" am: 3fbec7cf77 am: 2d4f82f0cf am: ↵Treehugger Robot
4e7a9be399 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1676426 Change-Id: Ib65cdc3ebbde42c2ba68880b2895b0bc3db5c022
2021-04-15[VCN19] Rename get/setSubIds to get/setSubscriptionIdsjunyulai
Test: atest FrameworksNetTests FrameworksVcnTests Fix: 185215036 Ignore-AOSP-First: avoid merge conflict Change-Id: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
2021-04-15Add test for [set|is]BypassableVpnlucaslin
Bug: 182963397 Test: 1. atest CtsNetTestCases:NetworkAgentConfigTest 2. atest CtsNetTestCasesLatestSdk:NetworkAgentConfigTest Change-Id: I0250a0313d3a7561ab8efa851fbc06f5bce11185
2021-04-14Add a test for ParseExceptionRemi NGUYEN VAN
The test simply creates an exception and verifies that it has the required fields. Test: atest FrameworksNetTests Change-Id: I76ded2ac3f93ff3910bba3f1e4f1c17092e35372
2021-04-13Merge "Add SDK version check to skip S added API test" am: 739195c5b0 am: ↵Chiachang Wang
a8ae705499 am: b92605cc81 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1673167 Change-Id: I0cdc2e50246204925590ba556b6b67a7499140ee
2021-04-13Add SDK version check to skip S added API testChiachang Wang
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-12Merge "Rename APIs in NetworkAgentConfig.Builder" am: a0445d3546 am: ↵Chiachang Wang
1de3108a3f am: 9a9e7b1bab Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669047 Change-Id: I1988750dd4b65a3d74c33c8fc120bb3bcb705320
2021-04-12Rename APIs in NetworkAgentConfig.BuilderChiachang Wang
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-09Merge "Replace fields with getters in keepalive API" am: 8c5ae7e37f am: ↵Remi NGUYEN VAN
e07d038931 am: b4d44cfe7f Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669345 Change-Id: I73f6f89eb2d1255743d10c1ec1c92770845bdd63
2021-04-08Replace fields with getters in keepalive APIRemi NGUYEN VAN
General guidance is to have getters in the API instead of fields. Fixes: 181014882 Test: m Change-Id: Id4bfc447701e8d0380163047779fbba043f17b6f
2021-04-01Merge "Move deduceRestrictedCapability to libs/net and rename it"Aaron Huang
2021-04-01Ignore checking TRANSPORT_USB when Android version is older than Slucaslin
There is a new transport type - TRANSPORT_USB(8) in Android S, so when the test tries to add this new transport type in older Android version, it cannot pass the transport type validation and make test fail. Bug: 184158327 Test: run CtsNetTestCasesLatestSdk on Android R & Q Change-Id: I38816173b04ea198d99f64f45e9271ac2641e4ac
2021-03-29Fix cannot success verify count of the networkAgent Config items on Rlifr
device Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkAgentConfigTest Fix: 183474500 Change-Id: Ie0fd5ba816c390bfb7bc6512d896a88482c217ec Merged-In: Ie0fd5ba816c390bfb7bc6512d896a88482c217ec
2021-03-29[TL02]Remove hidden API usage of NetworkAgentlifr
The connection service will become the mainline module. Remove the hidden API usage of NetworkAgent. Bug: 170598012 CTS-Coverage-Bug: 170598012 Test: atest FrameworksNetTests FrameworksTelephonyTests atest FrameworksWifiTests Change-Id: I4e4040ae7f94bdf479c7df9ec2ffabafbe06331c Merged-In: I4e4040ae7f94bdf479c7df9ec2ffabafbe06331c
2021-03-26Move deduceRestrictedCapability to libs/net and rename itAaron Huang
NetworkCapabilities is included in framework-connectivity, so external module cannot have dependencies on its hidden API. Move the method to libs/net so that external modules can use it by including the library. Bug: 178777253 Test: FrameworksNetTests (cherry-picked from ag/13921626) Merged-In: I77970b3a5e5e0e9d263639694b1f06519169bf64 Change-Id: I77970b3a5e5e0e9d263639694b1f06519169bf64
2021-03-25[NS05] Feed network offer callbacksChalard Jean
The design is very simply expressed : An offer is needed for a request if and only if that offer might beat the satisfier for that request. The implementation of "might beat" is NetworkRanker#mightBeat. Test: FrameworksNetTests FrameworksWifiTests NetworkStackTests Bug: 167544279 Change-Id: I0fe911eef2483ecbac48c733d56283b81538690a
2021-03-24Remove dependency on libnetd_clientRemi NGUYEN VAN
NetworkUtils can just use the NDK to achieve the same. Also make sure network handles can have the local nameservers flag, for the JNI API, and create/parse them accordingly in Network. Bug: 171540887 Test: atest CtsNetTestCases (in particular MultinetworkApiTest, DnsResolverTest, NetworkTest) Change-Id: I2e7b78263f7ca0cab9458854858a7423f6bd2854
2021-03-24Merge "Fix cannot success verify count of the networkAgent Config items on R ↵Frank Li
device" into sc-dev
2021-03-23Merge "Correct the logic in NetworkCapabilitiesTest" am: 457f91decf am: ↵Chiachang Wang
885aad17b5 am: 008ba7a698 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649297 Change-Id: I3a99cab2dc0bdaa88a9671e1978c29cb40cd7a5b
2021-03-23Merge "Move deduceRestrictedCapability to libs/net and rename it" into sc-devAaron Huang
2021-03-23Merge "Fix cannot find removeUnwantedCapability on R device"Junyu Lai
2021-03-23Merge "Correct the logic in NetworkCapabilitiesTest"Chiachang Wang
2021-03-23Fix cannot success verify count of the networkAgent Config items on Rlifr
device Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkAgentConfigTest Fix: 183474500 Change-Id: Ie0fd5ba816c390bfb7bc6512d896a88482c217ec
2021-03-23Fix cannot find removeUnwantedCapability on R devicejunyulai
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkCapabilitiesTest Fix: 183473863 Merged-In: Icf2cda325795acee22a6c634e8d978f64c5ac3cb Change-Id: Icf2cda325795acee22a6c634e8d978f64c5ac3cb (cherry-picked from ag/13966708)
2021-03-23Fix cannot find removeUnwantedCapability on R devicejunyulai
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkCapabilitiesTest Fix: 183473863 Change-Id: Icf2cda325795acee22a6c634e8d978f64c5ac3cb
2021-03-23Correct the logic in NetworkCapabilitiesTestChiachang Wang
setOwnerUid() and setAdministratorUids() should run in R+. Previous logic will skip them in S+. Correct the logic to what it should be. Bug: 172183305 Test: atest android.net.NetworkCapabilitiesTest Change-Id: Ic983aa00f930fb26350469ef093bcba2990433a4
2021-03-23Merge "[VCN15] expose addUnwantedCapability and related APIs"Junyu Lai
2021-03-23Merge "[TL02]Remove hidden API usage of NetworkAgent" into sc-devFrank Li
2021-03-23[TL02]Remove hidden API usage of NetworkAgentlifr
The connection service will become the mainline module. Remove the hidden API usage of NetworkAgent. Bug: 170598012 CTS-Coverage-Bug: 170598012 Test: atest FrameworksNetTests FrameworksTelephonyTests atest FrameworksWifiTests Change-Id: I4e4040ae7f94bdf479c7df9ec2ffabafbe06331c
2021-03-22Move deduceRestrictedCapability to libs/net and rename itAaron Huang
NetworkCapabilities is included in framework-connectivity, so external module cannot have dependencies on its hidden API. Move the method to libs/net so that external modules can use it by including the library. Bug: 178777253 Test: FrameworksNetTests Change-Id: I77970b3a5e5e0e9d263639694b1f06519169bf64
2021-03-22[VCN15] expose addUnwantedCapability and related APIsjunyulai
Test: m -j doc-comment-check-docs Bug: 175662146 Change-Id: I3f2e6a99e015f09cc4405f6804eac4ae33e3dcc7
2021-03-22[VCN15] expose addUnwantedCapability and related APIsjunyulai
Test: m -j doc-comment-check-docs Bug: 175662146 Merged-In: I3f2e6a99e015f09cc4405f6804eac4ae33e3dcc7 Change-Id: I3f2e6a99e015f09cc4405f6804eac4ae33e3dcc7 (cherry-picked from ag/13929102)
2021-03-22Merge "Revert "Correct the logic in NetworkCapabilitiesTest""Chiachang Wang
2021-03-22Revert "Correct the logic in NetworkCapabilitiesTest"Chiachang Wang
This reverts commit f08d3d435930c50b8d31ae96344b75493dd476f3. Reason for revert: <Merge abnormal in automerger> Change-Id: I0cdb401f4962050bf24dc9d9871d4ef15cf52629
2021-03-22Merge "Correct the logic in NetworkCapabilitiesTest"Treehugger Robot
2021-03-21resolve merge conflicts of 403b7fd0b0a6736bcee1817fb5c774f8c8a040de to ↵Roshan Pius
stage-aosp-master Change-Id: Ib9d7923104ac0a60f6af5a3a2d2b7f13bc0262e3
2021-03-19TransportInfo: Add a generic redaction mechanismRoshan Pius
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-19Revert^2 "Replace the usage of UidRange"Chiachang Wang
5b7aad6995711879823b6a035792b13c5cc06f59 UidRange is used in a shared way between ConnectivityService and VPN through the use of NetworkCapabilities. UidRange will be part of the ConnectivityService mainline but Vpn.java will stay in the framework. We need a way to replace the APIs using UidRange, or to make UidRange system API. The only really relevant surface here is NetworkCapabilities#{setUids, getUids}. The need for UidRange could be replaced by an integer Range, so replace the usage of UidRange by a integer Range in NetworkCapabilities#{setUids, getUids} and update the relevant callers. Bug: 172183305 Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk Change-Id: I0f679fb5fb8f4fe26461ca4912ca1fdfe7f43c9e Merged-In: I4e5aec6ef1ea02e038fcd7ed117a3b67b69c5cb9