Commit graph android_packages_modules_Co.../tests/unit/java/com/android
Message SHA1
Merge "Verify that the underlying network info will be cleared/sent or not"
Lucas Lin   authored and   Gerrit Code Review   commited 2022-12-08 05:30:47 +00:00
dc824e95de
Merge "Correct the test design for network lost case"
Lucas Lin   authored and   Gerrit Code Review   commited 2022-12-08 03:25:05 +00:00
678113ade7
Verify that the underlying network info will be cleared/sent or not
Add some checks to verify that the underlying network info will
only be cleared when the underlying network is lost, or will only
be sent when the category is not CATEGORY_EVENT_DEACTIVATED_BY_USER
and CATEGORY_EVENT_ALWAYS_ON_STATE_CHANGED.

Bug: 237050331
Test: atest FrameworksNetTests:VpnTest
Change-Id: Ifc66658cf59481c4a9804e6933be1048f758b698

lucaslin   authored and   Lucas Lin   commited 2022-12-07 09:47:38 +00:00
d1938dffce
Correct the test design for network lost case
For network lost case, the process should be triggered by calling
onLost() instead of triggering onClosedWithException() directly.

Bug: 237050331
Test: atest FrameworksNetTests:VpnTest
Change-Id: I32781d4ac96ee8212d1fd7ba23009293f72b442e

lucaslin   commited 2022-12-07 09:42:22 +00:00
0b915e2012
Merge "Add onServiceNameDiscovered/onServiceNameRemoved"
Paul Hu   authored and   Gerrit Code Review   commited 2022-12-07 02:00:33 +00:00
3b1703007e
Add onServiceNameDiscovered/onServiceNameRemoved
Add onServiceNameDiscovered method which is used to listen the
discovery callbacks. It would be called once the service is found
even the response is incomplete. This is different from
onServiceFound which needs to receive a complete response.

onServiceNameRemoved is used for service removal if received
response is incomplete.

Bug: 254166302
Test: atest FramworksNetTests
Change-Id: I03313b045d74bb65f7fe6ac93673f02ce3b2c664

Paul Hu   commited 2022-12-06 10:29:26 +00:00
0ee75422c9
Merge "Relocate NetworkManagementServiceTest to framework"
Thiébaud Weksteen   authored and   Gerrit Code Review   commited 2022-12-06 05:57:00 +00:00
b865214380
Relocate NetworkManagementServiceTest to framework
Bug: 259341026
Test: TH
Change-Id: Ie06d906fa8bc65d6af3511280bc01b2859edde79

Thiébaud Weksteen   commited 2022-12-05 14:48:44 +11:00
11490a1474
Fix empty value problem in the TextEntry
Now, the value in TextEntry would be a zero length byte array if
the text record response doesn't contain the value. The problem
is that the value could either be an empty string ("key="), or
there can be no value ("key"), as per rfc6763 6.4 "If there is
no '=' in a DNS-SD TXT record string, then it is a boolean
attribute, simply identified as being present, with no value.".

Bug: 254166302
Test: atest FramworksNetTests
Change-Id: I4eaa5e593ce9ddaa6b6cb2f069c1aef977910796

Paul Hu   commited 2022-12-05 02:18:34 +00:00
536cc4d102
Merge "Revert consider TEMPORARILY_NOT_METERED as unmetered in data usage"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-12-02 11:27:27 +00:00
841b1f33d5
Revert consider TEMPORARILY_NOT_METERED as unmetered in data usage
Currently, NET_CAPABILITY_TEMPORARILY_NOT_METERED traffic is
counted as unmetered data usage, and "mobile data usage"
settings screen shows metered data usage which means it doesn't
include TEMPORARILY_NOT_METERED traffic. However, some carriers
show TEMPORARILY_NOT_METERED data usage in customer's bill which
would be confusing if the data usage in the device shows different
results. Thus, revert the change to avoid confusing.

Bug: 183776809
Test: FrameworksNetTests
Change-Id: I4ef25095462adf30b1ecf82134996739f167930d

Aaron Huang   commited 2022-12-02 16:04:55 +08:00
c5a05d1d8f
Merge "Send MdnsServiceInfo on onServiceRemoved callback"
Paul Hu   authored and   Gerrit Code Review   commited 2022-12-02 01:33:40 +00:00
79e239eacb
Send MdnsServiceInfo on onServiceRemoved callback
Send MdnsServiceInfo on onServiceRemoved callback which include
service name, service type and other info instead of service name
only. These extra info is necessary for service lost callback on
NsdService on the following changes.

