Commit Graph

9212 Commits

Author SHA1 Message Date
Lucas Lin
ea34cf06d5 Merge "Add more tests in NetworkCapabilitiesTest.java" am: 60ee9b5a9f am: d9a6a6b8b6
Change-Id: If955360da1fb75e174a4ecfff46988f65db17c8a
2020-04-07 07:14:28 +00:00
Lucas Lin
d9a6a6b8b6 Merge "Add more tests in NetworkCapabilitiesTest.java" am: 60ee9b5a9f
Change-Id: Ie50a0e4e332dd16c7300efb488f4ac4f25c3b6c9
2020-04-07 06:59:14 +00:00
Lucas Lin
60ee9b5a9f Merge "Add more tests in NetworkCapabilitiesTest.java" 2020-04-07 06:45:09 +00:00
Treehugger Robot
2e99fd04fe Merge "Fix a stupid NPE" am: 30673a9684 am: fb3e94c8d8
Change-Id: I68e5702008a82d93c634fd45c2bd83a33fdf0cd2
2020-04-07 06:18:28 +00:00
Treehugger Robot
fb3e94c8d8 Merge "Fix a stupid NPE" am: 30673a9684
Change-Id: I3a167339e4007e5cb16488e701b9ca16937da265
2020-04-07 06:02:50 +00:00
Treehugger Robot
30673a9684 Merge "Fix a stupid NPE" 2020-04-07 05:53:10 +00:00
lucaslin
e408eb55dc Add more tests in NetworkCapabilitiesTest.java
Test deduceRestrictedCapability(), getAdministratorUids(),
setAdministratorUids(), getNetworkSpecifier(), getOwnerUid(),
setLinkDownstreamBandwidthKbps(), setLinkUpstreamBandwidthKbps()
and setSignalStrength().

Bug: 139268426
Bug: 135998869
Bug: 138306002
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkCapabilitiesTest
Change-Id: I90c7a8c47710ea4ad8e8d2682c10440fd7f82270
2020-04-07 11:58:22 +08:00
Lorenzo Colitti
deaf9677f4 [automerger skipped] Merge "Refactor the Nat464Xlat function for simplicity." into rvc-dev am: 672da12990 -s ours
am skip reason: Change-Id Ice536bcb269cc8b040c6e7a72c15d0bc8b5bd235 with SHA-1 3f18aa996d is in history

Change-Id: I27d77c0e0cc88c015cfe1012d4b83a1159b1b05b
2020-04-07 02:15:47 +00:00
Lorenzo Colitti
672da12990 Merge "Refactor the Nat464Xlat function for simplicity." into rvc-dev 2020-04-07 02:13:33 +00:00
Maciej Zenczykowski
c6aef05296 [automerger skipped] Merge "Rename the *Nat64Prefix to *Nat64PrefixFromDns." into rvc-dev am: e7d685f488 -s ours
am skip reason: Change-Id Ia9a09a708870827b1e4cf068f930fa9542dd116c with SHA-1 fff75393c5 is in history

Change-Id: I4646da7aaeb7844ef2c0dc9e3a15b15607f095ea
2020-04-06 23:59:33 +00:00
Lorenzo Colitti
5ce7a7e6e0 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
Merged-In: Ice536bcb269cc8b040c6e7a72c15d0bc8b5bd235
Change-Id: Ice536bcb269cc8b040c6e7a72c15d0bc8b5bd235
2020-04-06 15:46:38 +00:00
Lorenzo Colitti
b5a18f3d93 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
Merged-In: Ia9a09a708870827b1e4cf068f930fa9542dd116c
Change-Id: Ia9a09a708870827b1e4cf068f930fa9542dd116c
2020-04-06 15:45:14 +00:00
Chalard Jean
4e3606f45d Fix a bug where the legacy extra info is reset on connect. am: 910aad052e
Change-Id: I0e21281a7cccbcd095ac6e6e26111ecc9ce5ab35
2020-04-06 12:49:13 +00:00
Lorenzo Colitti
f421fdb487 Merge "Refactor the Nat464Xlat function for simplicity." am: 6bc322fc77 am: 818b26f88b
Change-Id: I8cb3fb435baae54f5e811cae1efb603d585a28e9
2020-04-06 11:24:19 +00:00
Chalard Jean
910aad052e Fix a bug where the legacy extra info is reset on connect.
Bug: 149459996
Test: NetworkAgentTest FrameworksNetTests FrameworksWifiTests FrameworksTelephonyTests

