Commit graph android_packages_modules_Co.../Tethering/tests/unit/src
Message SHA1
Merge "Gate exemptFromEentitlementCheck by Network_STACK permission"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-06-02 03:31:24 +00:00
650c23fdc2
Merge changes from topic "tether_offload_data_limit"
* changes:
  Make tethering module to use netd_aidl_interface-unstable-java
  [BOT.5] Move class Ipv6ForwardingRule from IpServer to the coordinator
  [BOT.3] Add unit test for polling network stats in the coordinator
  [BOT.2] Create a coordinator and stats provider to provide tether stats
  [BOT.1] Add a class ForwardedStats in TetheringUtils

Nucca Chen   authored and   Gerrit Code Review   commited 2020-06-01 23:33:24 +00:00
4155d2a6ad
Merge "Use Class#getSimpleName instead of KClass#getSimpleName"
Paul Hu   authored and   Gerrit Code Review   commited 2020-06-01 06:43:13 +00:00
aac3b2ead0
[BOT.3] Add unit test for polling network stats in the coordinator
Verify that the coordinator could fetch tether stats from BPF maps and
report the network stats to the service.

Bug: 150736748
Test: atest BpfCoordinatorTest
Change-Id: Ib1756159a2047c5db7d31359b0f288f840bd1bb1

Hungming Chen   commited 2020-05-29 20:23:31 +08:00
7997d691fe
[BOT.2] Create a coordinator and stats provider to provide tether stats
Make BPF tethering offload coordinator, BpfCoordinator,
registers a network stats provider, BpfTetherStatsProvider, and
provide the tethering stats from the BPF map.

Bug: 150736748
Test: new test BpfCoordinatorTest

Change-Id: I22e71f87b67668f7e733e4f215d93bf5b2c9380d

Hungming Chen   commited 2020-05-29 20:23:22 +08:00
68f1c2a63f
Gate exemptFromEentitlementCheck by Network_STACK permission
Shell has TETHER_PRIVILEGED permission. To avoid any service to adopt
shell identity by lunching service with Shell process, gate
exemptFromEentitlementCheck by NETWORK_STACK.

Bug: 157702014
Test: atest TetheringCoverageTests
Change-Id: I6ddfda23d36ea9981e3e1eb5a87767f452a65852

markchien   authored and   Mark Chien   commited 2020-05-29 06:46:22 +00:00
9e790873d9
Use Class#getSimpleName instead of KClass#getSimpleName
KClass#getSimpleName need refer to kotlin-reflect.jar which need
include it in Andorid.bp. However, it's not necessary to use
KClass#getSimpleName but use Class#getSimpleName instead.

Test: atest TetheringTests
Bug: 157527499
Change-Id: I49bc336a276d30152402eba926cc583bc81e8e5c
Merged-In: I49bc336a276d30152402eba926cc583bc81e8e5c

paulhu   commited 2020-05-29 00:29:22 +08:00
086f24626c
Tethering: ensure downstream prefix do not conflict with upstream
- Add New class PrivateAddressCoordinator to coordinate the private
  address conflict problem.
- Downstream prefix would be random in 192.168.0.0/24 ~
  192.168.255.0/24.
- If new upstream prefix is conflict with existing downstream prefix,
  downstream would be kicked out and it would request a new one.
- The last conflict upstream prefixes would be blacklist. Avoid to
select downstream prefix which is conflict with prefixes in blacklist.

Bug: 130879722
Test: -build, flash, boot
      -atest TetheringTests

Change-Id: Ib45b87bcd9eeb5da03fb7ec90b1af9ca53998cf5

markchien   commited 2020-05-27 21:36:01 +08:00
c9daba32f7
Merge "Adjust TTL for ipv6 tethering"
Mark Chien   authored and   Gerrit Code Review   commited 2020-05-25 01:42:36 +00:00
6d0a178a6b
Adjust TTL for ipv6 tethering
If upstream is cellular, set the TTL in Router Advertisements to
"network-set TTL - 1" for carrier requirement. For other non-cellular
upstream, set TTL as "network-set TTL + 1" to preventing arbitrary
distinction between tethered and untethered traffic.

Bug: 154776299
Test: atest TetheringTests

Change-Id: I7f2696a642f96c6aafb5613b980bf5bcdd08bbda