Bug: 254166302
Test: atest FrameworksNetTests
Change-Id: Ibacbef4b893209bbc2a37376bf26d713ce41429c

Paul Hu   commited 2022-11-29 11:51:16 +08:00
039d8111e0
Merge changes from topic "PermissionMonitorOnHandlerThread"
* changes:
  Add synchronized to UidRange getter and dump methods
  Deal with permission update on handler thread
  Running PermissionMonitor#startMonitoring on handler thread

Paul Hu   authored and   Gerrit Code Review   commited 2022-11-23 02:59:17 +00:00
562cdacfee
Deal with permission update on handler thread
To ensure that permission cannot change while CS is doing works,
scoring networks, sending callbacks, etc. So making all
permission update are running on handler thread.

Bug: 232048835
Test: FrameworksNetTests CtsNetTestCases
Change-Id: I5380ec8ff1282a1056d9063848e0fff8b3a570ec

Paul Hu   commited 2022-11-22 07:18:36 +00:00
51f816be4a
Merge "Wait for launcher is shown after calling pressHome"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-11-22 07:06:16 +00:00
a814e9c364
Wait for launcher is shown after calling pressHome
In current code, the test will call pressHome before show
network notification but it does not verify the home screen
is shown. The test might be failed due to the notification
shade is still opened. Thus adding an assertion to verify
the launcher is shown.

Bug: 255643296
Test: FrameworksNetTest:NetworkNotificationManagerTest
Change-Id: Iee3476a26030b9ba72994dee624e0e6974c9369f

Aaron Huang   commited 2022-11-21 10:47:58 +00:00
2c07b827e7
Merge "Refactor CarrierPrivilegeAuthenticatorTest"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-11-18 12:05:53 +00:00
adb9c9e83a
Merge "Add MdnsNsecRecord"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-11-17 08:00:15 +00:00
0f92b69af7
Merge changes I0f8e6590,I61a1bb91
* changes:
  Add MdnsAnyRecord
  Add constructors to MDNS records

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-11-16 09:12:57 +00:00
b683dfcea5
Add MdnsNsecRecord
NSEC records are included as mDNS negative responses, as per
RFC6762 6.1.

Bug: 241738458
Test: atest
Change-Id: I1546a2c10447ad46321f595b714c7ee7f6dc34c7

Remi NGUYEN VAN   commited 2022-11-16 15:57:30 +09:00
3ce3a4a9ca
Merge "Verify bypassability in the VPN network capabilities"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-11-16 05:57:00 +00:00
b7577c6d42
Merge "ethernet: consolidate interface enabling functions in EthernetTracker"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-11-16 05:51:42 +00:00
b6f2a3e587
Add MdnsAnyRecord
The record is useful for mDNS questions in mDNS probes.

Bug: 241738458
Test: atest
Change-Id: I0f8e659048b6e1d7c3ae1640fbd2d57d723ea9b1

Remi NGUYEN VAN   commited 2022-11-16 14:40:47 +09:00
e8d3e6d58c
Refactor CarrierPrivilegeAuthenticatorTest
Refactor this test to make it easier to test the no-op
refactoring coming as a follow-up

Test: this
Change-Id: I47c81bdec2b8f9575835ba664b61721d5f2c69ff

Chalard Jean   commited 2022-11-15 19:27:56 +09:00
23890c29c5
Verify bypassability in the VPN network capabilities
Bug: 256775913
Test: atest FrameworksNetTests
Change-Id: I6600714e5fc7c5d78fa7b8bb29c0c8840ec69637

chiachangwang   authored and   Chiachang Wang   commited 2022-11-15 05:36:24 +00:00
d0a2805616
Merge "Remove unnecessary permission mock for registerSystemDefaultNetwork"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-11-15 02:23:39 +00:00
c1294c2584
Merge "[Feature sync] Resolve class-level nullness suppression"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-11-10 13:53:31 +00:00
0448f36d60
Merge "Revert "Partially enforce permission when calling getNetworkInfoForUid""
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-11-10 12:13:56 +00:00
016269fbb8
Revert "Partially enforce permission when calling getNetworkInfoForUid"
This reverts commit 163cb98751.

