Commit Graph

739 Commits

Author SHA1 Message Date
Mark Chien
250a10eec4 Merge "Address the comment of aosp/1288493" am: 974d6f5978 am: b51ef98b86
Change-Id: Idfe4cbf12cbcc233c1061b26e962dcf21cd36de0
2020-05-08 11:00:42 +00:00
markchien
f5078f489d 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
2020-05-08 18:55:26 +08:00
markchien
147e5765ee Address the comment of aosp/1288493
Bug: 141256482
Test: atest TetheringTests
Change-Id: I0cf337625cee31a47879c59e9b18657ea7624eb4
2020-05-08 15:51:52 +08:00
Mark Chien
92afd387fd Refactor the EntitlementManager
1. Change ArraySet usage to BitSet
2. Change mCellularUpstreamPermitted to mLastCellularUpstreamPermitted.

Before this change:
a member variable(mCellularUpstreamPermitted) is
used to check whether cellular upstream is permitted, the code must
ensure to update this variable once entitlement result is changed or the
entitlement check is triggered but does not have a result yet.

In this change:
Instead of storing the information about whether cellular is permitted in
a member variable. The information is recalculated every time when user
call isCellularUpstreamPermitted(). Now isCellularUpstreamPermitted() is
always be used to check whether cellular upstream is permitted no matter
inside or outside EntitlementManager.
This make the code be easier to maintain that we do not need to care
when mCellularUpstreamPermitted need to be updated because the
information would be recalculated every time. And the recalculation is
lock free because this is only used inside tethering while running in
the same thread.

Bug: 141256482
Test: atest TetheringTests

Merged-In: Ic83f42ff4eec38adf039d55d80fcb9b0f16373cc
Change-Id: Ic83f42ff4eec38adf039d55d80fcb9b0f16373cc
2020-05-07 14:46:09 +00:00
Mark Chien
0245317764 Merge "Refactor the EntitlementManager" am: 581afa0bfa am: 407c3afa4a
Change-Id: Ib409b85729972e23242551beb39638aaefad0584
2020-05-07 11:26:35 +00:00
Mark Chien
581afa0bfa Merge "Refactor the EntitlementManager" 2020-05-07 11:14:40 +00:00
Mark Chien
c96fbe0abe Test tethering log dump
Bug: 145490751
Test: atest TetheringTests
Merged-In: I01fc6969041711f7a15880144ee5eac591086ecd
Change-Id: I01fc6969041711f7a15880144ee5eac591086ecd
2020-05-07 06:44:43 +00:00
Mark Chien
80aa028b9c Merge "Test tethering log dump" am: 0e3371469e am: 3369043fca
Change-Id: I20e8808afefaf0d5964871db976e288191a75ad7
2020-05-07 03:49:42 +00:00
markchien
146f6055bd Test tethering log dump
Bug: 145490751
Test: atest TetheringTests
Change-Id: I01fc6969041711f7a15880144ee5eac591086ecd
2020-05-06 17:00:37 +08:00
Junyu Lai
e1a04c04d7 [SP18.6] Make offload controller poll interval configurable
Test: atest TetheringTests
Bug: 149467454

