Commit graph android_packages_modules_Co.../Tethering
Message SHA1
Merge changes I25096f4c,I40ba22ab
* changes:
  cronet: enable defaults in aosp
  cronet: add defaults to enable / disable Cronet in framework-tethering

Patrick Rohr   authored and   Gerrit Code Review   commited 2023-01-09 09:29:06 +00:00
9e31b74ee5
Merge "unregistered null callback will cause a crash later"
Steven Moreland   authored and   Gerrit Code Review   commited 2023-01-07 02:11:16 +00:00
f4e0f096b5
cronet: enable defaults in aosp
Automerger into tm-mainline-prod is currently broken, so this change
uses a Merged-In line that is already present in tm-mainline-prod (and
downstream from it). This means that this change must also be
cherry-picked into internal-master with a slightly different Merged-In
specification.

Test: TH
Merged-In: I555ad1ed687632cfe8a7e30283f80e80956fc1d4
Change-Id: I25096f4cc21923c602d77a66aad248d52b42b18f

Patrick Rohr   commited 2023-01-06 04:13:56 -08:00
a6d600ff50
cronet: add defaults to enable / disable Cronet in framework-tethering
A similar option already exists in
packages/modules/Connectivity/Cronet/apex/Android.bp. This is in
preparation of adding cronet to framework-tethering. It is possible that
we only end up using one of the variables but better safe than sorry.

This change will be blocked by the blocked automerger into
tm-mainline-prod. If this continues to be a problem, we might have to
play some tricks with automerger.

Test: TH
Change-Id: I40ba22aba041ec12ec2bf2881df14e6c0ee53b44

Patrick Rohr   commited 2023-01-06 04:12:59 -08:00
3b9ba6acdf
unregistered null callback will cause a crash later
Bug: N/A
Change-Id: I7acbc084d8a401817879d416f0283ca40e060069
Test: N/A

Steven Moreland   commited 2023-01-06 02:29:54 +00:00
cf42d60c53
BpfCoordinator: publish upstream interface mtu to v4 offload rule
Respect the upstream interface mtu instead of always setting
mtu 1500.

Using upstream interface mtu is probably not the best solution
for tether offload pmtu but it at least respects the upstream
interface mtu which may be less than 1500.

Test: manual test
1. Connect to carrier Taiwan Star.
2. Enable tethering and check the mtu 1434 in dumpsys.
IPv4 Upstream: proto [inDstMac] iif(iface) src -> nat ->
dst [outDstMac] pmtu age
  udp [02:10:45:32:ef:35] 54(54) 192.168.72.125:39034
  -> 15(rmnet1) 100.83.189.11:39034
  -> 142.251.43.14:443 [00:00:00:00:00:00] 1434 69657ms
IPv4 Downstream: proto [inDstMac] iif(iface) src -> nat
  -> dst [outDstMac] pmtu age
  udp [00:00:00:00:00:00] 15(rmnet1) 142.251.43.14:443
  -> 54(54) 100.83.189.11:39034
  -> 192.168.72.125:39034 [9a:8a:4d:ec:a4:7c] 1434 69633ms

Bug: 262860312
Test: atest BpfCoordinatorTest
Change-Id: Ic6dcb95ed76d5306053e4645b6baebc67ff082cf

Hungming Chen   commited 2023-01-03 23:36:30 +08:00
5c985e2cdd
Merge "BpfCoordinatorTest: renumber the test interface indices"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-12-30 20:46:16 +00:00
53e8697d39
BpfCoordinatorTest: renumber the test interface indices
This is a preparation to add new interface index.

Test: atest BpfCoordinatorTest
Change-Id: I758c2e7142099d74099fb8203f41ffec9b1182ee