Reason for revert: b/257407201

Change-Id: I412140117d25f4a4b439fff5aaa50785f33b0689

Junyu Lai   authored and   Gerrit Code Review   commited 2022-11-10 03:19:06 +00:00
d0cf7784dc
[Feature sync] Resolve class-level nullness suppression
This is a chery-picked commit from internal branch which is to
add nullability to reslove the nullness suppression.

Bug: 242631897
Bug: 254155029
Test: atest FrameworksNetTests
Change-Id: I289b0408c0c4ccdefc498d3b6d3f381c2b04132e

Paul Hu   commited 2022-11-10 01:57:46 +00:00
6c74a13512
Merge "[Feature sync] Fix issue where multiple SRV records with same host are not fully resolved"
Paul Hu   authored and   Gerrit Code Review   commited 2022-11-09 06:38:22 +00:00
b800e5903b
Merge "Allow USE_RESTRICTED_NETWORKS for registerSystemDefaultNetworkCallback"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-11-09 05:49:54 +00:00
31ee1c1121
Merge "Notify NetworkStatsService if TEMPORARILY_NOT_METERED changed"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-11-08 11:55:53 +00:00
4bf6a92a0a
Notify NetworkStatsService if TEMPORARILY_NOT_METERED changed
Currently 5G usage includes both metered and unmetered usage.
To support 5G unmetered usage metrics, unmetered usage should
be separated from the 5G usage. Thus, ConnectivityService needs
to inform NetworkStatsService if TEMPORARILY_NOT_METERED has
changed. Then NSS will count temporarily not metered usage as
unmetered.

Bug: 222339311
Bug: 183776809
Test: FrameworksNetTests:ConnectivityServiceTest
Change-Id: I0c7e1eb98925184f36e322e09b4d3d8c6f056fa6

Aaron Huang   commited 2022-11-08 16:01:54 +08:00
c067c87672
Merge "Make onPackage[Added|Removed] as non-public methods"
Paul Hu   authored and   Gerrit Code Review   commited 2022-11-07 01:35:11 +00:00
bd92295269
Merge "Update tests for new isValidationRequired args"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-11-04 11:14:41 +00:00
94ec30203b
Update tests for new isValidationRequired args
Bug: 253989196
Test: atest NetworkMonitorTest

Change-Id: I70633d748cc09a7f695cdc2b4c835d5bf187ec3d

Remi NGUYEN VAN   commited 2022-11-04 17:09:50 +09:00
21093ce089
Merge "Fix errorprone warnings that should be errors"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-11-02 19:38:39 +00:00
edceea23f4
Fix errorprone warnings that should be errors
This commit is part of a large scale change to fix errorprone
errors that have been downgraded to warnings in the android
source tree, so that they can be promoted to errors again.
The full list of changes include the following, but not all
will be present in any one individual commit:

BadAnnotationImplementation
BadShiftAmount
BanJNDI
BoxedPrimitiveEquality
ComparableType
ComplexBooleanConstant
CollectionToArraySafeParameter
ConditionalExpressionNumericPromotion
DangerousLiteralNull
DoubleBraceInitialization
DurationFrom
DurationTemporalUnit
EmptyTopLevelDeclaration
EqualsNull
EqualsReference
FormatString
FromTemporalAccessor
GetClassOnAnnotation
GetClassOnClass
HashtableContains
IdentityBinaryExpression
IdentityHashMapBoxing
InstantTemporalUnit
InvalidTimeZoneID
InvalidZoneId
IsInstanceIncompatibleType
JUnitParameterMethodNotFound
LockOnBoxedPrimitive
MathRoundIntLong
MislabeledAndroidString
MisusedDayOfYear
MissingSuperCall
MisusedWeekYear
ModifyingCollectionWithItself
NoCanIgnoreReturnValueOnClasses
NonRuntimeAnnotation
NullableOnContainingClass
NullTernary
OverridesJavaxInjectableMethod
ParcelableCreator
PeriodFrom
PreconditionsInvalidPlaceholder
ProtoBuilderReturnValueIgnored
ProtoFieldNullComparison
RandomModInteger
RectIntersectReturnValueIgnored
ReturnValueIgnored
SelfAssignment
SelfComparison
SelfEquals
SizeGreaterThanOrEqualsZero
StringBuilderInitWithChar
TreeToString
TryFailThrowable
UnnecessaryCheckNotNull
UnusedCollectionModifiedInPlace
XorPower