Change-Id: I0b07a0b520dedb479bf863fbfe898ae85b84b0f3
Merged-In: I0b07a0b520dedb479bf863fbfe898ae85b84b0f3
(cherry picked from commit 8371fa281839d5b1a1027936f2f83e59bf5301a3)
2020-05-05 10:50:35 +00:00
junyulai
2a5f21425a [SP18.5] Create offload controller poll interval to resource
Test: atest TetheringConfigurationTest
Bug: 149467454
Change-Id: I8b4ad920a4945504914d3741a9fba5c096fbf452
Merged-In: I8b4ad920a4945504914d3741a9fba5c096fbf452
(cherry-picked from aosp/1299413)
2020-05-05 18:45:53 +08:00
junyulai
14722baf0d [SP18.4] Add unit test for polling network stats in OffloadController
Test: atest OffloadControllerTest
Bug: 149467454
Change-Id: I9b9c9c096a2366aaf383d5c2d567db6682f02dad
Merged-In: I9b9c9c096a2366aaf383d5c2d567db6682f02dad
(cherry-picked from aosp/1295347)
2020-05-05 18:45:42 +08:00
Junyu Lai
941fc9ecab Merge "[SP18.6] Make offload controller poll interval configurable" am: 10c8c21777 am: 6848610485
Change-Id: Iab4a5f883a8357c23375633c16059b38d74b9e9b
2020-05-05 10:45:38 +00:00
Hungming Chen
3d8fa889b4 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
2020-05-05 17:43:50 +08:00
Hungming Chen
8bf2e7e05b 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
2020-05-05 17:37:32 +08:00
Junyu Lai
f8cd65936d Merge changes from topic "sp18-TestableNetworkStatsProviderCbBinder" am: 80ab95927b am: c44a1ba581
Change-Id: Iceb250d8ba0d31a39538dd59e687ea2d80f4aaba
2020-05-05 03:50:52 +00:00
junyulai
5475504266 [SP18.6] Make offload controller poll interval configurable
Test: atest TetheringTests
Bug: 149467454

Change-Id: I0b07a0b520dedb479bf863fbfe898ae85b84b0f3
2020-05-05 11:45:36 +08:00
junyulai
9606a22037 [SP18.5] Create offload controller poll interval to resource
Test: atest TetheringConfigurationTest
Bug: 149467454
Change-Id: I8b4ad920a4945504914d3741a9fba5c096fbf452
2020-05-04 14:56:37 +08:00
junyulai
9c50628e95 [SP18.4] Add unit test for polling network stats in OffloadController
Test: atest OffloadControllerTest
Bug: 149467454
Change-Id: I9b9c9c096a2366aaf383d5c2d567db6682f02dad
2020-05-04 14:56:37 +08:00
Junyu Lai
027c80d2d6 Merge changes I38628dad,I2467b647 into rvc-dev
* changes:
  [SP18.1] add dependency object to OffloadController
  [SP18] Poll network stats in OffloadController to support data warning
2020-04-30 06:07:25 +00:00
markchien
33d861e6a7 Refactor the EntitlementManager
1. Change ArraySet usage to BitSet
2. Change mCellularUpstreamPermitted to mLastCellularUpstreamPermitted.

Before this change:
a member variable(mCellularUpstreamPermitted) is
used to check whether cellular upstream is permitted, the code must
ensure to update this variable once entitlement result is changed or the
entitlement check is triggered but does not have a result yet.

In this change:
Instead of storing the information about whether cellular is permitted in
a member variable. The information is recalculated every time when user
call isCellularUpstreamPermitted(). Now isCellularUpstreamPermitted() is
always be used to check whether cellular upstream is permitted no matter
inside or outside EntitlementManager.
This make the code be easier to maintain that we do not need to care
when mCellularUpstreamPermitted need to be updated because the
information would be recalculated every time. And the recalculation is
lock free because this is only used inside tethering while running in
the same thread.

Bug: 141256482
Test: atest TetheringTests

