Commit Graph

9588 Commits

Author SHA1 Message Date
Junyu Lai
b80fe74899 [SP26] add CTS for NetworkStats
Test: atest NetworkStatsApiTest
Test: atest CtsNetTestCasesLatestSdk:NetworkStatsApiTest on Q device
Bug: 150644692
Change-Id: I690704b43cfd16de70c4c83916f6d750cf613f67
Merged-In: I690704b43cfd16de70c4c83916f6d750cf613f67
(cherry picked from commit 5c670a2714f3ed783b6d5245714d0039c8fd1e9c)
2020-04-06 02:21:17 +00:00
junyulai
56f59c493b [SP26.2] add a method in NetworkStats that removes empty entries
In current design, entries with zeros are preserved after
addition/subtraction. These entries are not very useful
and lead to difficulty of verifying the result of
addition/subtraction.

However, change the behavior in the original NetworkStats
is considered risky in current stage.

Thus, this change provide a function that could remove these
empty entries in tests.

Test: atest FrameworksNetTests
Bug: 152827872
Bug: 150644692

Change-Id: I40a76935d55712b8083ee1e17e137a8a4ef5e029
Merged-In: I40a76935d55712b8083ee1e17e137a8a4ef5e029
(cherry picked from commit 6c7bef3064dbe949b7b213036b8e70c125ddd343)
2020-04-06 02:18:50 +00:00
Lorenzo Colitti
0d6e50a29d Refactor the Nat464Xlat function for simplicity.
This makes the code easier to understand by making state
transitions more explicit. It also makes it easier to address a
TODO to turn the class into a StateMachine.

This should be an exact no-op refactoring. The current cases
covered by the code (all mutually exclusive) are:

1. requiresClat && !isPrefixDiscoveryStarted
   Action: startPrefixDiscovery()
   Equivalent to IDLE && requiresClat, because
   isPrefixDiscoveryStarted returns true for every state except
   IDLE.

2. requiresClat && isPrefixDiscoveryStarted && shouldStartClat
   Action: start()
   Equivalent to DISCOVERING && shouldStartClat,
   because isPrefixDiscoveryStarted is true in DISCOVERING,
   STARTING, and RUNNING, but start() does nothing if mState is
   STARTING or RUNNING.

3. requiresClat && isPrefixDiscoveryStarted && !shouldStartClat
   Action: stop()
   Equivalent to (STARTING or RUNNING) && !shouldStartClat,
   because isPrefixDiscoveryStarted is true in DISCOVERING,
   STARTING, and RUNNING, but stop() does nothing if mState is
   not STARTING or RUNNING.

4. !requiresClat && isStarted
   Action: stop()
   Equivalent to (STARTING or RUNNING) && !requiresClat,
   because isStarted() is only true in STARTING and RUNNING.

5. !requiresClat && !isStarted && isPrefixDiscoveryStarted
   Action: leaveStartedState()
   Equivalent to DISCOVERING && !requiresClat, because
   the only state with isPrefixDiscoveryStarted and !isStarted
   is DISCOVERING.

Also, simplify case #5. In this case, calling leaveStartedState
is superfluous, because in the DISCOVERING state:
- There is no need to call unregisterObserver, since the observer
  is only registered when entering STARTING and is unregistered
  when going back to DISCOVERING or IDLE.
- mIface and mBaseIface don't need to be set to null because they
  are only set to non-null when entering STARTING and nulled out
  when going back to DISCOVERING or IDLE.

Bug: 126113090
Bug: 150648313
Test: covered by existing ConnectivityServiceTest and Nat464XlatTest
Change-Id: Ice536bcb269cc8b040c6e7a72c15d0bc8b5bd235
2020-04-04 16:24:58 +09:00
TreeHugger Robot
caa3a41ed6 [automerger skipped] Merge "Only apply VPN isolation if it's fully routed" into rvc-dev am: 147d1574b1 -s ours
am skip reason: Change-Id I59cf48552bca98092d1212e3d718fd420add5458 with SHA-1 ab8cf306ea is in history

Change-Id: I46103ffe30615b2949cf9d600c32785b3c28b816
2020-04-04 03:48:18 +00:00
TreeHugger Robot
147d1574b1 Merge "Only apply VPN isolation if it's fully routed" into rvc-dev 2020-04-04 03:44:46 +00:00
Remi NGUYEN VAN
24260d5e6d Fix setAdministratorUids tests on Q
setAdministratorUids does not exist on Q, so such tests must be skipped
on Q devices.