Hungming Chen   commited 2022-12-28 21:47:11 +08:00
46767ff62e
Merge "TestOnly: disable some UpstreamNetworkMonitor tests after T"
Mark Chien   authored and   Gerrit Code Review   commited 2022-12-21 06:27:02 +00:00
09cb20d8a8
TestOnly: disable some UpstreamNetworkMonitor tests after T
The legacy upstream selection flow is never called after T. Stop the
related test cases after T also.

Bug: 257408654
Test: atest TetheringTests
Change-Id: I62692bb9a49dde432d31bece41b4cff442a327d1

Mark   authored and   Mark Chien   commited 2022-12-21 06:26:37 +00:00
2657da3cbf
Add Wearable Tethering flag and configuration
This establishes the main Wear connection manager class,
and enforces T+ requirement.

Bug: 245972418

Change-Id: Ia60925ce4dc2a25ac61c4b9bae1d022dc74f5b05

Igor Chernyshev   commited 2022-12-19 14:40:15 -08:00
a4fc702f7e
Merge "Replace NetlinkSocket with NetlinkUtils"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-12-19 12:40:41 +00:00
2d7d6e5caf
Replace NetlinkSocket with NetlinkUtils
Those static method and constants are better to fit in
NetlinkUitls. Replace the usage.

Test: m
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I81e27b8264e39764a44a4ba87344e9ac940d920a

chiachangwang   commited 2022-12-19 06:39:31 +00:00
e97aed4847
Merge "Use SocketUtils from shared lib"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-12-19 00:54:16 +00:00
393052b61f
Add CDM dependency in Tethering
This change introduces a limited library for dependencies on
framework-connectivity from Tethering,
connectivity-internal-api-util, where all classes are annotated with
@RequiresApi(S) to ensure proper API checks are done before usage.

Bug: 245972418

Change-Id: I82bafd9063341adc71d07f0858e6d68283d081f0

Igor Chernyshev   commited 2022-12-16 17:55:53 +00:00
9dac660bf0
Use SocketUtils from shared lib
Test: m
Change-Id: Ia86183a7e7844309dcbd21140e2785a71d7febab

chiachangwang   commited 2022-12-16 07:34:51 +00:00
18e072c7f5
Merge "SyncSM08: statically import tethering error code constant"
Mark Chien   authored and   Gerrit Code Review   commited 2022-12-14 13:35:12 +00:00
6d8176898e
SyncSM08: statically import tethering error code constant
This can make the code using error code not so easy to over 100
words line limit.

Test: m
Change-Id: I952c51f2e3508ed320744985193802454d07ccfe

Mark   commited 2022-12-14 09:12:15 +00:00
74461fc13d
Merge "Add ConfigInfrastructure stubs lib to Android.bp"
Hassan Ali   authored and   Gerrit Code Review   commited 2022-12-12 15:11:30 +00:00
c3ebeb81a1
bpf_tethering.h -> offload.h
match header file with bpf program

Locations to change found via:
  https://source.corp.google.com/search?q=p:aosp-master%20(%5E%7C%5B%5E_%5D)bpf_tethering.h

Core reasoning for this will be to match the .h naming
that we'll have for netd.c and clatd.c once we get rid of bpf_shared.h

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4154659c7fb23a37f5316a5c804fb2606d842e9c

Maciej Żenczykowski   commited 2022-12-08 13:04:45 +00:00
4e3321ed3b
Add ConfigInfrastructure stubs lib to Android.bp
This change is part of aosp/2305844 to update
framework-configinfrastructure dependency.

As part of moving DeviceConfig.java to
packages/modules/ConfigInfrastructure, We need to add
ConfigInfrastructure lib dependency to Android.bp as DeviceConfig APIs
will not be part of the non-updatable part and will not be part of the
base module_current SDK so we have to add an explicit dependency.

Test: m
bug: 253019048
Change-Id: Iba194c664c1c701e396e7a2a036bd03772644db8
Merged-In: Ic5323c10b7c899fbf9af41444915359f23db17b5