Change-Id: I3e437f0fe2eb28f1d621551a8daf164a06af83fc
Merged-In: I3e437f0fe2eb28f1d621551a8daf164a06af83fc
(cherry picked from commit a3fdb94a32eda40e322b7dbdaf3fad9b42bfbbb9, originally aosp/1277602)
2020-04-06 11:14:59 +00:00
Lorenzo Colitti
818b26f88b Merge "Refactor the Nat464Xlat function for simplicity." am: 6bc322fc77
Change-Id: I4947abc132dcd0c83b44f2c23362049ee1073214
2020-04-06 11:01:50 +00:00
Lorenzo Colitti
6bc322fc77 Merge "Refactor the Nat464Xlat function for simplicity." 2020-04-06 10:38:54 +00:00
Lucas Lin
87c36e6de3 [automerger skipped] Merge "Add MatchAllNetworkSpecifierTest" into rvc-dev am: 956c2ab718 -s ours
am skip reason: Change-Id Ib593708d5621ff20e6a0c31e5698b2b658f64d45 with SHA-1 c32a0619c2 is in history

Change-Id: Ib67921fdf3384f3c79d8b859ed068578575cdaa9
2020-04-06 09:46:19 +00:00
Lucas Lin
956c2ab718 Merge "Add MatchAllNetworkSpecifierTest" into rvc-dev 2020-04-06 09:35:27 +00:00
Chalard Jean
4acb8ab295 Merge "Fix a bug where the legacy extra info is reset on connect." am: c0863db980 am: 7eebe72420
Change-Id: I127bf621caa39a24265f30cd4c781248410e5348
2020-04-06 06:34:09 +00:00
Chalard Jean
7eebe72420 Merge "Fix a bug where the legacy extra info is reset on connect." am: c0863db980
Change-Id: Ia0a2afe359cac6adfd33d2f839eddb8bd14b5f43
2020-04-06 06:17:46 +00:00
Chalard Jean
c0863db980 Merge "Fix a bug where the legacy extra info is reset on connect." 2020-04-06 06:04:46 +00:00
Junyu Lai
f710d6affa [automerger skipped] Merge changes from topic "am-5ce58db354ac494a84904378ca35c013-rvc-dev" into rvc-dev am: b0ebae0f51 -s ours
am skip reason: Change-Id I690704b43cfd16de70c4c83916f6d750cf613f67 with SHA-1 169246fd17 is in history

Change-Id: I1a97a8cb46302c29425781b9252640c1eec4b50b
2020-04-06 04:27:56 +00:00
Junyu Lai
b0ebae0f51 Merge changes from topic "am-5ce58db354ac494a84904378ca35c013-rvc-dev" into rvc-dev
* changes:
  [SP26] add CTS for NetworkStats
  [SP26.2] add a method in NetworkStats that removes empty entries
2020-04-06 04:15:39 +00:00
Chalard Jean
8e43611e05 Fix a bug where the legacy extra info is reset on connect.
Bug: 149459996
Test: NetworkAgentTest FrameworksNetTests FrameworksWifiTests FrameworksTelephonyTests
Change-Id: I5f8f6d962ee3317e101d19518c767b3c327c0c47
2020-04-06 12:46:19 +09:00
Remi NGUYEN VAN
19eb896dbc [automerger skipped] Merge "Fix setAdministratorUids tests on Q" into rvc-dev am: 6a1d55826c -s ours
am skip reason: Change-Id I1b362660de9733bb9f0ede1ed5cf62279bf1c05e with SHA-1 17ab7ac36a is in history

