Commit Graph

532 Commits

Author SHA1 Message Date
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
30af8e6201 Merge "[SP18.1] add dependency object to OffloadController" am: c75f373448
Change-Id: I02c648e4ec802e738d311f5996cb3cd053f58478
2020-04-29 12:25:36 +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
73cfbe504e Merge "[SP18] Poll network stats in OffloadController to support data warning" am: d25d88199f
Change-Id: I16e45c86f4f7c5654dd0061c6fdb3fbf66986124
2020-04-29 11:19:40 +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
9258a08525 Merge "Remove Preconditions usage to stop dependecy with non-updatble class" into rvc-dev 2020-04-28 03:09:25 +00:00
TreeHugger Robot
885d4eaf1f Merge "Import translations. DO NOT MERGE" into rvc-dev 2020-04-27 14:24:33 +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
cdee1cfe24 Merge "Remove Preconditions usage to stop dependecy with non-updatble class" am: 821089e106
Change-Id: Ib101caf06704f74d7721c44ed4f51d396bc0a4e8
2020-04-27 11:02:19 +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
98c0b261f8 Merge "Unbreak tethering for no offload supported devices" am: cb22e06783
Change-Id: I1bfe9cbe836694e929e9aef43ad22eeceae28f77
2020-04-27 08:57:12 +00:00
Mark Chien
cb22e06783 Merge "Unbreak tethering for no offload supported devices" 2020-04-27 08:42:36 +00:00
Bill Yi
8a35765b6f Import translations. DO NOT MERGE
Auto-generated-cl: translation import
Change-Id: I08496ebb9bad7c95a6e9df43ef57c55a9956c9d8
2020-04-27 00:04:34 -07: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
Jooyung Han
6478508103 Merge "Add min_sdk_version:R to updatable apexes" am: c280c85504
Change-Id: I0c63ce2b2146e31d2165bbaa0d5761950dfc0db7
2020-04-25 04:53:35 +00:00
Jooyung Han
c280c85504 Merge "Add min_sdk_version:R to updatable apexes" 2020-04-25 04:41:44 +00: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
fb8a431cc5 Merge "Address comments on NetworkStack AIDL v6" am: 9b687b94a4
Change-Id: I755d14877a65b359c0837cab1488875d7238440e
2020-04-24 12:04:38 +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
19575361f2 Merge "[TNU09] Adjust restricted notification" am: 3db6cae8d4
Change-Id: I6f89d5569f7f07317d7c55f81d3d7b55b4779819
2020-04-23 08:11:24 +00:00
Paul Hu
3db6cae8d4 Merge "[TNU09] Adjust restricted notification" 2020-04-23 07:50:34 +00:00
Paul Hu
86152672a6 Add TetheredClient tests
Test APIs below:
getAddresses()
getMacAddress()
getTetheringType()
AddressInfo.getAddress()
AddressInfo.getHostname()
AddressInfo.writeToParcel(android.os.Parcel, int)

Bug: 153614365
Bug: 153613717
Test: atest TetheringTests
Change-Id: Ic7cbebe54a38af5b5c4639eb7641a20de6864a26
Merged-In: Ic7cbebe54a38af5b5c4639eb7641a20de6864a26
(cherry picked from commit fa882fdb96, aosp/1292438)
2020-04-23 01:10:19 +00:00
Paul Hu
1277763ddd Merge "Add TetheringCommonTests" into rvc-dev 2020-04-23 01:06:13 +00:00
Bill Yi
7d04cce017 Merge "Import translations. DO NOT MERGE" 2020-04-22 23:05:49 +00:00
Bill Yi
70521ef0e8 Import translations. DO NOT MERGE
Change-Id: I4b3a8cf8d738bf6f680258f1ebd77d894dc986cd
Auto-generated-cl: translation import
2020-04-22 15:24:12 -07:00
Bill Yi
2b48e19418 Import translations. DO NOT MERGE
Change-Id: I44c343149dc88a88c94327cdd6d5ac26ce7a6816
Auto-generated-cl: translation import
2020-04-22 12:03:48 -07: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
Paul Hu
099acab36e Merge "Add TetheredClient tests" am: dd481a1dee am: eff436b223
Change-Id: I094a4f8dcf7b5b1392065166c01113ce0fb97b9d
2020-04-22 16:07:42 +00:00
Paul Hu
eff436b223 Merge "Add TetheredClient tests" am: dd481a1dee
Change-Id: I773efff81aad8324be730c56034da30003ba4974
2020-04-22 15:44:17 +00:00
Paul Hu
1cae88f560 Add TetheringCommonTests
Bug: 153614365
Bug: 153613717
Test: atest TetheringTests TetheringCoverageTests
Change-Id: If7c933ec0c72943312cd37bfc66918f10a5504a9
Merged-In: If7c933ec0c72943312cd37bfc66918f10a5504a9
(cherry picked from commit f340f6fd46, aosp/1290553)
2020-04-22 15:24:13 +00:00
Paul Hu
dd481a1dee Merge "Add TetheredClient tests" 2020-04-22 15:22:32 +00: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
319db1af8b Merge "Set attributionTag for noteOp(WRITE_SETTINGS) calls" am: 83ba9531d7
Change-Id: I3ddd8954cf8443f549f7965cc43f2600bf92a80b
2020-04-22 15:09:28 +00:00
Philip P. Moltmann
83ba9531d7 Merge "Set attributionTag for noteOp(WRITE_SETTINGS) calls" 2020-04-22 14:58:13 +00:00
Mark Chien
70e43fb856 Merge "Include NetworkStaticLibTestsLib into tethering coverage test" into rvc-dev 2020-04-22 13:54:33 +00:00
Paul Hu
0d6c6444e8 Merge "Add TetheringCommonTests" am: 7219f9a5dd am: 075cf4d923
Change-Id: I0d10c0c02375b10cbd2cd30e2fbe473580118b6c
2020-04-22 13:17:57 +00:00