See https://errorprone.info/bugpatterns for more
information on the checks.

Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I7625fa386afe93823b97cb2ecb8fd09a5856c05b

Cole Faust   commited 2022-11-02 10:13:14 -07:00
22f05839f5
Remove unnecessary permission mock for registerSystemDefaultNetwork
registerSystemDefaultNetwork now can be accessed via
CONNECTIVITY_USE_RESTRICTED_NETWORKS, there is no need
to mock NETWORK_SETTINGS prior to test.

Test: atest com.android.server.ConnectivityServiceTest
Change-Id: I408094959286f3782496ce7f356f84a6a47c0902

Junyu Lai   commited 2022-11-02 14:17:33 +08:00
f2edd6477d
Allow USE_RESTRICTED_NETWORKS for registerSystemDefaultNetworkCallback
Some callers (e.g. iwlan) need to learn about system default
network but they cannot have NETWORK_SETTINGS permission.
To allow them to use this API but prevent from misuse by
unprivileged apps, enforce USE_RESTRICTED_NETWORKS for this API.

Test: atest com.android.server.ConnectivityServiceTest#testRegisterPrivilegedDefaultCallbacksRequireNetworkSettings android.net.cts.ConnectivityManagerTest#testRegisterNetworkCallback
Fix: 242456635
Change-Id: I80ab27445af874328c9c0f4814a8fbf035ae5df4

Junyu Lai   commited 2022-11-02 14:16:36 +08:00
aa4ad8c2d1
Use expect instead of expectCallback
This use was checked in after the cleanup that changed the latter into the former

Bug: 157405399
Test: FrameworksNetTests
Change-Id: I2b27ad712ee218322209bbc6af6e8147a0a41430

Chalard Jean   authored and   Jean Chalard   commited 2022-11-02 05:40:03 +00:00
0e184ac0dd
Merge "Fix policy leak by deleting forwarding security policies"
Yan Yan   authored and   Gerrit Code Review   commited 2022-11-02 00:47:09 +00:00
18ddc7daab
Test dynamically calculated VPN MTUs
This change adds testing for VPN MTU calculations, and in particular
cases where IPv6 is not supported due to MTUs being too small.

Bug: 245612827
Test: atest FrameworksNetTests:VpnTest
Change-Id: Ib064e6670244cf3b53b5d03bd62c86b2139ff32a

lucaslin   authored and   Lucas Lin   commited 2022-11-01 08:09:37 +00:00
afe76f3b77
Fix policy leak by deleting forwarding security policies
Fix the policy leak by deleting forwarding policies when deleting
the IPsec tunnel interface.

Bug: 254566085
Test: atest IpSecServiceParameterizedTest (new tests added)
Change-Id: I29dd4810abb978fe886776b2fbacdfc74325436d

Yan Yan   commited 2022-10-31 22:51:08 +00:00
f4eceba0a9
Merge "[Feature sync] Fix flaky test in MdnsSocketClientTests"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-10-28 08:25:08 +00:00
9a726855f2
[Feature sync] Fix flaky test in MdnsSocketClientTests
The interface index is only propagated if there is an A/AAAA
record in the response. Since the responses here are not entirely
controlled in the test, we just want to verify that we get a
response with the target we expect.

Verified by running the test 1400 times via --runs_per_test flag.

Bug: 254155029
Fix: 255922416
Test: atest MdnsSocketClientTests#startDiscovery_andPropagate\
      InterfaceIndex_includesInterfaceIndex --iteration 100
Change-Id: Icb0fe7a58a1e626b7f781ff24c2389a3095d4dc6

Paul Hu   commited 2022-10-28 10:26:15 +08:00
cd04d83e68
ClatCoordinatorTest: override test generateIpv6Address correctly
aosp/2267683 adds the new param "mark" in generateIpv6Address and
TestDependencies#generateIpv6Address needs to override for this change
correctly.

Change-Id: Ia526bcdf80a428948d55a28bd5adec405530a634
Test: TH

Nucca Chen   commited 2022-10-27 10:11:28 +00:00
f76b8d67f8
Merge "Notify NetworkStats only when interfaces changed in updateLinkProperties"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-10-27 06:49:33 +00:00
0f4cb380f0