Commit Graph

12675 Commits

Author SHA1 Message Date
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
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
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
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
James Mattis
6e4405f926 Adding log history for setOemNetworkPreference()
Adding historical logging for the setOemNetworkPreference() calls. This
will last across reboots.

Bug: 177257940
Bug: 176494815
Test: atest FrameworksNetTests
Change-Id: I4fc35fd58ff741830aa292adc1c559b4279ad8f9
2021-04-08 17:40:06 -07:00
Chiachang Wang
97565cfdb3 Make getUid a method on UserHandle itself instead of static
This commit addresses the API review feedback that getUid()
will be better to make it be a method on UserHandle itself
rather than a static method.

Update as it is and update the corresponding usages.

Fix: 184735865
Test: make update-api
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I33844309224d84764704255d251fadc8940202ca
2021-04-09 08:33:07 +08:00
Remi NGUYEN VAN
faf00d43b9 Merge "Improve documentation on simulateDataStall" 2021-04-09 00:21:34 +00:00
Remi NGUYEN VAN
4abe99e563 Merge "Set ParseException constructors as public" 2021-04-09 00:20:33 +00:00
Remi NGUYEN VAN
bc01e88edc Merge "Replace fields with getters in keepalive API" 2021-04-09 00:20:13 +00:00
Remi NGUYEN VAN
94c8957576 Merge "Add RequiresPermission to TestNetworkManager" 2021-04-09 00:19:51 +00:00
Remi NGUYEN VAN
793d607d75 Merge "Replace IS_DEBUGGABLE with isDebuggable module API" 2021-04-09 00:19:19 +00:00
Remi NGUYEN VAN
4e34417eec Merge "Use String in CaptivePortalData underlying types" 2021-04-09 00:17:59 +00:00
James Mattis
9e1bc22ce5 Merge "Adding OEM Network Preferences for testing" 2021-04-08 20:51:05 +00:00
Remi NGUYEN VAN
58df155b9d Use String in CaptivePortalData underlying types
The venue friendly name comes from the network, and only plain strings
should be used in practice. writeCharSequence is also not usable in
CaptivePortalData, as it must build using module_api.

Use a String as the underlying type in CaptivePortalData, keeping
CharSequence in the API for consistency with UI-related elements.

This brings CaptivePortalData in line with downstream branches.

Bug: 183174863
Test: atest FrameworksNetTests
Merged-In: Ifa3ea9aae0cabf5757791c4ae13e6f551759ed97
Change-Id: Ic662d3b546d52f825f9c3a24c5e0d4ba03818ab0
2021-04-08 08:23:20 +00:00
Remi NGUYEN VAN
5738b86274 Improve documentation on simulateDataStall
Explain that:
 - The method does not cause an actual data stall.
 - The detectionMethod parameter refers to
   ConnectivityDiagnosticsManager.DataStallReport constants (which
   already use an IntDef).
 - timestampMillis is relative to SystemClock.elapsedRealtime.

Fixes: 183972768
Test: m
Change-Id: I2eeb79e0e8ec6e8fd3b8fe1dcb1abbf2e6338983
2021-04-08 16:30:25 +09:00
Remi NGUYEN VAN
6671f42bef Add RequiresPermission to TestNetworkManager
All API methods in TestNetworkManager require the MANAGE_TEST_NETWORKS
permission.

Fixes: 183972672
Test: m
Change-Id: Ic5929c24ea88d7259d367a81fec8f223a2e3ecb0
2021-04-08 16:12:23 +09:00
Remi NGUYEN VAN
da39ab14ce Set ParseException constructors as public
As there is no strong reason to keep the constructors module-lib, set
them as public API.
This is in response to API feedback.

Fixes: 183446251
Test: m
Change-Id: I01daa6f6f8095f7a4db94d1ca05f913166939df3
2021-04-08 15:57:31 +09:00
Remi NGUYEN VAN
029a0cff8a Replace fields with getters in keepalive API
General guidance is to have getters in the API instead of fields.

Fixes: 181014882
Test: m
Change-Id: Id4bfc447701e8d0380163047779fbba043f17b6f
2021-04-08 14:06:53 +09:00
Remi NGUYEN VAN
53e0271281 Replace IS_DEBUGGABLE with isDebuggable module API
Introduce a Build.isDebuggable() getter instead of the IS_DEBUGGABLE
static member.

Also make it module API as APK modules now have access to module APIs in
S, but also TestApi so it can be tested.

Test: m
Fixes: 182345786
Change-Id: I25d0848aee758792bbaba8ab73b5dd997a7250b3
2021-04-08 13:50:31 +09:00
Aaron Huang
77d6e7b0ba Merge "Remove Network, NetworkRequest metrics from jobscheduler" 2021-04-08 02:27:05 +00:00