Commit graph android_packages_modules_Co.../tests/net/java/com/android/server
Message SHA1
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
7bc33dfb89
Stop prefix discovery if an RA prefix arrives in DISCOVERING
Currently, if a prefix is learned from an RA while prefix
discovery is running, clatd will be correctly started, but
prefix discovery will be stopped.

In order to fix this, make it possible to call
stopPrefixDiscovery without transitioning to IDLE state (which
is obviously necessary in this case), by moving the assignment of
the next state from that method to its callers. For consistency,
do the same for startPrefixDiscovery.

Bug: 150648313
Test: new test coverage
Change-Id: I3803fa3d9806848b331c35ee8bac256934bd1f21

Lorenzo Colitti   commited 2020-04-20 17:54:20 +09:00
38c6519a90
Make the Nat464Xlat tests more realistic.
464xlat will never be started on a network that is not connected,
or on a network that has no IPv6 address.

This is a no-op test-only change but it is necessary for an
upcoming change that violates some of the invalid assumptions
currently made by this test and causes it to fail.

Bug: 150648313
Test: test-only change
Change-Id: I41766e9adaa7c24454648b371e6e3cc647693be5

Lorenzo Colitti   commited 2020-04-20 17:54:20 +09:00
c6bd5847c9
Support learning the NAT64 prefix from two different sources.
The NAT64 prefix from the RA always takes precedence over the
NAT64 prefix from DNS discovery, because it is detected faster,
and detecting it does not require sending any packets.

Bug: 150648313
Test: new unit test
Change-Id: Ic7452431d2d9aea1ae59b67a9d8383c6cc5b3902

Lorenzo Colitti   commited 2020-04-20 16:50:53 +09:00
e2eade021a
Merge "Add testTransportTypesEqual to dnsmanager test cases"
Bruce Chen   authored and   Gerrit Code Review   commited 2020-04-17 02:59:15 +00:00
0e97073a4d
Merge "[SP27.3] Rename TestableNetworkStatsProvider"
Junyu Lai   authored and   Gerrit Code Review   commited 2020-04-17 02:24:55 +00:00
9151f7c748
Merge "Support changing the NAT64 prefix without removing it."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-04-16 16:24:57 +00:00
f09bc1734f
Add testTransportTypesEqual to dnsmanager test cases
A test that ensures that NetworkCapabilities.TRANSPORT_* is eaual
to IDnsResolver.TRANSPORT_* for every possible value of each.

Bug: 153267602
Test: atest FrameworksNetTests
Change-Id: I6b23ccc6ce1659fdfd9573dfcd895f2c20fa9417

chenbruce   commited 2020-04-16 18:04:16 +08:00
01950be123
Support changing the NAT64 prefix without removing it.
This cannot (currently) happen with DNS64 detection, but it can
happen with the PREF64 option.

Bug: 150648313
Test: atest ConnectivityServiceTest Nat464XlatTest --rerun-until-failure 100
Change-Id: I789fe9d46d3ac5d074ae697d23013f24a9e0246d

Lorenzo Colitti   commited 2020-04-16 00:07:30 +09:00
7f3d684631
[SP27.3] Rename TestableNetworkStatsProvider
Currently, TestableNetworkStatsProvider is a subclass of
INetworkStatsProvider. This is not very accurate naming after
API council review feedback since now we have
NetworkStatsProvider as a system api interface.

This is the counter-part change of actual renaming CL in
NetworkStack.

Test: atest FrameworksNetTests TetheringTests
Bug: 150643374
Change-Id: Ifa8175dc4e2fe2b907ec13b3bd2eca12974f5ea7
Merged-In: Ifa8175dc4e2fe2b907ec13b3bd2eca12974f5ea7
(cherry-picked from ag/10976522)

junyulai   commited 2020-04-15 19:01:13 +08:00
d8d7916d95
Merge "Set transport types to resolver"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-04-13 07:03:20 +00:00
d275ec139a
Set transport types to resolver
For a given network, resolver doesn't know what transport types are.
Therefore, when a new network is created or transport types are changed
in a give network, transport types will be updated and sent by calling
setResolverConfiguration(). In the same time, if link properties or
transport types are null, setResolverConfiguration() won't be called.
The original behaviors of setResolverConfiguration() aren't changed.
Only increasing one new behavior that when a given network has transport
type change, calling setResolverConfiguration() directly and resolver
updates the transport types for that given network.

Bug: 143732914
Test: atest FrameworksNetTests
      atest FrameworksNetIntegrationTests