Hassan Ali   commited 2022-12-08 12:58:20 +00:00
bc4e514ea1
Test: rename EthernetTetheringTest to CtsEthernetTetheringTest
Bug: 250552545
Bug: 258637850
Test: atest CtsEthernetTetheringTest
Change-Id: I76e687fc46f89fcfce9049ac6736bb078df06ecc

Hungming Chen   commited 2022-12-06 15:46:23 +08:00
b58191dee8
Merge "Fix ConntrackSocketTest#testIpv4ConntrackSocket flaky"
KH Shi   authored and   Gerrit Code Review   commited 2022-12-06 05:46:54 +00:00
cc8db2ac6e
Merge "Test: separate common methods to EthernetTetheringTestBase"
Nucca Chen   authored and   Gerrit Code Review   commited 2022-12-06 02:30:13 +00:00
a43bba1277
Fix ConntrackSocketTest#testIpv4ConntrackSocket flaky
If we run an iterations test, TCP connections opened by previous tests
won't be closed immediately. They will stay in the TIME_WAIT state for
120 seconds before closed. Netfilter socket listens to both
NF_NETLINK_CONNTRACK_NEW and NF_NETLINK_CONNTRACK_DESTROY groups.

There is a tiny time gap between socket creation and sending dump
request to kernel. If an old TCP connection happened to be closed in
this time gap, listening socket would see a DESTROY message before
seeing the NEW messages triggered by dump request.

The current test only parsing the first contrack message in the read
buffer, so it will only find the DESTROY message and ignore all of the
following NEW messages. It does a netfilter socket dump, but does not
check whether the dump produces reasonable output. Now that we have
the ability to parse conntrack messages, do more in-depth checking.

Bug: 254608655
Test: atest ConntrackSocketTest --iteration 500
Change-Id: Icf95adb9d9390d598e9c6bdb4e245c5fce764e3e

KH Shi   commited 2022-12-05 22:26:52 +08:00
09eb7631fa
Merge "Wrap some IpServer commands"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-12-02 21:48:05 +00:00
767e5b6df6
Merge "Remove usages of java_api_finder"
Cole Faust   authored and   Gerrit Code Review   commited 2022-12-02 19:31:31 +00:00
65b2ec8855
Test: separate common methods to EthernetTetheringTestBase
This is a preparation for breaking down EthernetTetheringTest into
CTS and MTS tests.

Changes:
1. Separate common methods from EthernetTetheringTest
   to EthernetTetheringTestBase.
Before:
  EthernetTetheringTest

After:
  [base class]                   [derived class]

  EthernetTetheringTestBase +--+ EthernetTetheringTest

2. No test operation is changed.

Bug: 250552545
Bug: 258637850
Test atest EthernetTetheringTest

Change-Id: I36d205bf6f2a8145d5ac63c620af7528765b22ab

Hungming Chen   authored and   Nucca Chen   commited 2022-12-02 09:23:03 +00:00
40c9fe1165
Merge changes I9bccc558,Ifd855571
* changes:
  Test: separate common variables to EthernetTetheringTestBase
  Test: decouple the tests which access class member variables directly

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-12-02 09:15:42 +00:00
fbef749cda
Test: separate common variables to EthernetTetheringTestBase
This is a preparation for breaking down EthernetTetheringTest into
CTS and MTS tests.

Changes:
1. Separate common variables from EthernetTetheringTest
   to EthernetTetheringTestBase.
Before:
  EthernetTetheringTest

After:
  [base class]                   [derived class]

  EthernetTetheringTestBase +--+ EthernetTetheringTest

2. Separate EthernetTetheringTest from aosp/2319857

Bug: 250552545
Bug: 258637850
Test atest EthernetTetheringTest

Change-Id: I9bccc558dc8b955055a2927a1a600afd399b264f

Hungming Chen   authored and   Nucca Chen   commited 2022-12-02 07:18:43 +00:00
21308b5b2d
Wrap some IpServer commands
This is no-op change. Preparing for refactor.

