Commit graph

37,021 commits

Message SHA1
Merge "Updating formatting and text for per-app dumpsys"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-10-03 05:53:26 +00:00
7ece4bb71e
Merge "Use SettingsShim to hide different implementation in shim"
Mark Chien   authored and   Gerrit Code Review   commited 2021-10-01 01:47:00 +00:00
05fd386de8
Add comment for not listening EXTERNAL_APPLICATIONS_UNAVAILABLE
Bug: 192653840
Test: only add comment.
Change-Id: I5a61ea76a40cf74e15ec36e415d6d4eb8ef6016f

paulhu   authored and   Paul Hu   commited 2021-10-01 01:30:31 +00:00
e7e02d7880
Merge "Restore private dns host name after testing"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-10-01 00:37:15 +00:00
0ee7406d33
Merge "Remove reference when active listener is unregistered"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-10-01 00:37:00 +00:00
a39b107812
Updating formatting and text for per-app dumpsys
Fixing the indentation for dumpsys CONNECTIVITY for per app network
info. Also updated to more clearly show when the active network is
currently tagged to the "no service network" for configured apps so as
to more clearly show intent to dumpsys consumers. Finally, correctly
showing profile network preferences which weren't being shown
previously.

Prior formatting with no per-app networks:
Current per-app default networks: Per-App Network Preference:
    none

Updated formatting with no per-app networks:
Current network preferences:
  Default requests:

Prior formatting with active per-app networks ("none" is shown in this
case since profile network preferences weren't correctly displayed):
Current per-app default networks: Per-App Network Preference:
    none
  Is per-app network active:
    true
    Active network: 100
    Tracked UIDs:
      {1100000-1199999}

Updated formatting with active per-app networks:
Current network preferences:
  Profile preferences:
    [[ProfileNetworkPreference user=UserHandle{11} caps=[ Capabilities:
    INTERNET&TRUSTED&NOT_VCN_MANAGED&ENTERPRISE Uids:
    <{1100000-1199999}>]]]
  OEM preferences:
    OemNetworkPreferences{mNetworkMappings={android.net.cts=-1}}
  Mobile data preferred UIDs:
    mMobileDataPreferredUids: {1, 2, 3}
  Default requests:
    Request: [uid/pid:1000/1423] - Satisfier: [100] Preference order: 10
    Tracked UIDs:{1100000-1199999}

Bug: 189860802
Test: adb shell dumpsys connectivity
Change-Id: I5ed4bb83e9e5a4497f5019ab4e4c0f238989a246

James Mattis   commited 2021-09-30 11:47:36 -07:00
8b298a00b2
Use SettingsShim to hide different implementation in shim
TetheringService call different Settings API to check write settings
permission between R and S.

Bug: 182211575
Test: install S module to R device and both run mts tests build with S
and R.

Change-Id: I3e7f6525e9776992bd96b17c132b749b12285bbd
Merged-In: I3e7f6525e9776992bd96b17c132b749b12285bbd

markchien   commited 2021-09-30 21:42:23 +08:00
b94c515370
Move runDhcp to TetheringTester
This is a no-op CL which add TetheringTester and move runDhcp related
logic to it.

Test: atest EthernetTetheringTest
Change-Id: Ib1c5647b2bd5a1b27c976450d3aa265aff8f5b70

markchien   authored and   Mark Chien   commited 2021-09-30 12:57:30 +00:00
f320c21120
Rename mTapPacketReader to mDowntreamReader
Test: atest EthernetTetheringTest
Change-Id: I2905aba449a2625caf6a82b27b9e43b06191da9f

markchien   authored and   Mark Chien   commited 2021-09-30 12:36:28 +00:00
0bd10760a8
Merge "Support set test network to tethering upstream"
Mark Chien   authored and   Gerrit Code Review   commited 2021-09-30 12:36:11 +00:00
473d864d20
Merge "Add test for CM#[add|remove]DefaultNetworkActiveListener"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-09-30 12:02:12 +00:00
2086865010
Restore private dns host name after testing
The helper method in CtsNetUtils will not restore the private
dns hostname back if the device private dns mode is not strict
mode. It does not cause function break since the host
configuration is useful only when the private dns mode is in
strict mode. But tests should restore the setting back to its
old state to prevent break other tests or erase setttings.

Test: atest android.net.cts.ConnectivityManagerTest and
      check if the private dns server configuration is
      changed or not after testing
Change-Id: I7c85ddac7306c7c3eeac84679d96c4cfb11bd875

Chiachang Wang   commited 2021-09-30 10:32:04 +00:00
5e54074e6e
Remove reference when active listener is unregistered
The registered listeners are added into internal ArrayMap as a
reference but are not removed when the listeners are
unregistered. The actions for registration should be done in
pairs.

Test: atest FrameworksNetTests
Change-Id: Id9e674f5104d1471dd81224b6a271a8a92172e34

Chiachang Wang   commited 2021-09-30 10:30:35 +00:00
2de41686e7
Add test for CM#[add|remove]DefaultNetworkActiveListener
Bug: 199753782
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I2520f7f5feef61502479767aa023e281d1335ee4

Chiachang Wang   commited 2021-09-30 18:29:29 +08:00
859218c893
Support set test network to tethering upstream
Test: atest EthernetTetheringTest

Change-Id: Ief2a92bc6c573a6bb75c72b7a0630e5c0accfa73

markchien   authored and   Mark Chien   commited 2021-09-30 10:14:58 +00:00
2fbd3e72d3
Merge "Small doc improvement"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-09-30 07:48:00 +00:00
a997db7f40
Merge "Check NetworkAgentInfo Map Before Destroying Network"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-09-29 06:03:56 +00:00
9d31c63e03
Merge "Modify Nsd{Service,Manager}Test to conform to its change"
Luke Huang   authored and   Gerrit Code Review   commited 2021-09-29 03:35:20 +00:00
38f82199ab
Check NetworkAgentInfo Map Before Destroying Network
updateNetworkInfo is called with the argument in a message,
which is initialized with `this` in NetworkAgentRegistry.
That means it's technically possible that CS calls
tearDownUnneededNetwork, calling nai.disconnect() and
queuing up a message to call this, but before it's done
the NA calls sendNetworkInfo with DISCONNECTED, which
never looks up the agent from the map. Throwing a
ServiceSpecificException and resulting in a System crash.

Bug: 196423147
Change-Id: Ia52f2b794f32c263200c14b8dc2eb6b184bff5ff

Tyler Wear   commited 2021-09-28 17:41:23 -07:00
614b27badd
Small doc improvement
Test: comment-only change
Bug: 191744296
Change-Id: I80447783c9fd89f3b6685a4276cc555a7075a70f

Chalard Jean   commited 2021-09-28 15:31:15 +09:00
0d05151b5c
Fix NetworkOffer Death link does not exist
unregisterNetworkProvider is being called from binderDied()
and handleUnregisterNetworkProvider() at the same time. This results
in NoSuchElementException being thrown.

Check than noi can be removed from network offers before unregistering
death link.

Bug: 196423150
Change-Id: If5bd5f2894fa0509a89340efdc85180c54e72e0e

Tyler Wear   commited 2021-09-20 10:40:19 -07:00
3ec7e6d9fb
Merge "Add a mode for cell radios unable to time share"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-09-18 12:39:24 +00:00
c80a5d56db
Add a mode for cell radios unable to time share
Upon changing the default SIM card, the radio will create a
new connection to the new subscription. If that subscription
works correctly, the stack will prefer it to the old one as
the new subscription will be marked with a Primary policy
flag it its score.

Normally, at this point the old network lingers to give apps
an opportunity to gracefully migrate their connections. But
with some radios, this may have a dramatic effect on the
performance of the new connection.

This patch introduces a flag so that devices with such radios
can be marked. In this case the stack will move to a degraded
mode and eschew the grace delay for apps and give them a hard
break instead, so that the new network can reach a good
performance immediately. Apps with existing connections will
suffer a worse experience.

If there is a request that can only be served by the old
connection, still keep it, as arguably the user still
expects their MMS be sent on the old connection, even if the
new connection doesn't work well until it's done.

Test: new test in this patch, and add relevant tests in both modes
      also manually change the value of the flag and run
      FrameworksNetTests and CtsNetTestCasesLatestSdk
Bug: 200226979
Change-Id: I4ace82f90e873bf06298cc689bb1d794ed5124bd

Chalard Jean   commited 2021-09-18 04:03:13 +00:00
0702f98edc
Merge "Remove ForceAllNetworkTypes from test"
Aaron Huang   authored and   Gerrit Code Review   commited 2021-09-17 12:08:59 +00:00
f7762c823a
Merge "Test a template matches mobile and mobile wildcard"
Aaron Huang   authored and   Gerrit Code Review   commited 2021-09-16 09:42:22 +00:00
3cbd991ab4
Merge "Correct the calling method in removeDefaultNetworkActiveListener"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-09-16 06:29:36 +00:00
a6e3069c27
Correct the calling method in removeDefaultNetworkActiveListener
The removeDefaultNetworkActiveListener should do the
unregisteration but it's incorrectly calling
registerNetworkActivityListener into the ConnectivityService.

Bug: 199753782
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I65a2ddc82989d736316d51f5058e707f5b261a82

Chiachang Wang   commited 2021-09-16 02:25:48 +00:00
e54c8199aa
Test QosSocketInfo.getNetwork
Bug: 183239152
Test: atest NetworkAgentTest
Change-Id: I9848608e0aa500ff7668350a080537dd4a549214

markchien   authored and   Mark Chien   commited 2021-09-15 03:09:26 +00:00
059bfa6149
Test a template matches mobile and mobile wildcard
Add two test cases for matchesMobile and matchesMobileWildcard

Bug: 183776809
Test: FrameworksNetTests:NetworkTemplateTest
Change-Id: I14d31071655204fe6ad36c71f7f521640e01c96e

Aaron Huang   commited 2021-09-14 23:36:04 +08:00
cbb4d498c2
Merge "Add logging on UnfinishedStubbingException"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-09-13 02:34:27 +00:00
f2ddb4151c
Modify Nsd{Service,Manager}Test to conform to its change
(clean cherry-pick from downstream branch)
Test: atest NsdManagerTest NsdServiceTest
Bug: 191844585
Merged-In: I3cf658498bef5755dcb01127a94fff913b6e6298

Change-Id: I3cf658498bef5755dcb01127a94fff913b6e6298

Luke Huang   authored and   Remi NGUYEN VAN   commited 2021-09-13 10:18:04 +09:00
df75378ad4
Merge "Remove NetworkUtils.queryUserAccess in test"
Paul Hu   authored and   Gerrit Code Review   commited 2021-09-11 05:56:45 +00:00
c7d5ea0bbd
Remove ForceAllNetworkTypes from test
Before sForceAllNetworkTypes is removed, the network
type and meteredness will be ignored when matchesMobile
or matchesMobileWildcard is called.

After sForceAllNetworkTypes is removed, the matches
method should check the network type and the meteredness.
Thus, if the test data contains different type or it's
not metered should not be counted.

Bug: 183776809
Test: FrameworksNetTests
Change-Id: Ie7194495d26c0f5ef7a247733f43c64688626c67

Aaron Huang   commited 2021-09-11 10:45:16 +08:00
7b4a4cbdd4
Delete AirplaneModeTest
It is flaky and redundant, functionality is covered in
ConnectivityManagerTest

Bug: 191856806
Test: N/A
Change-Id: I786f69f6f6cfb73e99cc5dea867024007f44d134

Sergey Troshin   authored and   Dorin Drimus   commited 2021-09-10 09:17:39 +00:00
2e0b45004c
Merge "Wait for validation of WiFi in OEM pref test"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-09-09 18:51:32 +00:00
c60c1bc24e
Merge "Include suspended network when getAllNetworkStateSnapshots"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-09-09 09:24:04 +00:00
48426bb2a4
Wait for validation of WiFi in OEM pref test
OEM_NETWORK_PREFERENCE_TEST prefers NOT_METERED&VALIDATED networks
then TEST networks. If the WiFi isn't validated by the time the
preference is set, then the TEST network is preferred and the test
fails. The best solution is simply to wait for the WiFi network to
validate before setting the preference.

Besides, some of the *wait* methods wait for validation and some
don't, creating confusion. Make this explicit on the
setWifiMeteredStatusAndWait method with a boolean argument, which
forces all users to make an explicit choice.

testSetOemNetworkPreferenceForTestOnlyPref is not affected, as
it does not change WiFi meteredness.

Bug: 195365654
Test: testSetOemNetworkPreferenceForTestPref
Change-Id: Icb9d7ff1ca5c3d93286ea3a79c27f15630d17ee6

Chalard Jean   commited 2021-09-08 18:43:09 +09:00
ae4c414c1f
Include suspended network when getAllNetworkStateSnapshots
Suspended network should be considered as temporary shortage of
connectivity of a connected network. Thus, it should not be
excluded from network state snapshots and causes data usage to
stop accounting or iptables rules to be removed on the interface
of the suspended network.

This change also address the naming confusion of default networks
parameter of expectNotifyNetworkStatus.

Test: atest ConnectivityServiceTest#testGetAllNetworkStateSnapshots
Bug: 196079981
Change-Id: I8096356f9a472fb1c1246fbdf3fd5f981387fb1c

Junyu Lai   commited 2021-09-08 06:02:28 +00:00
ddecb66246
Remove NetworkUtils.queryUserAccess in test
- This method always reuturns false which is not able to use for
  testing.
- Use test restricted network for testing instead.

Bug: 183485986
Test: atest ConnectivityManagerTest
Change-Id: If34d4f1952162f118d53be8074a96b07415a5c85

paulhu   commited 2021-09-07 15:18:06 +00:00
e02bb6052d
Merge changes Id2ffb056,I2a4e298b
* changes:
  Adjust some behaviors on PermissionMonitorTest
  Use common code

Paul Hu   authored and   Gerrit Code Review   commited 2021-09-07 06:01:54 +00:00
420fa2baef
Merge "Remove a forgotten log"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-09-07 04:37:23 +00:00
3d872e662e
Merge "Add debug logs to CaptivePortalTests"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-09-07 04:36:55 +00:00
fe1a4f6e60
Merge "Separate test into reasonable multiple tests"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-09-07 02:40:13 +00:00
26a7e61417
Adjust some behaviors on PermissionMonitorTest
- This is a test only change.
- Remove calling startMonitoring() in setup() because this method
  should be called only once, so each test needs to call
  startMonitoring() if the testing function is running on it.
- Return empty list instead of null when getting installed
  pacakges in setup(). This can help test to have default user
  MOCK_USER1 when they call startMonitoring().

Bug: 192431153
Test: atests FrameworksNetTests
Change-Id: Id2ffb056b378873c3ba6a8bb31b7dedb56ad6d46

paulhu   commited 2021-09-07 09:46:23 +08:00
941fa70744
Use common code
- Some code are used many times, it's better to make them as
  common code for reducing inconsist behavior.
- Also stop using Boolean to represent network permissions and
  replace them with int value. Because using Boolean for
  permission comparison is really complicated and bizarre.
- Use PERMISSION_* for netd network permission directly.

Bug: 189705071
Test: atests FrameworksNetTests
Change-Id: I2a4e298b9a01f4b2874ae68e9d9539a0ab4aff4c

paulhu   commited 2021-09-07 09:25:31 +08:00
b7dd7a3f4b
Merge "Correct uid to app id for netd traffic permission methods"
Paul Hu   authored and   Gerrit Code Review   commited 2021-09-07 01:13:56 +00:00
9fe8c8fc76
Merge "Reduce duplicated code"
Paul Hu   authored and   Gerrit Code Review   commited 2021-09-06 16:17:45 +00:00
1d04d8362f
Add debug logs to CaptivePortalTests
The point is to help with debugging flakes of this test by
clarifying the timing of these calls with respect to when
NetworkMonitor reads the settings and the values it obtains.

Test: CaptivePortalTest
Change-Id: I29ac1d8cff1f96c91be2459e9a8f34f8ba1f38e3

Chalard Jean   commited 2021-09-06 18:08:45 +09:00
d0d5c64bab
Add logging on UnfinishedStubbingException
The test flakes with UnfinishedStubbingException, but the root cause
could not be identified. Add some logging to try to get more information
when that happens.

Bug: 195626111
Test: atest ConnectivityServiceTest

Change-Id: If12c1ea809789148ca9251386e5ee6ca6d74ff74

Remi NGUYEN VAN   commited 2021-09-06 15:13:09 +09:00
f68905683f
Correct uid to app id for netd traffic permission methods
Some uids should be app ids, correct them for avoiding confusion
and incorrect use.

Bug: 189705071
Test: atests FrameworksNetTests
Change-Id: I4a5930e5dc63b4d901e1567f8935ad7203866c89

paulhu   commited 2021-09-06 00:12:23 +08:00
1d4ec79020