markchien   commited 2020-05-24 22:52:44 +08:00
d63c4f35de
Fix TetheringServiceTest test WRITE_SETTINGS permission failure
AdoptShellPermissionIdentity can not pass permission check by
Settings#checkAndNoteWriteSettingsOperation. It would compare the caller
uid and its package name. See error below:
1. java.lang.SecurityException:
Specified package com.android.shell under uid 10239 but it is really 2000
2. java.lang.SecurityException:
uid 10245 does not have android.permission.UPDATE_APP_OPS_STATS.

Override the method and test if caller hold WRITE_SETTINGS directly.

Bug: 154869719
Test: TetheringTests, TetheringCoverageTests, NetworkStackNextTests,
NetworkStackCoverageTests

Change-Id: I2a60c4d66ef30028f9663159f85464ea815248e2

markchien   commited 2020-05-20 16:56:33 +08:00
f4394e83f8
Merge "TetheringServiceTest: test caller permission"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-05-19 02:40:03 +00:00
366eae572d
TetheringServiceTest: test caller permission
Bug: 154869719
Test: atest TetheringTests
Change-Id: I7beea3f011d930e433443ed62d772a3f8cce5d78

markchien   commited 2020-05-19 09:04:43 +08:00
2a1656d3f8
Merge "Fix READ_DEVICE_CONFIG permission denied problem in TetheringTests"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-05-14 16:00:27 +00:00
fb2caff580
Fix READ_DEVICE_CONFIG permission denied problem in TetheringTests
Bug: 156557122
Test: atest TetheringTests

Change-Id: Id9c0397306f3872fc23520d1354f338035a96dc9

markchien   commited 2020-05-14 16:42:22 +08:00
74174690d1
Merge "Support MirrorLink DHCPDECLINE."
Xiao Ma   authored and   Gerrit Code Review   commited 2020-05-14 06:27:16 +00:00
cc755bf9fc
Merge "Make members final in TetheringService"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-05-13 16:04:58 +00:00
7e2180f019
Support MirrorLink DHCPDECLINE.
Add the specific implementation of onNewPrefixRequest callback
on IpServer side, also refactor some common code.

Bug: 130741856
Test: atest TetheringTests
Change-Id: If2871bf899cb5890bbfee18063a194c92b6f474e

Xiao Ma   commited 2020-05-13 23:29:49 +09:00
4455d6b1bd
Make members final in TetheringService
1. Move isTetheringSupport logic from TetheringService to Tethering.
2. Small readability improvement in TetheringTest. Also change
config_tether_upstream_automatic from false to true in TetheringTest.
So TetheringTests would default run automatic select upstream flow
instead of selecting by legacy perferred network type list.

Bug: 153609486
Test: atest TetheringTest
Change-Id: I5a82a6347f62d3a7031db5c56e8e0c8530dafd8f
Merged-In: I5a82a6347f62d3a7031db5c56e8e0c8530dafd8f

markchien   authored and   Mark Chien   commited 2020-05-13 12:25:15 +00:00
1da5f7d499
Merge "Add test for OffloadHardwareInterface"
Mark Chien   authored and   Gerrit Code Review   commited 2020-05-13 08:39:32 +00:00
37b52321ee
Add test for OffloadHardwareInterface
Bug: 145490751
Test: atest TetheringTests

Change-Id: Ia402a6caaa0dfaa05d25a02101c515bbd884d33f

markchien   commited 2020-05-13 14:36:42 +08:00
bcaf0d61ce
Merge changes I2d6f80f0,I9c26852d
* changes:
  Use device option to control BPF offload features
  Add tether BPF offload config to device config and resource

Nucca Chen   authored and   Gerrit Code Review   commited 2020-05-12 11:00:04 +00:00
50522024a1
Allow to exempt from entitlement check
To exempt from entitlement check, caller need to hold TETHER_PRIVILEGED
permission.

Bug: 141256482
Test: atest TetheringTests

Change-Id: I2eb37f5e92f5f5150a7fb7c25b945e28704d27a0

markchien   commited 2020-05-08 18:55:26 +08:00
f5078f489d
Address the comment of aosp/1288493
Bug: 141256482
Test: atest TetheringTests
Change-Id: I0cf337625cee31a47879c59e9b18657ea7624eb4