Test: atest TetheringTests
Change-Id: I8fb67cbc95074e990074f08b5fe6afe7dfd28382

Mark   authored and   Mark Chien   commited 2022-12-02 04:48:00 +00:00
a542458c16
Test: decouple the tests which access class member variables directly
This is a preparation for breaking down EthernetTetheringTest into
CTS and MTS tests.

EthernetTetheringTest is going to separate test base class and
derived class. In order to encapsulate base class better, decouple
the following tests which access member variables directly.
- testStaticIpv4
- testLocalOnlyTethering
- testPhysicalEthernet
- testVirtualEthernet
- testVirtualEthernetAlreadyExists

Above tests change to use local veriables instead of class member
variables: mDownstreamReader, mDownstreamIface,
mTetheringEventCallback, mTetheredInterfaceRequester.

This can help to decouple the tests with class member variables and
these class member variables can be private in the
base class EthernetTetheringTestBase since the following commit.

Bug: 250552545
Bug: 258637850
Test atest EthernetTetheringTest

Change-Id: Ifd855571337b34c1dfee5cb2791369de754bc94d

Hungming Chen   commited 2022-12-01 18:54:23 +08:00
1dbc674e13
Merge "Remove dead code: updateUpstreamIPv6LinkProperties in InitialState"
Mark Chien   authored and   Gerrit Code Review   commited 2022-11-25 01:07:15 +00:00
6ed83a43c8
Merge "Add ConfigInfrastructure lib to Android.bp"
Hassan Ali   authored and   Gerrit Code Review   commited 2022-11-24 13:33:28 +00:00
bfb0cdfa51
Remove usages of java_api_finder
This errorprone checker is no longer used.

Bug: 260268418
Test: Presubmits
Change-Id: I055bce5957ae05faef683e3d515332bd119fb720

Cole Faust   commited 2022-11-23 15:10:11 -08:00
417c1d9c3a
Add ConfigInfrastructure lib to Android.bp
As part of moving DeviceConfig.java to
packages/modules/ConfigInfrastructure, We need to add
ConfigInfrastructure lib dependency to Android.bp as DeviceConfig APIs
will not be part of the non-updatable part and will not be part of the
base module_current SDK so we have to add an explicit dependency.

Test: m
bug: 253019048
Change-Id: I29f993342e1baf4e75b30c8d99de10bc087a582b

Hassan Ali   commited 2022-11-23 11:41:43 +00:00
c4f63fa973
Remove dead code: updateUpstreamIPv6LinkProperties in InitialState
mRaemon only be created at BaseServingState#enter() and set to null at
BaseServingState#exit(). Thus, updateUpstreamIPv6LinkProperties just be
no-op in InitialState.

Test: atest TetheringTests MtsTetheringTestLatestSdk CtsTetheringTest
Change-Id: I0b8403a2acffb1aa0f40d2ad8721d4eff7c63ff0

Mark   commited 2022-11-23 08:22:32 +00:00
0e38307b4b
EthernetTetheringTest: remove isEthernetTetheringSupported
isEthernetTetheringSupported() has been not used since
using TetheringManager#isTetheringSupported in aosp/2143272.

Bug: 258637850
Test: EthernetTetheringTest
Change-Id: Ifc560613301393eeadb6df11688944b2dc629c35

Hungming Chen   commited 2022-11-17 10:59:33 +08:00
e28d70804d
TetheringConfiguration: force to select upstream automatically on U+
Simply the upstream selection since U+ device for tethering refactor.

Changes:
1. Support automatic mode only on U+ device.

2. Add two tethering tests to make sure that the resource config can't
   control automatic mode anymore. Expect that always automatic mode
   on U+ device. Also limit some existing tethering tests for R, S,
   or T.
   Changes of TetheringTest:
   - testAutomaticUpstreamSelectionWithConfigDisabled (U+) [new]
   - testLegacyUpstreamSelection (T-)
   - testChooseDunUpstreamByLegacyMode (T-)
   - testChooseDunUpstreamByAutomaticModeWithConfigDisabled (U+) [new]