Bug: 147903575
Test: atest CtsNetTestCasesLatestSdk on Q and AOSP devices
Merged-In: I1b362660de9733bb9f0ede1ed5cf62279bf1c05e
Change-Id: I1b362660de9733bb9f0ede1ed5cf62279bf1c05e
2020-04-03 09:42:33 +00:00
Remi NGUYEN VAN
acddbef838 Merge "Fix setAdministratorUids tests on Q" am: 7e3fc61cf1 am: a59e208450
Change-Id: I77012e94e128ec0c88ac8c6c3b316c4b29a3784f
2020-04-03 08:42:26 +00:00
Remi NGUYEN VAN
91627585e3 Merge "Fix setAdministratorUids tests on Q" am: 7e3fc61cf1 am: a59e208450
Change-Id: Ifbcb485fad3a61c2cf48fb6e264bcdc130119ff0
2020-04-03 08:41:32 +00:00
Remi NGUYEN VAN
af77f3649c [automerger skipped] Merge "Make LinkPropertiesTest compatible with Q" into rvc-dev am: d8223ef5fc -s ours
am skip reason: Change-Id I38b0d83abf983b3bcc01fc6aea2e5cc307734198 with SHA-1 7988471ec9 is in history

Change-Id: I329d322e10096178ea82d213414c2866f596ff12
2020-04-03 08:17:11 +00:00
Remi NGUYEN VAN
a59e208450 Merge "Fix setAdministratorUids tests on Q" am: 7e3fc61cf1
Change-Id: I1f9a335e4f7b97d2af47745709d90cfdab353154
2020-04-03 08:17:00 +00:00
Remi NGUYEN VAN
7e3fc61cf1 Merge "Fix setAdministratorUids tests on Q" 2020-04-03 07:54:59 +00:00
Remi NGUYEN VAN
d8223ef5fc Merge "Make LinkPropertiesTest compatible with Q" into rvc-dev 2020-04-03 07:52:26 +00:00
Lorenzo Colitti
53e0564ca4 Merge "Added a new capability for temporarily unmetered network." into rvc-dev am: 0edabc5e4e
Change-Id: I4d43b28d25529d4dd9e4304c4edf95edb5c5110b
2020-04-03 05:07:20 +00:00
Jack Yu
71863e9604 Added a new capability for temporarily unmetered network.
Added a new network capability TEMOPORARILY_NOT_METERED to support
the case that a network can temporarily become unmetered. This
allows carriers to deploy unmetered 5G network. When devices
camp on 5G network, this capability will be dynamically added
to the network and will be removed once leaving 5G coverage.

Bug: 153081494
Test: Manual
Change-Id: I10e26cb0852e67f614e7b9c4e49f95e078602e21
2020-04-02 19:28:41 -07:00
Chalard Jean
380318053b Fix a stupid NPE
Okay so this is really not a behavior change as it converts an
NPE into an illegal argument exception, but still, that's what
should happen (and that's what the upcoming test actually tests
for).

Test: upcoming NetworkAgentTest
Bug: 139268426
Change-Id: I3e17211c03bc74426bf5e2e414ec322d73b0060b
2020-04-03 07:17:13 +09:00
Lorenzo Colitti
4fe4daa582 Merge "Rename the *Nat64Prefix to *Nat64PrefixFromDns." am: 426ce6ee78 am: 0d904a3b18
Change-Id: Iafcc7caea3ef4b87e2651da8dcbf972704022930
2020-04-02 15:25:30 +00:00
Lorenzo Colitti
5916708919 Merge "Rename the *Nat64Prefix to *Nat64PrefixFromDns." am: 426ce6ee78 am: 0d904a3b18
Change-Id: I9521b1a243f6907b790888c7a1e32991da05cf33
2020-04-02 15:24:59 +00:00
Lorenzo Colitti
0d904a3b18 Merge "Rename the *Nat64Prefix to *Nat64PrefixFromDns." am: 426ce6ee78
Change-Id: I542f805511fe770c7869b4ba989416c179d28687
2020-04-02 15:06:25 +00:00
Lorenzo Colitti
426ce6ee78 Merge "Rename the *Nat64Prefix to *Nat64PrefixFromDns." 2020-04-02 14:45:11 +00:00
Lorenzo Colitti
d523d1416d Rename the *Nat64Prefix to *Nat64PrefixFromDns.
This just a rename with no functional changes at all. It is
preparation for supporting getting the NAT64 prefix from the
RA.

Bug: 150648313
Test: covered by existing ConnectivityServiceTest and Nat464XlatTest
Change-Id: Ia9a09a708870827b1e4cf068f930fa9542dd116c
2020-04-02 22:48:03 +09:00
Lorenzo Colitti
7378b9cc59 [automerger skipped] Merge "Add more tests in LinkPropertiesTests.java" into rvc-dev am: 86ae134de8 -s ours
am skip reason: Change-Id Ie77dd7eb5c7ecc763c661e8510f9a308e695e77f with SHA-1 55c6a844fc is in history