markchien   commited 2020-05-08 15:51:52 +08:00
147e5765ee
Test tethering log dump
Bug: 145490751
Test: atest TetheringTests
Change-Id: I01fc6969041711f7a15880144ee5eac591086ecd

markchien   commited 2020-05-06 17:00:37 +08:00
146f6055bd
Use device option to control BPF offload features
If BPF offload device config is not enabled:
- Does not add/remove offload forwarding rules through disabling IP
  neighbor monitor.
- Does not apply the RA MTU reduction.

Bug: 149997301
Test: atest IpServerTest
Change-Id: I2d6f80f0229f580c4b16243a064e889a6c37f77a

Hungming Chen   commited 2020-05-05 17:43:50 +08:00
3d8fa889b4
Add tether BPF offload config to device config and resource
The tether bpf offload can be enabled by resource config and
device config. The device config has higher priority and it
could override this config which is set by resource config.

Bug: 149997301
Test: -build, flash, boot
      -atest TetheringConfigurationTest
Change-Id: I9c26852d2c926786e141ece6da53df3801c049b2

Hungming Chen   commited 2020-05-05 17:37:32 +08:00
8bf2e7e05b
[SP18.6] Make offload controller poll interval configurable
Test: atest TetheringTests
Bug: 149467454

Change-Id: I0b07a0b520dedb479bf863fbfe898ae85b84b0f3

junyulai   commited 2020-05-05 11:45:36 +08:00
5475504266
[SP18.5] Create offload controller poll interval to resource
Test: atest TetheringConfigurationTest
Bug: 149467454
Change-Id: I8b4ad920a4945504914d3741a9fba5c096fbf452

junyulai   commited 2020-05-04 14:56:37 +08:00
9606a22037
[SP18.4] Add unit test for polling network stats in OffloadController
Test: atest OffloadControllerTest
Bug: 149467454
Change-Id: I9b9c9c096a2366aaf383d5c2d567db6682f02dad

junyulai   commited 2020-05-04 14:56:37 +08:00
9c50628e95
[SP18.3] Adapt TestableNetworkStatsProviderCbBinder
This is a no-op refactoring to adapt new test provider callback.
Also this patch adapts TestLooper to allow better control on
delay messages that will be verified in subsequent tests.

Test: atest OffloadControllerTest
Bug: 149467454
Change-Id: Icfd6ff289d6689ae2d5753d3fe472516c808dc7a

junyulai   commited 2020-05-04 14:56:36 +08:00
da5dfd9f0d
Merge "[SP18.1] add dependency object to OffloadController"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-04-29 12:08:22 +00:00
c75f373448
[SP18.1] add dependency object to OffloadController
In order to mock constant in unit test, a dependency object is
introduced with minimum code change to achieve this.

Test: atest TetheringTests
Bug: 149467454
Change-Id: I38628daddcb7be7c74846e78d36dc88f065b97d9

junyulai   commited 2020-04-28 18:27:57 +08:00
360c88f238
Merge "Address comments on NetworkStack AIDL v6"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2020-04-24 11:56:32 +00:00
9b687b94a4
Address comments on NetworkStack AIDL v6
Address issues found during AIDL review:
 - Rename clientAddr to singleClientAddr
 - Do not use a ParcelableBundle for notifyNetworkTested or
   notifyDataStallSuspected; instead use AIDL parcelables for stronger
   backwards compatibility guarantees.

Test: atest NetworkMonitorTest ConnectivityServiceTest
      ConnectivityServiceIntegrationTest, manual
Bug: 153500847
Change-Id: Id9b71784e5f6294d203230e57737979e063ff0f8

Remi NGUYEN VAN   commited 2020-04-24 18:52:02 +09:00
aba3d2ebeb
Merge "[TNU09] Adjust restricted notification"
Paul Hu   authored and   Gerrit Code Review   commited 2020-04-23 07:50:34 +00:00
3db6cae8d4
[TNU09] Adjust restricted notification
1. Let restricted notification that can be dismissed.
2. Only put up restricted notification when any of tethering is
   activating.

Bug: 154214549
Test: atest TetheringTests
Change-Id: Ib980aca154036828abdab35e3bb11d42f85ff610