Change-Id: Ic83f42ff4eec38adf039d55d80fcb9b0f16373cc
2020-04-30 14:00:20 +08:00
Treehugger Robot
40092b1fa7 [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
Merged-In: I38628daddcb7be7c74846e78d36dc88f065b97d9
(cherry picked from commit 29aee20bfa)
2020-04-30 05:03:07 +00:00
Junyu Lai
bf6fa99b2a [SP18] Poll network stats in OffloadController to support data warning
The OEM implemented tether offload does not support
data warning since the HAL only tells the hardware about data limit
but not warning. However, to add such interface in HAL needs OEM to
comply and implement in hardware.

Thus, as a short-term solution, polls network statistics from HAL
and notify upper layer when it reaches the alert quota set by
NetworkStatsService.

Note that when CPU is sleeping, the data warning of tethering offload
will not work since the polling is also suspended.

Test: manual
Test: atest OffloadControllerTest
Bug: 149467454
Change-Id: I2467b64779b74cd5fec73b42fb303584f52cb1cb
Merged-In: I2467b64779b74cd5fec73b42fb303584f52cb1cb
(cherry picked from commit 93660e382c)
2020-04-30 04:58:21 +00:00
Treehugger Robot
912b722290 Merge "[SP18.1] add dependency object to OffloadController" am: c75f373448 am: 30af8e6201
Change-Id: Ic1586dee9e62a3a1484feec91cc66883a12bb90b
2020-04-29 12:45:13 +00:00
Treehugger Robot
c75f373448 Merge "[SP18.1] add dependency object to OffloadController" 2020-04-29 12:08:22 +00:00
Junyu Lai
a10b3a3a89 Merge "[SP18] Poll network stats in OffloadController to support data warning" am: d25d88199f am: 73cfbe504e
Change-Id: Ifcdeaaba790ddf9adecd3afb06911c63f1a17ac1
2020-04-29 11:40:26 +00:00
Junyu Lai
d25d88199f Merge "[SP18] Poll network stats in OffloadController to support data warning" 2020-04-29 11:01:56 +00:00
junyulai
360c88f238 [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
2020-04-28 18:27:57 +08:00
junyulai
607fa9efea [SP18] Poll network stats in OffloadController to support data warning
The OEM implemented tether offload does not support
data warning since the HAL only tells the hardware about data limit
but not warning. However, to add such interface in HAL needs OEM to
comply and implement in hardware.

Thus, as a short-term solution, polls network statistics from HAL
and notify upper layer when it reaches the alert quota set by
NetworkStatsService.

Note that when CPU is sleeping, the data warning of tethering offload
will not work since the polling is also suspended.

Test: manual
Test: atest OffloadControllerTest
Bug: 149467454
Change-Id: I2467b64779b74cd5fec73b42fb303584f52cb1cb
2020-04-28 18:27:57 +08:00
Remi NGUYEN VAN
a530ebb62d 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
Merged-In: Id9b71784e5f6294d203230e57737979e063ff0f8
Change-Id: Id9b71784e5f6294d203230e57737979e063ff0f8
2020-04-28 08:09:17 +00:00
Mark Chien
ed50636b60 Remove Preconditions usage to stop dependecy with non-updatble class
Stop depending on Preconditions that is not released on the same cadence
as the module, and is maintained as part of the framework.

Bug: 148636687
Test: atest TetheringTests NetworkStackNextTests

Merged-In: Id0dcec44f362f79bc8c046d722635687a7388aa2
Change-Id: Id0dcec44f362f79bc8c046d722635687a7388aa2
2020-04-27 12:38:07 +00:00
Mark Chien
db6cf82c14 Merge "Remove Preconditions usage to stop dependecy with non-updatble class" am: 821089e106 am: cdee1cfe24
Change-Id: I856a936b295426bb2ba219eb4e510f6a2a3ac12b
2020-04-27 11:17:28 +00:00
Mark Chien
821089e106 Merge "Remove Preconditions usage to stop dependecy with non-updatble class" 2020-04-27 10:54:19 +00:00
Mark Chien
27cdaf679a Unbreak tethering for no offload supported devices
Catch NoSuchElementException to unbreak no offload devices.

To consistent with fetching offload config service, retry fetcheing
offload control service.
b/152430668#comment4 assert that the fetch will be retried only
if the service is installed on the device.

Bug: 155026033
Test: run TetheringCoverageTests in virtual devices(do not support
offload)

Merged-In: Ie0a32a9062c722327a27c6de13e3bb8d9588bebb
Change-Id: Ie0a32a9062c722327a27c6de13e3bb8d9588bebb
2020-04-27 09:15:25 +00:00
Mark Chien
a35751fb3e Merge "Unbreak tethering for no offload supported devices" am: cb22e06783 am: 98c0b261f8
Change-Id: I857cf7c9542f2c0f595c3afdbd4db032c0a96392
2020-04-27 09:12:37 +00:00
Mark Chien
cb22e06783 Merge "Unbreak tethering for no offload supported devices" 2020-04-27 08:42:36 +00:00
markchien
6b3afbe447 Unbreak tethering for no offload supported devices
Catch NoSuchElementException to unbreak no offload devices.

To consistent with fetching offload config service, retry fetcheing
offload control service.
b/152430668#comment4 assert that the fetch will be retried only
if the service is installed on the device.

Bug: 155026033
Test: run TetheringCoverageTests in virtual devices(do not support
offload)

Change-Id: Ie0a32a9062c722327a27c6de13e3bb8d9588bebb
2020-04-27 14:47:56 +08:00
Remi NGUYEN VAN
6be926b580 Merge "Address comments on NetworkStack AIDL v6" am: 9b687b94a4 am: fb8a431cc5
Change-Id: Id385210ccd8d08bc2d15e964bbca25c452a3cde8
2020-04-24 12:19:37 +00:00
Remi NGUYEN VAN
9b687b94a4 Merge "Address comments on NetworkStack AIDL v6" 2020-04-24 11:56:32 +00:00
Remi NGUYEN VAN
aba3d2ebeb 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
2020-04-24 18:52:02 +09:00
markchien
b9c19778f4 Remove Preconditions usage to stop dependecy with non-updatble class
Stop depending on Preconditions that is not released on the same cadence
as the module, and is maintained as part of the framework.

Bug: 148636687
Test: atest TetheringTests NetworkStackNextTests

Change-Id: Id0dcec44f362f79bc8c046d722635687a7388aa2
2020-04-24 00:47:56 +08:00
Paul Hu
0439c2d204 [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
Merged-In: Ib980aca154036828abdab35e3bb11d42f85ff610
(cherry picked from commit 2eb66bdbe4, aosp/1290334)
2020-04-23 10:18:11 +00:00
Paul Hu
be2d888a81 Merge "[TNU09] Adjust restricted notification" am: 3db6cae8d4 am: 19575361f2
Change-Id: I4488ed76a4c9859d6d947953d132e63c0366810e
2020-04-23 08:28:53 +00:00
Paul Hu
3db6cae8d4 Merge "[TNU09] Adjust restricted notification" 2020-04-23 07:50:34 +00:00
paulhu
03142a0568 [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
2020-04-23 00:17:28 +08:00
Philip P. Moltmann
8d5c1d7efb Merge "Set attributionTag for noteOp(WRITE_SETTINGS) calls" am: 83ba9531d7 am: 319db1af8b
Change-Id: I099944752fc3006c1e98750dd46dbebf5e50789f
2020-04-22 15:19:14 +00:00
Philip P. Moltmann
83ba9531d7 Merge "Set attributionTag for noteOp(WRITE_SETTINGS) calls" 2020-04-22 14:58:13 +00:00
Paul Hu
a529ce8bd7 Merge "[TNU08] Remove the "tethering is on" notification" into rvc-dev 2020-04-22 09:56:32 +00:00
Paul Hu
127ee5920f [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
Merged-In: Ife3915837b6b7b83d3eaaa84b71b6409ff37b71c
(cherry picked from commit 0171c07d05dd2625c6dcfd47977a701ddc2d5d36, aosp/1289107)
2020-04-22 07:00:16 +00:00
Treehugger Robot
83a814eb31 Retry the call that fetches the tethering offload HAL.
The CL that moved the initialization of the tethering offload
config HAL from C++ to Java caused the code not to retry
fetching the service if it is not ready when tethering is
started. This is because the C++ version of getService() retries,
but the Java version only retries if getService(true) is called.

Make the new code retry as well.

b/152430668#comment4 asserts that the fetch will be retried only
if the service is installed on the device, so the retries should
be attempted (and thus should not have any startup time impact)
on devices that do not support tethering offload.

Bug: 152430668
Test: builds, boots, tethering offload works
Merged-In: I093f127d90b2aa1b13eb0748378a24726d419472
Change-Id: I093f127d90b2aa1b13eb0748378a24726d419472
2020-04-22 06:59:12 +00:00