Change-Id: I16bc94e46e253b70ed58f4bbd5d14c1214024f30
2020-04-06 02:24:59 +00:00
Remi NGUYEN VAN
6a1d55826c Merge "Fix setAdministratorUids tests on Q" into rvc-dev 2020-04-06 02:22:37 +00:00
Junyu Lai
b0be675f0d [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
6d926c23ea [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
3f18aa996d 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
25c09f1dbe [automerger skipped] Merge "Only apply VPN isolation if it's fully routed" into rvc-dev am: 5e2617781a -s ours
am skip reason: Change-Id I59cf48552bca98092d1212e3d718fd420add5458 with SHA-1 fa429013a0 is in history

Change-Id: I46103ffe30615b2949cf9d600c32785b3c28b816
2020-04-04 03:48:18 +00:00
TreeHugger Robot
5e2617781a Merge "Only apply VPN isolation if it's fully routed" into rvc-dev 2020-04-04 03:44:46 +00:00
Remi NGUYEN VAN
ad9693ca57 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
59e5a2de32 Merge "Fix setAdministratorUids tests on Q" am: 2497897867 am: 9972a5ac3b
Change-Id: Ifbcb485fad3a61c2cf48fb6e264bcdc130119ff0
2020-04-03 08:41:32 +00:00
Remi NGUYEN VAN
e5a3bc01e2 [automerger skipped] Merge "Make LinkPropertiesTest compatible with Q" into rvc-dev am: 75cdb045dc -s ours
am skip reason: Change-Id I38b0d83abf983b3bcc01fc6aea2e5cc307734198 with SHA-1 cbba5a82ea is in history

Change-Id: I329d322e10096178ea82d213414c2866f596ff12
2020-04-03 08:17:11 +00:00
Remi NGUYEN VAN
9972a5ac3b Merge "Fix setAdministratorUids tests on Q" am: 2497897867
Change-Id: I1f9a335e4f7b97d2af47745709d90cfdab353154
2020-04-03 08:17:00 +00:00
Remi NGUYEN VAN
2497897867 Merge "Fix setAdministratorUids tests on Q" 2020-04-03 07:54:59 +00:00
Remi NGUYEN VAN
75cdb045dc Merge "Make LinkPropertiesTest compatible with Q" into rvc-dev 2020-04-03 07:52:26 +00:00
Lorenzo Colitti
eb1f326acc 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
2bd176d185 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
c7e1877d1c 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
61097ffeea Merge "Rename the *Nat64Prefix to *Nat64PrefixFromDns." am: 01314aedbf am: bcb70090e9
Change-Id: I9521b1a243f6907b790888c7a1e32991da05cf33
2020-04-02 15:24:59 +00:00
Lorenzo Colitti
bcb70090e9 Merge "Rename the *Nat64Prefix to *Nat64PrefixFromDns." am: 01314aedbf
Change-Id: I542f805511fe770c7869b4ba989416c179d28687
2020-04-02 15:06:25 +00:00
Lorenzo Colitti
01314aedbf Merge "Rename the *Nat64Prefix to *Nat64PrefixFromDns." 2020-04-02 14:45:11 +00:00
Lorenzo Colitti
fff75393c5 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
8304f102d2 [automerger skipped] Merge "Add more tests in LinkPropertiesTests.java" into rvc-dev am: 5f67a3c20f -s ours
am skip reason: Change-Id Ie77dd7eb5c7ecc763c661e8510f9a308e695e77f with SHA-1 72fde564a4 is in history

Change-Id: Ie4b165c0543676d142fc9dd216e689e2aab18a35
2020-04-02 10:52:17 +00:00
Lorenzo Colitti
332e75ab1b 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
5f67a3c20f Merge "Add more tests in LinkPropertiesTests.java" into rvc-dev 2020-04-02 10:35:49 +00:00
Chalard Jean
111f49bbfd [automerger skipped] Merge changes from topics "api-fix-networkagent", "satisfiedby" am: 2e64ca57b8 am: 330f7a7265 -s ours
am skip reason: Change-Id I076876a6662bde143ef7d315ce3767acafff93c1 with SHA-1 e693268f50 is in history

Change-Id: Ia71fd58217ec6dab128dc83781fb7e42e412472e
2020-04-02 06:37:24 +00:00
Chalard Jean
ee7c2d6681 [automerger skipped] Address further API council comments. am: ef902503aa am: 978f42af59 -s ours
am skip reason: Change-Id I8a785ae0e74e659c317deaaa28c203356c7766ed with SHA-1 c882f64b3c is in history

Change-Id: I0a0cae7327fd84f078e1027840a86b1db090d9c3
2020-04-02 06:37:15 +00:00