summaryrefslogtreecommitdiff
path: root/tests/net/java/com/android/server/ConnectivityServiceTest.java
Commit message (Collapse)AuthorAgeFilesLines
* Move net unit tests to packages/ConnectivityRemi NGUYEN VAN2021-05-131-12792/+0
| | | | | | | | | | | | | | 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
* Merge "Switch from networkCreate[Physical/Vpn] to networkCreate" am: ↵Ken Chen2021-05-131-19/+35
|\ | | | | | | | | | | | | | | c9d5cd9fbc am: 62258932ff am: a4d53bfa6d Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669648 Change-Id: I3475e674c3914c4c61fd0a4246c9ee3e7e02c4fb
| * Merge "Switch from networkCreate[Physical/Vpn] to networkCreate"Ken Chen2021-05-131-19/+35
| |\
| | * Switch from networkCreate[Physical/Vpn] to networkCreateKen Chen2021-05-111-19/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Merge "Update PrivateDnsMode from StringDef to IntDef"Lucas Lin2021-05-121-7/+6
| |\ \
| | * | Update PrivateDnsMode from StringDef to IntDeflucaslin2021-05-051-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update PrivateDnsMode from StringDef to IntDef because IntDef is the normal way of representing multiple choices in public API. Also update other related files. Bug: 185311744 Test: 1. make update-api 2. atest FrameworksNetTests CtsNetTestCases CtsNetTestCasesLatestSdk 3. atest FrameworksServicesTests:DevicePolicyManagerTest Change-Id: I23e7ec140066979726d769cabc5f7057bb2167e6 Merged-In: I23e7ec140066979726d769cabc5f7057bb2167e6 (Cherry-picked from ag/14227609)
* | | | Merge changes from topic "transportinfo-explicit-redaction" into sc-devLorenzo Colitti2021-05-121-17/+74
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | * changes: Immediately redact VcnTransportInfo. Do not automatically redact TransportInfo objects.
| * | | | Do not automatically redact TransportInfo objects.Lorenzo Colitti2021-05-111-17/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | Merge "Add MATCH_ANY_USER flag to PackageInfo queries" am: 68301eb7cb am: ↵Paul Hu2021-05-121-2/+3
|\ \ \ \ \ | |/ / / / |/| / / / | |/ / / | | | | | | | | | | | | | | | | 2b0351ce1e am: 168172c2c0 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1689207 Change-Id: Ie3dd72aa4b8166198884f348f59c77befc229dc0
| * | | Merge "Add MATCH_ANY_USER flag to PackageInfo queries"Paul Hu2021-05-121-2/+3
| |\ \ \ | | |/ / | |/| |
| | * | Add MATCH_ANY_USER flag to PackageInfo queriespaulhu2021-04-261-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Querying PackageInfo should have MATCH_ANY_USER flag because some apps are only installed for specific users. If no flag, it will get NameNotFoundException. - Also add missed break on switch case. Bug: 186382373 Test: atests FrameworksNetTests Change-Id: I37c8c42352a9a84ccbe9a37248febcd62b8f59e4
| * | | Merge "Add getters to UnderlyingNetworkInfo"Treehugger Robot2021-04-291-7/+7
| |\ \ \
| | * | | Add getters to UnderlyingNetworkInfoAaron Huang2021-04-221-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address API review feedback, add getters to UnderlyingNetworkInfo instead of exposing fields. Instead of wasting memory by converting this into an array, have migrateTun take a List<String>. In turn, tunAdjustmentInit should also take a List<String>. (cherry picked from ag/14211075) Bug: 183972554 Test: atest android.net.UnderlyingNetworkInfoTest Merged-In: Id59744097208d91298a25ef110ade91a9cf291a1 Change-Id: Id59744097208d91298a25ef110ade91a9cf291a1
| * | | | Merge "Rename getAllNetworkStateSnapshot which should be pluralized"Treehugger Robot2021-04-291-7/+7
| |\ \ \ \
| | * | | | Rename getAllNetworkStateSnapshot which should be pluralizedAaron Huang2021-04-221-7/+7
| | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address API review feedback, ConnectivityManager#getAllNetworkStateSnapshot should be pluralized so rename the method to getAllNetworkStateSnapshots (cherry picked from ag/14221105) Bug: 183972554 Test: make, FrameworksNetTests FrameworksServicesTests Merged-In: Ic18d17d05984fa2466c962c7843c0ef7183ce77c Change-Id: Ic18d17d05984fa2466c962c7843c0ef7183ce77c
| * | | | Merge "Changing per-app default request to TRACK_DEFAULT"James Mattis2021-04-261-1/+1
| |\ \ \ \
| | * | | | Changing per-app default request to TRACK_DEFAULTJames Mattis2021-04-231-1/+1
| | | |_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changing the per-app default request flows to fallback to a request of type TRACK_DEFAULT as opposed to type REQUEST. The main benefit of this change is that these requests will no longer be sent to the factories which is desired. Bug: 180452284 Bug: 176494815 Test: atest FrameworksNetTests atest FrameworksNetIntegrationTests atest CtsNetTestCasesLatestSdk Change-Id: I312e55a54f70aa82953a32ab9369d5afc02b75e5 Merged-In: I312e55a54f70aa82953a32ab9369d5afc02b75e5
| * | | | Merge "Address API review feedback"Chiachang Wang2021-04-261-11/+11
| |\ \ \ \ | | |/ / / | |/| | |
| | * | | Address API review feedbackChiachang Wang2021-04-231-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address API review feedback to: - Rename NetworkAgent#setTeardownDelayMs to NetworkAgent#setTeardownDelayMillis - Use getters instead of fields in VpnTransportInfo - Rename registerDefaultNetworkCallbackAsUid to registerDefaultNetworkCallbackForUid in ConnectiivityManager Bug: 183972850 Bug: 185246410 Fix: 184735863 Test: make update-api Test: atest FrameworksNetTests Test: atest CtsNetTestCasesLatestSdk Change-Id: I5e8c4bed8bda40d507afa894c359b5e24ee5d868 Merged-In: I5e8c4bed8bda40d507afa894c359b5e24ee5d868
| * | | | Merge "Use connectivity resources in service-connectivity"Remi NGUYEN VAN2021-04-231-13/+14
| |\ \ \ \ | | |_|/ / | |/| | |
| | * | | Use connectivity resources in service-connectivityRemi NGUYEN VAN2021-04-231-13/+14
| | | |/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Merge "[VCN19] Rename get/setSubIds to get/setSubscriptionIds"Treehugger Robot2021-04-221-5/+5
| |\ \ \ | | |/ / | |/| |
| | * | [VCN19] Rename get/setSubIds to get/setSubscriptionIdsjunyulai2021-04-191-5/+5
| | |/ | | | | | | | | | | | | | | | | | | | | | Test: atest FrameworksNetTests FrameworksVcnTests Fix: 185215036 Merged-In: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7 Change-Id: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7 (cherry-picked from ag/14198665)
* | | Rename *Iface* APIs to *Interface*Aaron Huang2021-04-281-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Update PrivateDnsMode from StringDef to IntDef" into sc-devLucas Lin2021-04-271-7/+6
|\ \ \
| * | | Update PrivateDnsMode from StringDef to IntDeflucaslin2021-04-231-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update PrivateDnsMode from StringDef to IntDef because IntDef is the normal way of representing multiple choices in public API. Also update other related files. Bug: 185311744 Test: 1. make update-api 2. atest FrameworksNetTests CtsNetTestCases CtsNetTestCasesLatestSdk 3. atest FrameworksServicesTests:DevicePolicyManagerTest Change-Id: I23e7ec140066979726d769cabc5f7057bb2167e6
* | | | Merge changes I5125755b,I312e55a5 into sc-devJames Mattis2021-04-231-6/+8
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | * changes: Updating tests to honor per-app TRACK_DEFAULT Changing per-app default request to TRACK_DEFAULT
| * | | Updating tests to honor per-app TRACK_DEFAULTJames Mattis2021-04-221-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per-app APIs in ConnectivityService will now have their fallback request which tracks the system default be of type TRACK_DEFAULT as opposed to REQUEST. Existing tests which expect this fallback request to be sent to network factories need to be updated to validate this change. Bug: 180452284 Bug: 176494815 Test: atest FrameworksNetTests Change-Id: I5125755b3ed1ec535494e2d7a48c0860710ed056
| * | | Changing per-app default request to TRACK_DEFAULTJames Mattis2021-04-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changing the per-app default request flows to fallback to a request of type TRACK_DEFAULT as opposed to type REQUEST. The main benefit of this change is that these requests will no longer be sent to the factories which is desired. Bug: 180452284 Bug: 176494815 Test: atest FrameworksNetTests atest FrameworksNetIntegrationTests atest CtsNetTestCasesLatestSdk Change-Id: I312e55a54f70aa82953a32ab9369d5afc02b75e5
* | | | Merge "Address API review feedback" into sc-devChiachang Wang2021-04-231-11/+11
|\ \ \ \ | |/ / / |/| | |
| * | | Address API review feedbackChiachang Wang2021-04-201-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address API review feedback to: - Rename NetworkAgent#setTeardownDelayMs to NetworkAgent#setTeardownDelayMillis - Use getters instead of fields in VpnTransportInfo - Rename registerDefaultNetworkCallbackAsUid to registerDefaultNetworkCallbackForUid in ConnectiivityManager Bug: 183972850 Bug: 185246410 Fix: 184735863 Test: make update-api Test: atest FrameworksNetTests Test: atest CtsNetTestCasesLatestSdk Test: atest FrameworksMockingServicesTests Change-Id: I5e8c4bed8bda40d507afa894c359b5e24ee5d868
* | | | Merge "Enable policy ranking" into sc-devChalard Jean2021-04-221-9/+3
|\ \ \ \
| * | | | Enable policy rankingChalard Jean2021-04-211-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test: Passes all presubmits, been tested in labs Bug: 184834350 Change-Id: If33884aa245bcc8817bbc9c2fdfab035249e7301
* | | | | Merge "Add getters to UnderlyingNetworkInfo" into sc-devAaron Huang2021-04-221-7/+7
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | Add getters to UnderlyingNetworkInfoAaron Huang2021-04-201-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address API review feedback, add getters to UnderlyingNetworkInfo instead of exposing fields. Instead of wasting memory by converting this into an array, have migrateTun take a List<String>. In turn, tunAdjustmentInit should also take a List<String>. Bug: 183972554 Test: atest android.net.UnderlyingNetworkInfoTest Change-Id: Id59744097208d91298a25ef110ade91a9cf291a1
* | | | | Merge "Correctly count nri uid request counts" am: 1b7a5e282c am: 0c8d65b489 ↵James Mattis2021-04-211-7/+79
|\ \ \ \ \ | |_|/ / / |/| | / / | | |/ / | |/| | | | | | | | | | | | | | am: 8bc9d3464c Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1655051 Change-Id: Ibec1f37f2062827cf390eb344dd30447bdabec13
| * | | Correctly count nri uid request countsJames Mattis2021-04-191-7/+79
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | [VCN20] Change requestBackgroundNetwork argument orderjunyulai2021-04-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Test: atest FrameworksNetTests FrameworksVcnTests Fix: 185215095 Merged-In: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb Change-Id: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb (cherry-picked from ag/14198667)
* | | Merge "Rename getAllNetworkStateSnapshot which should be pluralized" into sc-devAaron Huang2021-04-191-7/+7
|\ \ \
| * | | Rename getAllNetworkStateSnapshot which should be pluralizedAaron Huang2021-04-171-7/+7
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | Address API review feedback, ConnectivityManager#getAllNetworkStateSnapshot should be pluralized so rename the method to getAllNetworkStateSnapshots Bug: 183972554 Test: make, FrameworksNetTests FrameworksServicesTests Change-Id: Ic18d17d05984fa2466c962c7843c0ef7183ce77c
* | | Merge "[VCN19] Rename get/setSubIds to get/setSubscriptionIds" into sc-devJunyu Lai2021-04-161-5/+5
|\ \ \
| * | | [VCN19] Rename get/setSubIds to get/setSubscriptionIdsjunyulai2021-04-151-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Test: atest FrameworksNetTests FrameworksVcnTests Fix: 185215036 Ignore-AOSP-First: avoid merge conflict Change-Id: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
* | | | [NS13] Remove the last usage of the legacy intChalard Jean2021-04-161-21/+8
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that this requires removing part of a test, because that part is testing that the a 50 bonus of the legacy int is stronger than the validation penalty, which is not a mechanic we want to have. When WiFi is unvalidated and cell is unvalidated, cell should be kept in case it validates, like is described in comments in isNetworkPotentialSatisfier ; however this test is checking that it *IS* reaped off if the wifi score is strong enough. This should be incorrect, and should not be tested, so this patch removes the check. Test: ConnectivityServiceTest Bug: 184834350 Change-Id: I8966abee59fea2d9f10f082aba87df6588b72762
* | | Merge "[VCN20] Change requestBackgroundNetwork argument order" into sc-devJunyu Lai2021-04-151-1/+1
|\ \ \
| * | | [VCN20] Change requestBackgroundNetwork argument orderjunyulai2021-04-151-1/+1
| |/ / | | | | | | | | | | | | | | | | | | Test: atest FrameworksNetTests FrameworksVcnTests Fix: 185215095 Ignore-AOSP-First: avoid build break caused by multipatch automerge Change-Id: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
* / / Allow network providers to set the linger duration.Chalard Jean2021-04-141-1/+2
|/ / | | | | | | | | | | | | | | Test: atest CtsNetTestCases:NetworkAgentTest#testSetLingerDuration Ignore-AOSP-First: prevent merge conflict CTS-Coverage-Bug: 184796264 Bug: 184227264 Change-Id: I7f420faa40863385114705d6971cf00887d03318
* | Merge "Fix nascent timer never get removed" into sc-devJunyu Lai2021-04-131-4/+9
|\ \
| * | Fix nascent timer never get removedjunyulai2021-04-081-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By design, the nascent timer will be removed after a network satisfied first request. However, this never happens. Because the mInactive is false when that happens, so isNascent is never true. Furthermore, when removing a nascent timer, the inactivity state can never be updated since no condition in the updateInactivityState will be met to update the state correctly. Thus, update inactive state accordingly when adding/removing the nascent timer. Test: TH Bug: 184227264 Ignore-AOSP-First: prevent merge conflict Change-Id: I4c1521b6e0ef68ac489771a2ab6b09ef3e381577
* | | Merge "Adding log history for setOemNetworkPreference()" am: 7fe91d40f1 am: ↵James Mattis2021-04-091-0/+31
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | b86ffd63db am: c315be9128 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1666340 Change-Id: I123342002b462567174960aa30d1bc4727a8cec7
| * | Adding log history for setOemNetworkPreference()James Mattis2021-04-081-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding historical logging for the setOemNetworkPreference() calls. This will last across reboots. Bug: 177257940 Bug: 176494815 Test: atest FrameworksNetTests Change-Id: I4fc35fd58ff741830aa292adc1c559b4279ad8f9