Commit Graph

709 Commits

Author SHA1 Message Date
Maciej Żenczykowski
82a4e0a42e Merge "ipsec - use ro.vendor.api_level instead of ro.product.first_api_level" 2022-11-09 22:38:36 +00:00
Maciej Żenczykowski
5d78c63662 ipsec - use ro.vendor.api_level instead of ro.product.first_api_level
Bug: 254143771
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9f91fc250e0fa40c9dc9ee3e7a2f7bc3cf2ebc75
2022-11-09 00:47:13 +00:00
Cole Faust
22f05839f5 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
2022-11-02 10:13:14 -07:00
Chalard Jean
1d420b3b76 Move bit utilities to BitUtils.
Test: BitUtilsTest
Change-Id: I3e100c6087f61c2a13aa8558ee8f9a9ad480c681
2022-10-12 16:39:37 +09:00
Paul Duffin
c8164e4963 Make the hiddenapi*-tiramisu.txt files part of framework-connectivity-t
Previously, the hiddenapi*-tiramisu.txt files that were created as part
of the work for creating framework-connecvity-t were just added to the
list of hidden API files on the bootclasspath_fragment. Unfortunately,
that made it impossible to exclude those when generating an sdk
snapshot for S which cannot include framework-connectivity-t.

This change moves those files to be part of framework-connectivity-t
instead of the bcpf so that they will only be used in an sdk snapshot
when the library is part of the snapshot.

Bug: 240406019
Test: packages/modules/common/build/mainline_modules_sdks.sh
      # Ran the previous command with and without this change to make
      # sure that this change does not change the sdk snapshot
      # contents. A follow up change will exclude the
      # framework-connectivity-t library from the S sdk snapshot.
Change-Id: Ib5c5c6046d96b911c8e9e5ac3729ce963f1b6907
2022-09-13 15:13:15 +00:00
Junyu Lai
c9f1ca62d9 [ST01] Attributes data usage of test network by specifier
Currently, data usage of all test networks are all attributed to
the same NetworkIdentity, which does not allow services to
distinguish upload & download traffic of different test networks.

Thus, this CL put specifier that comes along with
TestNetworkAgent into wifiNetworkKey field to build different
NetworkIdentity to attribute data usage to different for
individual networks. And allow querying test network usage with
wifiNetworkKeys.

Bug: 139774492
Test: atest FrameworksNetTests
      atest android.net.cts.ConnectivityManagerTest
Change-Id: I1bb38fd20781eaf3105735440a04b27bef36fcae
2022-08-29 13:55:08 +08:00
Aaron Huang
4705518156 Merge "Cleanup constructor of NetworkStats#Entry" am: 0ab4d265d6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2167482

Change-Id: Ie9dfc1e735af3842a40b31015bd90f09d2038cdc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-05 08:37:59 +00:00
Aaron Huang
0ab4d265d6 Merge "Cleanup constructor of NetworkStats#Entry" 2022-08-05 07:46:28 +00:00
Treehugger Robot
0c19e66e2d Merge "Only use framework-connectivity stubs for -t stubs" am: a9fa050bdc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2173584

Change-Id: I4cde28a2f9e4510fc1b00e5399865989fb6a6b5f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-04 04:58:46 +00:00
Treehugger Robot
a9fa050bdc Merge "Only use framework-connectivity stubs for -t stubs" 2022-08-04 04:34:17 +00:00
Remi NGUYEN VAN
77d4c4efa8 Only use framework-connectivity stubs for -t stubs
Do not use framework-connectivity stubs for
framework-connectivity-t-pre-jarjar, as that library can build against
the full framework-connectivity implementation including hidden symbols:
it already builds against framework-connectivity-pre-jarjar.

The stubs are only necessary to build framework-connectivity-t stubs, to
avoid circular dependencies between these and the framework-connectivity
implementation.

This change allows using hidden symbols of framework-connectivity in
framework-connectivity-t-pre-jarjar, but does not fully fix the problem
as framework-connectivity-t will use the framework-connectivity stubs
both to build its own stubs and to build its implementation library, due
to "libs" being used in both cases (and prioritized over
impl_only_libs). As a result, it is still not possible to build
framework-connectivity-t when it references hidden symbols of classes
that are also part of the stubs. Still, this is a first step and
organizes the build rules closer to what they should be.