Merged-In: I03fc5c62dfd9a51a78a720860531df282fdecc20
Change-Id: I6527cde0e177ba08c886576131b35fc769c2bb53

chenbruce   commited 2020-04-11 23:00:13 +08:00
7b2f898a9a
Add gating, logging for PhoneStateListener's limit
Add gating via PlatformCompat and DeviceConfig and logging via
PlatformCompat to the limit instituted on per-process listeners

Fixes: 152074216
Test: atest CtsTelephonyHostCases
Change-Id: I4d6681d90705b68c3349f4124e434a29b50fd3a2
Merged-In: I4d6681d90705b68c3349f4124e434a29b50fd3a2

Hall Liu   commited 2020-04-07 17:13:19 -07:00
a85ea98c7a
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

Lorenzo Colitti   commited 2020-04-02 22:48:03 +09:00
d523d1416d
Merge changes from topics "api-fix-networkagent", "satisfiedby"
* changes:
  Rename satisfiedBy into canBeSatisfiedBy
  Address further API council comments.

Chalard Jean   authored and   Gerrit Code Review   commited 2020-04-02 05:51:02 +00:00
9122e56202
Merge "Only apply VPN isolation if it's fully routed"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-04-02 04:10:12 +00:00
5c5d1a1282
Rename satisfiedBy into canBeSatisfiedBy
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I076876a6662bde143ef7d315ce3767acafff93c1
Merged-In: I076876a6662bde143ef7d315ce3767acafff93c1

Chalard Jean   authored and   Aaron Huang   commited 2020-04-01 20:38:30 +08:00
c62f9a53d8
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

Rubin Xu   commited 2020-04-01 09:36:29 +01:00
ab8cf306ea
Merge "Use IBinder as key for ConnectivityDiagnostics storage in CS."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-31 17:00:03 +00:00
852715df47
Merge "Invoke onConnectivityReport on registering ConnectivityDiagnostics."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-31 00:06:26 +00:00
a365c81bfa
Use IBinder as key for ConnectivityDiagnostics storage in CS.
This change updates ConnectivityService to use IBinder instances as keys
when storing ConnectivityDiagnosticsCallbacks.

When storing ConnectivityDiagnosticsCallbacks in ConnectivityService,
the IConnectivityDiagnsoticsCallback is used as the key for
ConnectivityService.mConnectivityDiagnosticsCallbacks. However,
IConnectivityDiagnosticsCallback instances are received as different
objects. This causes them to produce different hashCode() values, so
attempts to remove an IConnectivityDiagnosticsCallback fail.

Bug: 150867635
Test: atest FrameworksNetTests
Change-Id: Ib99e68d5ae47fa27e12428f9a60a2c1204ac59a2

Cody Kesting   commited 2020-03-30 11:10:46 -07:00
31f1ff693b
Invoke onConnectivityReport on registering ConnectivityDiagnostics.
This change updates the behavior for registering
ConnectivityDiagnosticsCallbacks. Now, after a successful register()
call, callbacks will receive cached ConnectivityReports for all
matching, permissioned networks. This allows registrants to be updated
with the network state for their networks without having to wait for the
next network validation.

Bug: 147849853
Test: atest FrameworksNetTests
Change-Id: I924ba8fdcc847f453557021591bde38602fe089c

Cody Kesting   commited 2020-03-30 11:10:46 -07:00
b77bf707c6
Merge "Automatically set IPsec tunnel interface as up"
Benedict Wong   authored and   Gerrit Code Review   commited 2020-03-25 04:18:50 +00:00
bc74233e8a
Merge changes from topic "netstack_constant_cherrypick"
* changes:
  Remove usage of Context.NETWORK_STACK_SERVICE
  Remove NETWORK_STACK_SERVICE constant

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2020-03-23 03:33:58 +00:00
10adc9a7b9
Remove usage of Context.NETWORK_STACK_SERVICE
The NetworkStack.getService() API should be used instead.

Bug: 151243982
Test: atest FrameworksNetTests TetheringTests
      Manual tethering test
Merged-In: I7855090bffbe895c8349ad4903b8f2eb55515f0b
(clean cherry-pick from internal branch)

Change-Id: If4af2846a82605e828287a9a4680d5547b76b802

Remi NGUYEN VAN   commited 2020-03-23 11:29:06 +09:00
fbb0836bc6
Merge "Change NetworkCapabilties administrator UIDs to be stored as int[]."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-19 18:09:26 +00:00
1a78f835eb
[SM07] Make combine subtype configurable from Settings
Note that enabling/disabling would not take effect until device
reboot. This will be addressed in follow-up patch.