Change-Id: Ie4b165c0543676d142fc9dd216e689e2aab18a35
2020-04-02 10:52:17 +00:00
Lorenzo Colitti
7fb7c3e0bf Only apply VPN isolation if it's fully routed
VPN is considered fully routed if both IPv4 and IPv6 have
either a default route or a prohibit route.

Bug: 145332510
Test: atest FrameworksNetTests
Merged-In: I59cf48552bca98092d1212e3d718fd420add5458
Change-Id: I59cf48552bca98092d1212e3d718fd420add5458
2020-04-02 10:36:19 +00:00
Lorenzo Colitti
86ae134de8 Merge "Add more tests in LinkPropertiesTests.java" into rvc-dev 2020-04-02 10:35:49 +00:00
Chalard Jean
44dfd2a6b7 Merge changes from topics "api-fix-networkagent", "satisfiedby" am: 9122e56202 am: 0d7aa85f99
Change-Id: I237ed648bf6f8533e6c8e79dc44a8240c0e32e7a
2020-04-02 06:38:02 +00:00
Chalard Jean
a9c11746b8 Address further API council comments. am: 691a34d96b am: 811833721f
Change-Id: I8c9fa0413e3c62180eae20951e559b69e53ea049
2020-04-02 06:37:56 +00:00
Chalard Jean
5f6ebed9d7 [automerger skipped] Merge changes from topics "api-fix-networkagent", "satisfiedby" am: 9122e56202 am: 0d7aa85f99 -s ours
am skip reason: Change-Id I076876a6662bde143ef7d315ce3767acafff93c1 with SHA-1 51b8e287ad is in history

Change-Id: Ia71fd58217ec6dab128dc83781fb7e42e412472e
2020-04-02 06:37:24 +00:00
Chalard Jean
6460bd74fa [automerger skipped] Address further API council comments. am: 691a34d96b am: 811833721f -s ours
am skip reason: Change-Id I8a785ae0e74e659c317deaaa28c203356c7766ed with SHA-1 812e8cb87e is in history

Change-Id: I0a0cae7327fd84f078e1027840a86b1db090d9c3
2020-04-02 06:37:15 +00:00
Chalard Jean
0d7aa85f99 Merge changes from topics "api-fix-networkagent", "satisfiedby" am: 9122e56202
Change-Id: I1149e5d0c93885d401817d65af02b6ae47f51dfc
2020-04-02 06:15:02 +00:00
Chalard Jean
811833721f Address further API council comments. am: 691a34d96b
Change-Id: I237fc6a82df362d5463e8e518967de28735bf2da
2020-04-02 06:14:55 +00:00
Chalard Jean
9122e56202 Merge changes from topics "api-fix-networkagent", "satisfiedby"
* changes:
  Rename satisfiedBy into canBeSatisfiedBy
  Address further API council comments.
2020-04-02 05:51:02 +00:00
Remi NGUYEN VAN
824f80b129 Fix setAdministratorUids tests on Q
setAdministratorUids does not exist on Q, so such tests must be skipped
on Q devices.

Bug: 147903575
Test: atest CtsNetTestCasesLatestSdk on Q and AOSP devices
Change-Id: I1b362660de9733bb9f0ede1ed5cf62279bf1c05e
2020-04-02 13:58:03 +09:00
Lorenzo Colitti
af13955e1a Merge "Only apply VPN isolation if it's fully routed" am: 5c5d1a1282 am: d24e7fb5a1
Change-Id: I76fd2c58d688ea45f9b30e9efd24235bea2eadf9
2020-04-02 04:51:36 +00:00
Lorenzo Colitti
62d2333abd Merge "Only apply VPN isolation if it's fully routed" am: 5c5d1a1282 am: d24e7fb5a1
Change-Id: I9230f1a73698344eb40ae3e0ebc5d73cc259f2d0
2020-04-02 04:50:41 +00:00
Lorenzo Colitti
d24e7fb5a1 Merge "Only apply VPN isolation if it's fully routed" am: 5c5d1a1282
Change-Id: I5267b567e1b9babe3bc95d2984262dc864681a2d
2020-04-02 04:32:04 +00:00
Lorenzo Colitti
5c5d1a1282 Merge "Only apply VPN isolation if it's fully routed" 2020-04-02 04:10:12 +00:00
Aaron Huang
ccd5ba288a Make LinkPropertiesTest compatible with Q
CompareResult had been moved from LinkProperties to LinkPropertiesUtils
so this change ignores testCompareResult() on Q and only check
compareAllRoutes() works while android version is at least R.