Bug: 139774492
Test: m
Change-Id: I5e696fa6a7871d048e0ba16442de33b5f139faae
2022-08-03 15:51:48 +09:00
Aaron Huang
8b9ecdad6d Cleanup constructor of NetworkStats#Entry
Have all callers to use the same constructor and remove the
unused constructors.

Bug: 238843364
Test: FrameworksNetTests
Change-Id: Ieb1d0bc4ff8d2238c7a802189f8d91f4a9978eb8
2022-08-02 22:49:16 +08:00
Remi NGUYEN VAN
a5803006e9 Merge "Add back compat config for NSD" am: a39d54bf43
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2157803

Change-Id: I7567e5dd6d38815a1055a4ecc54a76eba7ff56ed
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-29 08:41:54 +00:00
Remi NGUYEN VAN
348bbb0231 Add back compat config for NSD
Add back compat config for RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS, which was
lost when moving NsdManager to framework-connectivity-t.

This causes NsdManager to start mdnsresponder again when used by apps
with target SDK < 31.

The change also changes the compat ID used, to make sure it does not
conflict with the ID already in use in S and below, when the module is
installed on such a platform. This is the only ChangeId used by
framework-t.

Also add a CtsNetTestCasesMaxTargetSdk30 test to verify that behavior.

Bug: 235355681
Test: atest CtsNetTestCasesMaxTargetSdk30
Change-Id: I7ca6051d0a4ba5aff3e44bece2cbac22eb1be32d
2022-07-27 19:53:25 +09:00
Aaron Huang
059a7f9526 Merge "Migrate buildTemplate* to use NetworkTemplate.Builder" am: c37d806dfd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2152658

Change-Id: If75f307a6e46677cfc1932d8f968226729819ba1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-26 07:58:23 +00:00
Aaron Huang
c37d806dfd Merge "Migrate buildTemplate* to use NetworkTemplate.Builder" 2022-07-26 07:40:49 +00:00
Treehugger Robot
ad2391821e Merge "Run R8 with the necessary classpath classes" am: 3a317cc0c4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2164654

Change-Id: Iefcfa11abf79382b591da4578c861bfe9d61a6d2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-26 03:43:02 +00:00
Remi NGUYEN VAN
371e7f7555 Run R8 with the necessary classpath classes
R8 emits "missing class" warnings when optimizing service-connectivity
because service-connectivity combines several already built static_libs
(service-connectivity, service-connectivity-t, service-nearby), but does
not specify any classpath library, which are actually needed for R8.

This causes wrong optimizations, where R8 would sometimes strip out code
that it thinks is unused (because it considers it unreachable due to the
missing class, or it does not know the superclass of a callback and
thinks the overridden methods cannot be called).

Add the necessary classpath libraries to remove the warnings.

Bug: 226127213
Bug: 239990030
Test: m service-connectivity, see no "Missing class" warnings
Change-Id: I1eaa39b70da4b540e3a3e8e798bec1359b5bf533
2022-07-25 18:52:58 +09:00
Aaron Huang
1c14fa9b08 Migrate buildTemplate* to use NetworkTemplate.Builder
Use new Builder API which was introduced in Android T.

Bug: 238843364
Test: FrameworksNetTests
      dumpsys netstats --checkin and check the output
Change-Id: Ieb0a2ee04056a1cedb71274ea710ff5153e2d68c
2022-07-25 11:30:13 +08:00
Remi NGUYEN VAN
ecfd3d7f67 Merge "Simplify framework-t/Sources.bp" am: bddff8a2fb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2072838

Change-Id: I0e521e34b3c1f11d14690b9291bc38fa55e55b29
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 06:17:50 +00:00
Remi NGUYEN VAN
bddff8a2fb Merge "Simplify framework-t/Sources.bp" 2022-07-21 05:34:26 +00:00
Remi NGUYEN VAN
f9ab7a5591 Merge "Use jarjar rule generator for connectivity rules" am: 751e3419c1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2103113