Test: 1. atest NetworkStatsServieTest SettingsBackupTest
      2. adb shell settings put global netstats_combine_subtype_enabled 1|0
Bug: 146415925

Change-Id: Ic94da540afa479ed18f1b6fbda4ae3216c37476b
Merged-In: Ic94da540afa479ed18f1b6fbda4ae3216c37476b
(cherry picked from commit c4f77ac90bf2e48a655ad19b162fe74a23bf3fb0 and
 fix merge conflict in SettingsBackupTest)

junyulai   commited 2020-03-19 10:10:07 +08:00
678befa63c
[SM05] Enable record mobile network stats by collapsed rat type
Switch on the recording in device side. Metrics will be
collected in follow-up patches which can be independently
enabled/disabled.

This change also fix the fail in NetworkStatsCollectionTest
which caused by enabling this feature, where the rounding
problem happened when records are distributed into smaller
buckets and categorized into more NetworkIdentity.

Test: atest FrameworksNetTests
Bug: 129082217
Change-Id: If330e85330a4ff713dd420c98d42fa741eabd90a
Merged-In: If330e85330a4ff713dd420c98d42fa741eabd90a
(cherry picked from commit 2d4fa2c0fae8c2d79a25093d9f732a33c2f91dd4)

junyulai   commited 2020-03-19 10:10:07 +08:00
2632681cf0
Merge "Kill ConnectivityManager.CONNECTIVITY_ACTION_SUPL"
Paul Hu   authored and   Gerrit Code Review   commited 2020-03-19 01:10:55 +00:00
57b993bfb5
Change NetworkCapabilties administrator UIDs to be stored as int[].
NetworkCapabilities#mAdministratorUids is used to track the UIDs that
are administrators of the given Network. This value was previously
stored as List<Integer>. However, general Android API Council guidelines
recommend using Arrays for primitive values. In order to be consistent
with the guidelines, updating the field to use an Array.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: I2652a5b0f276b8944454af5cb4b1383a3e054cfa
Merged-In: I2652a5b0f276b8944454af5cb4b1383a3e054cfa

Cody Kesting   commited 2020-03-18 15:18:47 -07:00
5ab1f55d1f
Merge "Restrict VPN Diagnostics callbacks to underlying networks."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-18 20:07:52 +00:00
4074c2d181
Fix flaky ConnectivityServiceTest#testNetworkFactoryUnregister
Test: atest ConnectivityServiceTest#testNetworkFactoryUnregister \
      --geneate-new-metrics 100
Bug: 151792032
Change-Id: Iece9e8ad5c51170cd404ac995d0005392d37fe0c

junyulai   commited 2020-03-18 15:22:54 +08:00
80bf34b2af
Merge "mtu: Add MTU parameter to Routes"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-03-18 07:20:01 +00:00
9839a4311a
Merge "[SP25] Rename functions that add Entry conditionally"
Junyu Lai   authored and   Gerrit Code Review   commited 2020-03-18 03:16:41 +00:00
52ee59fb03
[SP25] Rename functions that add Entry conditionally
Currently, in NetworkStats, there are many methods to manipulate
the records. However, some methods are similar and ambiguous,
such as addEntry, addValues, setValues, addIfaceValues,
combineValues and combineAllValues.

Thus, properly grouping and renaming methods are necessary.
In this change, for methods that add one record conditionally,
name them addEntry.
  addValues -> addEntry

Test: atest FrameworksNetTests ImsPhoneCallTrackerTest TetheringTests
Fix: 148895143
Change-Id: I9495a198cf247e6c79100f7ac1edcea370b071de
Merged-In: I9495a198cf247e6c79100f7ac1edcea370b071de
(cherry picked from ag/10700816)

junyulai   authored and   Junyu Lai   commited 2020-03-18 00:29:15 +00:00
a896436ef2
Merge "Update ConnectivityDiagnosticsCallback function name."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-17 19:00:39 +00:00
5596ba1619
Update ConnectivityDiagnosticsCallback function name.
API Council feedback suggests renaming ConnectivityDiagnosticsCallback
'onConnectivityReport' function to be 'onConnectivityReportAvailable'.

Bug: 150598997
Test: atest FrameworksNetTests
Change-Id: Ieea727ecee6cf358a53a215fd4b06233dfe967ea
Merged-In: Ieea727ecee6cf358a53a215fd4b06233dfe967ea