3. Add two tethering configuration tests to make sure that automatic
   mode is always enabled no mater what the resource config or flag
   are on U+ device. Also limit some existing tethering tests for R,
   S, or T.
   Changes of TetheringConfiguration:
   - testChooseUpstreamAutomatically (T-)
   - testChooseUpstreamAutomaticallyAfterT (U+) [new]
   - testChooseUpstreamAutomatically_FlagOverride (R)
   - testChooseUpstreamAutomatically_FlagOverrideOnSAndT (S, T)
     (Renamed from testChooseUpstreamAutomatically_FlagOverrideAfterR)
   - testChooseUpstreamAutomatically_FlagOverrideAfterT (U+) [new]

Bug: 257941865
Bug: 257408654
Test: atest TetheringTest
Change-Id: I7ace317a1529177a84557741dc07d732b7f8cf89

Hungming Chen   commited 2022-11-15 22:14:21 +08:00
d15eb88619
Merge "Remove try/catch of UnsupportedOperationException"
Mark Chien   authored and   Gerrit Code Review   commited 2022-11-15 12:15:31 +00:00
3074dd6cd5
Merge "Add isTetheringFeatureEnabled which use tethering namespace"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-11-15 08:58:23 +00:00
6660d2375f
Add isTetheringFeatureEnabled which use tethering namespace
This is no-op change. Tethering shouldn't use connectivity namespace
because it already be used for NetworkStack module. The new feature
should check isTetheringFeatureEnabled instead.

Bug: 238274852
Test: atest TetheringTests
Change-Id: I009f654d0bf8df7051b822e666e3206dd70a5523

Mark   authored and   Mark Chien   commited 2022-11-14 15:51:55 +00:00
25d3ac54fe
Merge "Add not exported flag to receiver in EntitlementManager"
Michael Groover   authored and   Gerrit Code Review   commited 2022-11-11 15:32:07 +00:00
a49c13f7e8
Add not exported flag to receiver in EntitlementManager
Android T allows apps to declare a runtime receiver as not exported
by invoking registerReceiver with a new RECEIVER_NOT_EXPORTED flag;
receivers registered with this flag will only receive broadcasts from
the platform and the app itself. However to ensure developers can
properly protect their receivers, all apps targeting a future
platform release and registering a receiver for non-system
broadcasts must specify either the exported or not exported flag
when invoking #registerReceiver; if one of these flags is not
provided, the platform will throw a SecurityException. This commit
adds the RECEIVER_NOT_EXPORTED flag to the receiver in
EntitlementManager since this broadcast is sent as a PendingIntent
alarm.

Bug: 234659204
Test: atest com.android.networkstack.tethering.EntitlementManagerTest
Change-Id: I46c2df038ccf7669636166f50fe0331efcc42e4b

Michael Groover   commited 2022-11-10 12:20:35 -06:00
3d6b8c83ce
Merge "Add libconnectivity_native"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-11-07 02:07:45 +00:00
5033f855ff
Add libconnectivity_native
The library provides an interface to interface with the
ConnectivityNative service, and implement port blocking APIs.

Bug: 179733303
Test: atest connectivity_native_test
Change-Id: Iad1c84b5eeab835aca14a2db72a900e099aa3c1c

Remi NGUYEN VAN   authored and   Tyler Wear   commited 2022-11-03 21:01:26 -07:00
fb70eba6bf
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
Merge changes from topic "cronet_in_tethering"
* changes:
  Rename org.chromium.net.cronet to framework-cronet
  Add Cronet .so and .jar to tethering apex

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-11-02 08:18:36 +00:00
c146d8753b
Merge "[TetheringGoogle] Remove explicit targetSdkVersion"
Harshit Mahajan   authored and   Gerrit Code Review   commited 2022-10-28 09:17:18 +00:00
956300ff15