Change-Id: Id8d070590f7a7b392ef0782c7c46d4631d405f97
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 04:28:45 +00:00
Remi NGUYEN VAN
751e3419c1 Merge "Use jarjar rule generator for connectivity rules" 2022-07-21 04:08:23 +00:00
Remi NGUYEN VAN
5b54607913 Simplify framework-t/Sources.bp
Just include all files with a blob, instead of listing them separately.

All files in the directory were previously referenced by
framework-connectivity-tiramisu-updatable-sources, so this is a no-op.

Bug: 217129444
Test: m
Change-Id: I83415b8f2a5836874c5ea2bffee45c43e03cc139
2022-07-20 19:57:12 +09:00
Remi NGUYEN VAN
e55a88d30f Use jarjar rule generator for connectivity rules
(This rolls forward part of a previous change, now that jarjar was fixed
to not get very slow when the number of rules increases).

Autogenerate connectivity jarjar rules at build time, to avoid issues
with forgotten jarjar rules or hard-to-diagnose errors introduced by
incorrect rules.

This change causes all classes in framework-connectivity(-t) and
service-connectivity to be jarjared into android.net.connectivity, but
still avoids jarjaring classes in com.android.server as before, to keep
it small.
For many classes this differs from the original jarjar rule.

Notes on implementation:

 - connectivity-jarjar-rules now has a subset
   framework-connectivity-jarjar-rules containing only the rules
   necessary for framework-connectivity. This is necessary because
   framework-connectivity cannot depend on rules generated based on
   service-connectivity, as there would be a dependency cycle
   (service-connectivity depends on framework-connectivity); Soong even
   crashes with a stack overflow.

 - framework-wifi.stubs.module_lib is added to
   framework-connectivity-pre-jarjar as it is necessary to build it (it
   is already in impl_only_libs in the defaults).
   It is unclear why framework-connectivity-pre-jarjar could build
   before that (possibly because it was only used as "lib" ?)

 - Fix package-private visibility; for example NattSocketKeepalive,
   TcpSocketKeepalive are not API so should be jarjared, but are used
   by ConnectivityManager which is not jarjared, so they are not in the
   same package after the change. Package-private members in the
   former 2 need to be public to be accessible. Changes in this commit
   are all that is needed, as demonstrated by followup commits that move
   the classes to a different package without further changes, and that
   enforce that no class in an API package gets jarjared.

 - framework-connectivity-internal-test-defaults is separated from
   framework-connectivity-test-defaults, for unit tests that need to
   access internal jarjared classes. Such tests need to use the jarjar
   rules themselves too, so this is only appropriate for connectivity
   internal unit tests.

Test: atest ConnectivityCoverageTests CtsNetTestCases
Bug: 217129444
Change-Id: Ib1bd939b71c0171d945fc01b96195d2f620ff13b
2022-07-20 19:57:11 +09:00
Aaron Huang
f49be5f320 Merge "Fix style errors in NetworkStats" am: b84de74137
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2138534

Change-Id: Ide39fea8d06b563bb3eb5e7ca3bc67c2b2caca7a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 09:40:30 +00:00
Aaron Huang
b84de74137 Merge "Fix style errors in NetworkStats" 2022-07-20 09:24:33 +00:00
Aaron Huang
f7c1042aaf Fix style errors in NetworkStats
Test: build
Change-Id: I4366480e7a71004612d775bfa54744cc74c1fd7b
2022-07-20 05:48:17 +00:00
Aaron Huang
be198dcc5c Merge "Replace buildTemplate* with NetworkTemplate.Builder" am: 1ba1febf2b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2155326

Change-Id: I0837739ae0b1d8daadbbd2311a6c65eb61c139f7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-20 03:13:07 +00:00
Aaron Huang
1ba1febf2b Merge "Replace buildTemplate* with NetworkTemplate.Builder" 2022-07-20 02:56:33 +00:00
Aaron Huang
a4fcb8b4cf Replace buildTemplate* with NetworkTemplate.Builder
Use Builder API which was provided in Android T to
build a template.

Bug: 238843364
Test: build, FrameworksNetTests:NetworkStatsManagerTest
Change-Id: Ibf1ac16541d6f3ddaf9b241e2f47ae04acbedf93
2022-07-18 17:16:49 +08:00
Chiachang Wang
d2e4c1f915 Merge "Correct javadoc usage" am: b7f81e4a6d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2153593