paulhu   commited 2020-04-23 00:17:28 +08:00
03142a0568
Merge "Set attributionTag for noteOp(WRITE_SETTINGS) calls"
Philip P. Moltmann   authored and   Gerrit Code Review   commited 2020-04-22 14:58:13 +00:00
83ba9531d7
Add TetheringCommonTests
Bug: 153614365
Bug: 153613717
Test: atest TetheringTests TetheringCoverageTests
Change-Id: If7c933ec0c72943312cd37bfc66918f10a5504a9

paulhu   commited 2020-04-22 16:15:33 +08:00
7e514020b5
Set attributionTag for noteOp(WRITE_SETTINGS) calls
Test: atest FrameworksNetTests TetheringTests:TetheringServiceTest
Bug: 136595429
Merged-In: I33f787644c44d7b0e5ce17a433820cfcd985cdfb
Change-Id: Ic3d937e7bb5141798234ed5b2852c1f768e97495

Philip P. Moltmann   commited 2020-04-20 18:00:03 -07:00
64343b0b8d
[TNU08] Remove the "tethering is on" notification
All carriers discarded the requirement to put up a standing
notification when tethering is on. Thus, remove the "tethering
is on" notification.

Bug: 154438388
Test: atest TetheringTests
Change-Id: Ife3915837b6b7b83d3eaaa84b71b6409ff37b71c

paulhu   commited 2020-04-20 16:10:08 +08:00
57f26333a8
[TNU06] Add roaming notification
Warn user of potential data charges if the backhaul is
cellular and user is roaming.

Bug: 145629001
Test: atest TetheringTests
Change-Id: I74b4f87c2f6aad09e05d3f2a779f880396885953

paulhu   commited 2020-04-17 21:25:54 +08:00
1f66261a3c
[TNU05.1] Address aosp/1237036 leftover comments
Bug: 147818698
Test: atest TetheringTests
Change-Id: Ife738339aeae00d2063fea6918b50204daef24fc

paulhu   commited 2020-04-16 14:39:12 +08:00
1317e27e91
[TNU05] Add no upstream notification
Reminder user of unavailable tethering status if there is no
internet access.

Bug: 147818698
Test: atest TetheringTests
Change-Id: Ic6557f9f7703337596100cd6a477fd7239217166

paulhu   commited 2020-04-15 01:25:37 +08:00
648fc2c8ea
Merge "Don't crash when receiving an RTM_DELNEIGH or NUD_FAILED."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-04-14 08:22:30 +00:00
941a53ce91
Don't crash when receiving an RTM_DELNEIGH or NUD_FAILED.
These events don't have MAC addresses, so the code attempts to
create an Ipv6ForwardingRule with a null MAC address. This
crashes when attempting to get the raw MAC address bytes to send
to netd in the TetherOffloadRuleParcel.

This was not caught by unit tests because the test exercise this
code path in a way that is not correct (by sending RTM_DELNEIGH
and NUD_FAILED events with MAC addresses). Fix the unit tests to
properly pass in null MAC addresses for these events.

Bug: 153697068
Test: fixed existing tests to be more realistic
Change-Id: I26d89a81f1c448d9b4809652b079a5f5eace3924

Lorenzo Colitti   commited 2020-04-14 15:02:17 +09:00
330a9b9fa7
Change tethering file structure to respect its package name
Bug: 145099347
Test: atest TetheringTests
      atest CtsTetheringTest
Change-Id: I7401c550fbafd17a5ed2d925b5d0e17e358af467

markchien   authored and   Mark Chien   commited 2020-04-14 02:09:51 +00:00
d995566700
Merge "Address aosp/1274403 leftover comment"
Paul Hu   authored and   Gerrit Code Review   commited 2020-04-08 07:36:35 +00:00
9f33a5a7d9
Address aosp/1274403 leftover comment
Bug: 152828142
Test: atest EntitlementManagerTest

Change-Id: I81f2d268c9f26bc4488b06032477a73d071f73f8

paulhu   commited 2020-04-08 11:45:08 +08:00
eaa2b0e30a
Merge "Add TetheringServiceTest unitest"
Mark Chien   authored and   Gerrit Code Review   commited 2020-04-07 15:39:38 +00:00
7e0920903b