Bug: 151782584
Test: atest CtsNetTestCasesLatestSdk:LinkPropertiesTest
Merged-In: I38b0d83abf983b3bcc01fc6aea2e5cc307734198
Change-Id: I38b0d83abf983b3bcc01fc6aea2e5cc307734198
2020-04-02 03:30:49 +00:00
Junyu Lai
cf73cd2f67 Merge changes from topic "sp26-networkstats-cts" am: e71d3cf971 am: 8ea70c1969
Change-Id: Icd22765bf76b3b37935928169722afed65469105
2020-04-02 02:41:02 +00:00
junyulai
f66f5151db [SP26.2] add a method in NetworkStats that removes empty entries am: 1052557f33 am: 378271190c
Change-Id: I99eef67c05afb7d6432d5dbf32494d2f5b56b1a5
2020-04-02 02:41:00 +00:00
Junyu Lai
dc7732f258 Merge changes from topic "sp26-networkstats-cts" am: e71d3cf971 am: 8ea70c1969
Change-Id: I0964b1752acbba767135c960aba12f169b3f852c
2020-04-02 02:40:53 +00:00
junyulai
ca8fafc0f9 [SP26.2] add a method in NetworkStats that removes empty entries am: 1052557f33 am: 378271190c
Change-Id: I388b1d3677d362da2595739913880efa9a643a03
2020-04-02 02:40:42 +00:00
Junyu Lai
8ea70c1969 Merge changes from topic "sp26-networkstats-cts" am: e71d3cf971
Change-Id: I124f0def6fdaad8f1726df23edc87b6aa7856586
2020-04-02 02:21:26 +00:00
junyulai
378271190c [SP26.2] add a method in NetworkStats that removes empty entries am: 1052557f33
Change-Id: Ieee0896672625f3bab9ec02a5efa495a9d1f001b
2020-04-02 02:21:20 +00:00
Junyu Lai
e71d3cf971 Merge changes from topic "sp26-networkstats-cts"
* changes:
  [SP26] add CTS for NetworkStats
  [SP26.2] add a method in NetworkStats that removes empty entries
2020-04-02 02:00:59 +00:00
Chalard Jean
c62f9a53d8 Rename satisfiedBy into canBeSatisfiedBy
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I076876a6662bde143ef7d315ce3767acafff93c1
Merged-In: I076876a6662bde143ef7d315ce3767acafff93c1
2020-04-01 20:38:30 +08:00
Chiachang Wang
de56acb0a0 [automerger skipped] Merge "Update constructor of NetworkMonitor" into rvc-dev am: d7df0c13d9 -s ours
am skip reason: Change-Id I3a636f0ea5145ac4435e06a9827bb8e01862542d with SHA-1 0ab5158418 is in history

Change-Id: I728c5080b92ffa7c8c2524f2430252af1faee963
2020-04-01 09:11:18 +00:00
junyulai
1052557f33 [SP26.2] add a method in NetworkStats that removes empty entries
In current design, entries with zeros are preserved after
addition/subtraction. These entries are not very useful
and lead to difficulty of verifying the result of
addition/subtraction.

However, change the behavior in the original NetworkStats
is considered risky in current stage.

Thus, this change provide a function that could remove these
empty entries in tests.

Test: atest FrameworksNetTests
Bug: 152827872
Bug: 150644692
Change-Id: I40a76935d55712b8083ee1e17e137a8a4ef5e029
2020-04-01 16:46:08 +08:00
junyulai
e47c7e42e5 [SP26] add CTS for NetworkStats
Test: atest NetworkStatsApiTest
Test: atest CtsNetTestCasesLatestSdk:NetworkStatsApiTest on Q device
Bug: 150644692
Change-Id: I690704b43cfd16de70c4c83916f6d750cf613f67
2020-04-01 16:46:08 +08:00
Rubin Xu
ab8cf306ea Only apply VPN isolation if it's fully routed
VPN is considered fully routed if both IPv4 and IPv6 have
either a default route or a prohibit route.

Bug: 145332510
Test: atest FrameworksNetTests
Change-Id: I59cf48552bca98092d1212e3d718fd420add5458
2020-04-01 09:36:29 +01:00
Chalard Jean
691a34d96b Address further API council comments.
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Copy from ag/10866511
Change-Id: I8a785ae0e74e659c317deaaa28c203356c7766ed
Merged-In: I8a785ae0e74e659c317deaaa28c203356c7766ed
2020-04-01 16:01:04 +08:00
Lucas Lin
6602482f26 Add MatchAllNetworkSpecifierTest
Bug: 139268426
Bug: 135998869
Test: atest CtsNetTestCasesLatestSdk:MatchAllNetworkSpecifierTest

Change-Id: I6c6911041aff1b245e576109a879247cc256093b
Merged-In: Ib593708d5621ff20e6a0c31e5698b2b658f64d45
(cherry picked from commit f46c71b420f4089e0f36a296ed5b59398794f538)
2020-04-01 06:27:43 +00:00