Change-Id: I72c6695348fb9b5f81f5e89064ec10d166fa23bf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-15 07:56:03 +00:00
chiachangwang
9473c59980 Correct javadoc usage
"{@see" aren't rendered properly. Replace them with "See {@link"
or @see depending on the usage.

Bug: 238753273
Test: make doc-comment-check-docs ; Check the doc result
Change-Id: I70cb2f36e7c5fa8102b5949054df5184d755202c
2022-07-15 03:44:46 +00:00
Aaron Huang
5804b5c5df Merge "Hold wifi and mobile interfaces since boot in NetworkStatsService" 2022-06-07 07:36:26 +00:00
Treehugger Robot
5c74cab9a8 Merge changes from topic "historybuildertest"
* changes:
  Return sorted NetworkStatsHistory
  Use fallback method if the importer throws
2022-06-07 06:06:45 +00:00
Junyu Lai
bfdd4407eb Return sorted NetworkStatsHistory
NetworkStatsHistory internally assumes that bucketStart is
sorted at all times. However, in the fields, we've found there
are some buckets of NetworkStatsHistory do not preserve the
order of timestamp, which is caught by the IAE when addEntry
is called.

In order to provide backward compatibility, return sorted items
instead of throwing IAE when adding entry into
NetworkStatsHistory instance.

Test: atest android.net.netstats.NetworkStatsHistoryTest#testBuilder
Bug: 233825704
Change-Id: If3187384bd1e90770ca5873b8ec73e852fff543d
Merged-In: If3187384bd1e90770ca5873b8ec73e852fff543d
  (pure cherry-picked from ag/18581718)
2022-06-07 10:51:52 +08:00
Aaron Huang
f4f5de3993 Hold wifi and mobile interfaces since boot in NetworkStatsService
In current design, the interface will be removed from the list if
the network disconnected which will cause getUidStatsForTransport()
returns unexpected snapshot to caller since the list is empty.

This change also remove interface name from all entries before
the method returns the result.

Bug: 231514741
Test: FrameworksNetTests
      manual test
Change-Id: Ie60829a65d0d9b5b63ad353695a820c0586e3665
Merged-In: Ie60829a65d0d9b5b63ad353695a820c0586e3665
2022-06-06 13:19:11 +08:00
Remi NGUYEN VAN
0c334548f8 Merge "Ensure callbacks are run properly on executor" am: 411d2bd07d am: f8224f5364
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2111166

Change-Id: I70f6ccf9f42717b846e816067e90916792cec143
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-03 09:42:25 +00:00
Aaron Huang
ab097b28d5 Hold wifi and mobile interfaces since boot in NetworkStatsService am: a2f1cf3576
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/18710006

Change-Id: Ie53afd7a2c6cfdd46a1ed3954a1aceac9bd120eb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-03 09:25:50 +00:00
Remi NGUYEN VAN
411d2bd07d Merge "Ensure callbacks are run properly on executor" 2022-06-03 09:04:29 +00:00
Aaron Huang
a2f1cf3576 Hold wifi and mobile interfaces since boot in NetworkStatsService
In current design, the interface will be removed from the list if
the network disconnected which will cause getUidStatsForTransport()
returns unexpected snapshot to caller since the list is empty.

This change also remove interface name from all entries before
the method returns the result.

Ignore-AOSP-First: non-AOSP CL is included in the same topic
Bug: 231514741
Test: FrameworksNetTests
      manual test
Change-Id: Ie60829a65d0d9b5b63ad353695a820c0586e3665
2022-06-03 15:51:19 +09:00
Remi NGUYEN VAN
9133888e0c Ensure callbacks are run properly on executor
NsdManager callbacks were run on a provided executor by capturing the
handler message in a lambda, but the message will be recycled
immediately after handleMessage returns. This means that any non-inline
executor would see bogus callbacks, as they have an empty Message. Fix
it by not capturing the Message in the lambda, but capturing its
contents instead.
This was broken when updating the class to support executors in change
ID: I4c31e2d7ae601ea808b1fd64df32d116c6fff97f; before that, callbacks
were all run on the NsdManager handler.

Also, DelegatingDiscoveryListener is being run on the NsdManager handler
thread for notifyAllServicesLost, causing onServiceLost to be run there,
but other methods are run on the provided Executor, even though they
access maps maintained on the handler thread, like mPerNetworkListeners.