Cody Kesting   commited 2020-03-17 17:10:38 +00:00
fa1ef5eb1b
Merge "Ensure that NetworkFactory objects cannot be reused."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-03-17 04:35:01 +00:00
07c7c2aa67
Merge "Clean up unit testing for ConnectivityDiagnostics."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-16 19:33:33 +00:00
3fef3af249
Restrict VPN Diagnostics callbacks to underlying networks.
ConnectivityDiagnosticsCallbacks should only be invoked for the
underlying networks declared by active VPNs. This encourages VPN apps to
declare their underlying networks.

The previous permission model for VPNs allowed active VPNs to receive
callbacks on any network.

Bug: 148903617
Test: atest FrameworksNetTests
Change-Id: Ic08cdd2e2532580fda0fd3034e2bdff27e0ff84b

Cody Kesting   commited 2020-03-16 11:05:13 -07:00
d759ac61ee
Ensure that NetworkFactory objects cannot be reused.
NetworkFactory is turning into a one-time object that cannot be
re-used. Check for this in ConnectivityService.

Bug: 148635501
Test: test continues to pass
Change-Id: I793436ee0f4b5d778788ad34b8a2575d2ad0ed80
Merged-In: I793436ee0f4b5d778788ad34b8a2575d2ad0ed80

Lorenzo Colitti   commited 2020-03-17 01:39:23 +09:00
2c74e66034
Merge "Protect ConnectivityService from SecurityException in permission check."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-16 14:33:25 +00:00
ed459f5f1a
[SP24] Rename functions that add Entry unconditionally
Currently, in NetworkStats, there are many methods to manipulate
the records. However, some methods are similar and ambiguous,
such as addEntry, addValues, setValues, addIfaceValues,
combineValues and combineAllValues.

Thus, properly grouping and renaming methods are necessary.
In this change, for methods that add one record unconditionally,
name them insertEntry.
  setIfaceValues -> insertEntry
  addEntry -> insertEntry

Test: atest FrameworksNetTests ImsPhoneCallTrackerTest TetheringTests
Test: m doc-comment-check-docs
Bug: 148895143
Change-Id: I801ddc49e283a254b9586700c9b597c0adb0d459

junyulai   commited 2020-03-16 14:27:45 +08:00
cc38304ad8
Merge "[SP21] Address comments for API council review about aosp/1172143"
Junyu Lai   authored and   Gerrit Code Review   commited 2020-03-16 02:41:19 +00:00
24ab7411ba
Merge "Resolve ambiguous argument."
Chalard Jean   authored and   Gerrit Code Review   commited 2020-03-14 03:38:01 +00:00
16cad96e9f
Resolve ambiguous argument.
CTS tests don't have access to TestNetworkAgent and therefore
require overloading this method, which means 'null' is ambiguous.

Bug: 139268426
Test: FrameworksNetTests
Change-Id: I9279718bde30bd98eff901921fb3411d22da72e5

Chalard Jean   commited 2020-03-13 21:17:33 +09:00
a7cc6d8eee
Merge "Remove redundant connected notification"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-03-13 07:10:13 +00:00
62b8d6f24d
[SP21] Address comments for API council review about aosp/1172143
Test: atest FrameworksNetTests ImsPhoneCallTrackerTest
Test: atest TetheringTests NetworkStackTests
Test: m doc-comment-check-docs
Fix: 148552904

Change-Id: I141393f229e772d2eb9f7c156849e379bd71b845

junyulai   commited 2020-03-12 21:34:17 +08:00
0c88795cb5
Kill ConnectivityManager.CONNECTIVITY_ACTION_SUPL
CONNECTIVITY_ACTION_SUPL is marked as a "temporary hack" and has
never been public. Remove this intent definition since no one is
receiving this intent and should use network callback to know the
connection change.

Bug: 109636544
Test: atest FrameworksNetTests
Change-Id: Ie9e5127742beba04f1c191e894e8a29fe1e704bb

paulhu   commited 2020-03-11 22:14:11 +08:00
27ca44913a
Clean up unit testing for ConnectivityDiagnostics.
Connectivity Diagnostics included an unnecessary try-catch for verifying
that the permissions check for invoking ConnectivityDiagnosticsCallbacks
doesn't throw when the uid and package name do not match.

Bug: 149119324
Test: atest FrameworksNetTests
Change-Id: Ie302b1f4f437e819fdd15ec28adb0b56750c2c53

Cody Kesting   commited 2020-03-10 23:27:01 -07:00
807ce6621b