Revert DelegatingDiscoveryListener to run on the handler thread as
before, and only use the provided executor to execute any app-facing
callback instead.

Bug: 234419509
Test: atest NsdManagerTest

Change-Id: Icca64511b02dad2f725a2849d2a1e871135b3286
2022-06-02 18:16:42 +09:00
Paul Hu
6773b82577 Merge "Remove the DisabledState from NsdService" am: d65740346e am: 537e5289fe
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2110094

Change-Id: I86da81dbd9e5d55042a9cf2df8d5876a4f244e03
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-01 10:17:28 +00:00
Paul Hu
d65740346e Merge "Remove the DisabledState from NsdService" 2022-06-01 09:25:11 +00:00
Remi NGUYEN VAN
2bd25cdc84 Merge "Fix service resolve on tethering downstreams" am: 5eaefa21bf am: d0a31d8e08
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2110084

Change-Id: I14bf75238dd36a9d5c834f26964d1e861d1e714e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-01 06:09:12 +00:00
Paul Hu
29f4359856 Remove the DisabledState from NsdService
In order to increase the line coverage for the Connectivity
module, remove the DisabledState from NsdService which is
uselss for a while.

Bug: 234315786
Test: atest FrameworksNetTests CtsNetTestCases \
      ConnectivityCoverageTest
Change-Id: I29c7ef608d97037084b25daa70ad5829f474e20a
2022-06-01 05:57:59 +00:00
Remi NGUYEN VAN
0102c9440a Fix service resolve on tethering downstreams
Tethering downstreams do not have NetworkAgents, and although they have
a netid of 99, Networks with netId 99 are not usable by apps for most
connectivity APIs.

Recent refactoring in NsdService adds the Network of a found service
into its NsdServiceInfo, and uses that network to resolve the service.
In that case the Network has netId 99 and resolving the service fails.

Avoid that problem by:
 - Keeping the Network field null when a service is found on a tethering
   downstream; this avoids giving apps a confusing and unusable Network
   with netId 99
 - Using the interface index found during discovery to resolve the
   service, if the app uses the NsdServiceInfo that was obtained from
   discovery to resolve. If not, all interfaces will be used to resolve,
   as per legacy APIs.

Bug: 233979892
Test: atest NsdServiceTest
      Also manual test with 2 devices connected via hotspot
Change-Id: Idd176153b67ccbd1d4f1b1fd66dafaa2f3a9e27a
(cherry picked from commit 1a8ee102d3)
Merged-In: Idd176153b67ccbd1d4f1b1fd66dafaa2f3a9e27a
2022-06-01 05:35:36 +00:00
Remi NGUYEN VAN
5eaefa21bf Merge "Fix service resolve on tethering downstreams" 2022-06-01 05:31:14 +00:00
Natasha Lee
bcdb3c12ee Merge changes from topic "stats-migration"
* changes:
  Skip PersistentIntTest on S- device
  Don't clobber existing history entries.
  Ensure NetworkStats migrated snapshot is identical
  [MS82.1] Support network stats data migration process
  Add a PersistentInt class.
2022-06-01 03:03:02 +00:00
Remi NGUYEN VAN
1a8ee102d3 Fix service resolve on tethering downstreams
Tethering downstreams do not have NetworkAgents, and although they have
a netid of 99, Networks with netId 99 are not usable by apps for most
connectivity APIs.

Recent refactoring in NsdService adds the Network of a found service
into its NsdServiceInfo, and uses that network to resolve the service.
In that case the Network has netId 99 and resolving the service fails.

Avoid that problem by:
 - Keeping the Network field null when a service is found on a tethering
   downstream; this avoids giving apps a confusing and unusable Network
   with netId 99
 - Using the interface index found during discovery to resolve the
   service, if the app uses the NsdServiceInfo that was obtained from
   discovery to resolve. If not, all interfaces will be used to resolve,
   as per legacy APIs.

Bug: 233979892
Test: atest NsdServiceTest
      Also manual test with 2 devices connected via hotspot
Change-Id: Idd176153b67ccbd1d4f1b1fd66dafaa2f3a9e27a
2022-05-31 13:06:22 +09:00