Commit Graph

485 Commits

Author SHA1 Message Date
Mark Chien
413152876a Merge "Correct PendingIntent#getActivity() flags" into mainline-prod 2020-10-28 13:18:30 +00:00
Paul Hu
3323b8af4b Verify pending intent flags
All PendingIntent included activity and broadcast should set
FLAG_IMMUTABLE flag.

Bug: 156353008
Test: atest TetheringTests

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1325696

Change-Id: I885046eb25c6dafbcb4284fd94bff0052f7bdd09
Merged-In: I4592e914b67ecb8865d7de47797423f27e9ff840
(cherry picked from commit 90ffbeea18)
2020-10-28 10:35:54 +00:00
Paul Hu
8f52e2fe0f Correct PendingIntent#getActivity() flags
TetheringNotificationUpdater create a PendingIntent with
Intent#FLAG_ACTIVITY_NEW_TASK flag. But this flag is used for
Intent only. Thus, move this flag into Intent.

Bug: 158639789
Test: atest TetheringTests
Change-Id: I4c3af75c87b797bcde9356a94c835c7422dac1c6

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1329013

Change-Id: Ia843da82bc8fa03aca33a51fc309b65e73dfdc8f
Merged-In: I4c3af75c87b797bcde9356a94c835c7422dac1c6
(cherry picked from commit 2ad5f4e82f)
2020-10-28 10:21:27 +00:00
markchien
29e047778a Add the flag and default enable selectAllPrefixRange
Also add MtsTetheringTest which only run if tethering mainline
module is installed.

Bug: 166057846
Bug: 170265597
Test: atest TetheringTests
Change-Id: I434dda81eb5fab700d873a8ff3429b4222f0c7e6
Merged-In: I434dda81eb5fab700d873a8ff3429b4222f0c7e6
2020-10-19 19:15:18 +08:00
Mark Chien
2bafaf0dfe Fix miss tracking downstream problem in PrivateAddressCoordinator
The downstream do not be tracked if PrivateAddressCoordinator just
return cached address. Then, PrivateAddressCoordinator would not notify
that downstream if conflict happen.

Also remove the null check in getDownstreamPrefix because:
- An IpServer is only added to mDownstreams by requestDownstreamAddress.
- That method will only add the IpServer to mDownstreams if it has an
IPv4 address.
- As soon as that method returns, the IpServer sets mIpv4Address to the
address that was returned.
- When an IpServer is torn down, mIpv4Address is set to null after
releaseDownstream is called.

So it should never be possible for this to return null.

Bug: 168169687
Test: atest CtsTetheringTest
      atest TetheringTests

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1459887

Change-Id: I4b4d75c8a4f1de07aa7bb68b12d150d7c85c9cc1
Merged-In: Ide5206b013acdc499344e1c839a830c5b245af41
(cherry picked from commit 0854becd64)
2020-10-15 15:39:03 +00:00
Treehugger Robot
55be5eee64 Test conflict notification work when using cached address
This test catch the regression introduced in r.android.com/1432958.

Bug: 1432958
Test: atest TetheringTest
Change-Id: Id0c1afb5563954ffee1f598a3a5de6a245d77a0e

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1459889

Change-Id: Ie80d4d5d535d70df493cad0a80166d779bc6ab77
Merged-In: Id0c1afb5563954ffee1f598a3a5de6a245d77a0e
(cherry picked from commit c46006da45)
2020-10-15 15:36:21 +00:00
Anton Hansson
eccc277066 Merge "Remove Tethering @TestApi" into mainline-prod 2020-10-15 10:05:16 +00:00
Anton Hansson
f8f8967d0e Remove Tethering @TestApi
Modules shouldn't have TestApis, as documented in go/android-api-types.
Additionally, nothing depends on these TestApis existing.

Bug: 170395679
Test: m checkapi
Change-Id: I6e2c8298e90b4b54f0264be974d036fa08cd5632
Merged-In: I6e2c8298e90b4b54f0264be974d036fa08cd5632
2020-10-15 07:55:00 +00:00
Mark Chien
188bbe712d Allow tethering pick prefix from all of private address range
Currently tethering only pick prefix from 192.168.0.0/16. There is no
aviable tethering address if the upstream address is 192.168.x.y/16.
This change allow tethering to pick prefix from any private address
rnages. Now it still pick from 192.168.0.0/16 only to avoid behavior
change. Will have follow up commit to change the configuration.

Bug: 166057846
Bug: 170265597
Test: atest TetheringTests
      atest CtsTetheringTest

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1436852

Change-Id: I008d5e5902a0fb41ac564c73f265e1c942c8dcad
Merged-In: Ib6304eb8b4788e9196d0af48e72f00a6bda73a5f
(cherry picked from commit 0a6b8bfee818734c005d9f131013580f5a23ba21)
2020-10-13 13:48:54 +00:00
Mark Chien
0a53121de5 Merge changes I60ed5465,I70b49d0a into mainline-prod
* changes:
  Make the IP subnet persistent till reboot
  Make PrivateAddressCoordinator ignore vpn network
2020-10-12 10:03:26 +00:00
Mark Chien
9d881ec1ce Merge "Remove double check interface by NetworkInterface" into mainline-prod 2020-10-08 04:17:59 +00:00
Mark Chien
6eacfb6b73 Make the IP subnet persistent till reboot
Make the IP subnet persistent if it do not conflict with upstream.
It allow client to reuse its IP that usually reduce DHCP procedure.

Bug: 168169687
Test: atest TetheringTests
Change-Id: Iddc5304730dce7b11c5d124b7eddce057d752bbd

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1432958

Change-Id: I60ed54651034f21ca1cd253d272ac3478881b4e0
Merged-In: Iddc5304730dce7b11c5d124b7eddce057d752bbd
(cherry picked from commit 177e2d8d1867d7e72d00c81d6fbbed756c9f0568)
2020-10-08 00:21:26 +00:00
Treehugger Robot
67c7a7868c Make PrivateAddressCoordinator ignore vpn network
If vpn app make its netmask as 0, PrivateAddressCoordinator
would not able to find suitable address for tethering downstream.
Since tethering do not support vpn as upstream, just ignore vpn
in PrivateAddressCoordinator.

Bug: 166365863
Test: atest TetheringTests
      atest CtsTetheringTest

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1413610

Change-Id: I70b49d0a10b80f378dcd2ba78b5bac848e40e5c9
Merged-In: Iabe265467044fea9fa437674ca29ffc7bcdefe3b
(cherry picked from commit a089de8bab)
2020-10-07 17:48:13 +00:00
Treehugger Robot
0afc3ce6a7 Fix TetheredClient callback fail in InProcessTethering
TetheredClient callback would additional check whether caller has
NETWORK_SETTINGS or {MAINLINE_}NETWORK_STACK permission, but it do not
grant for self accessing. InProcessTethering run in system server, so
the services in system server would fail to call TetheredClient callback.
Grant permission for self process.

Bug: 169231588
Test: atest CtsTetheringTest

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1435273

Change-Id: I8faacd26cc6f3e940af3a0147b84b693cb93503c
Merged-In: Ic04e44aef4df772c718ff25ed331bf02f5940c1d
(cherry picked from commit 0c9a370cfc)
2020-10-07 17:46:29 +00:00
Treehugger Robot
b0cbf6f28e Remove double check interface by NetworkInterface
NetworkInterface#getByName can not get the interface without IP addresses.
When setIncludeTestInterfaces(true) is called, the interface will be
placed in client mode, which will delete the link-local address. So calling
NetworkInterface#getByName to get test interface may not work before
switching to server mode.

Bug: 168215721
Test: atest CtsTethering

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1440032

Change-Id: Idf1d18261c954e22989774ae97a12261551b31f6
Merged-In: Ice8adcce1c4b2c86bd219c701b2afa9ba2339f24
(cherry picked from commit 155e2a5212)
2020-10-07 17:44:55 +00:00
Anton Hansson
20dd58aa8d Explicitly reference framework-wifi app build rule
This works around a build-system limitation where it does not know
which jars to feed r8 to resolve all classes during proguarding.

Bug: 160453030
Bug: 169931783
Test: build_mainline_modules.sh (with prebuilt sdk)
Change-Id: I3d9f2049cf898b5e551a5c5764df423abaa5e92d
2020-10-02 16:38:21 +01:00
Anton Hansson
f26c330295 Merge "Simplify module visibility post build refactor" into mainline-prod 2020-09-14 14:14:15 +00:00
Makoto Onuki
3ef6c1ef26 Proper API hierarchy between MODULE_LIBS and PRIV_APPS system APIs
Exempt-From-Owner-Approval: Cherry-picking from master

Test: build / treehugger
Bug: 146727827
Change-Id: Ie1ad6711c490c679ebcfacd97154380a8810ba1c
Merged-in: Ie1ad6711c490c679ebcfacd97154380a8810ba1c
2020-09-11 15:34:15 +00:00
Anton Hansson
ddaad5c538 Simplify module visibility post build refactor
//visibility:override is no longer needed for impl_library_visibility
to override visibility.

Removing this allows the defaults module to specify better defaults.

- Stub libraries are made publicly visible, via `visibility`
- Impl libraries are private by default, but visibility is extended
  by the modules

Bug: 165017290
Test: m
Exempt-From-Owner-Approval: build refactor
Change-Id: Ibf35bfac5c99a21125f89ba10945f3364217b90f
Merged-In: Ibf35bfac5c99a21125f89ba10945f3364217b90f
(cherry picked from commit 9aed13818c)
2020-09-11 13:21:32 +01:00
Chalard Jean
1433252635 Rename Kotlin util files to not include the Kt suffix
Callers don't care what language the utilities are written in

This is a partial cherry-pick of the change in the packages/Tethering,
tests/net/common, tests/net/integration, wifi/tests directories. Other
tests cannot be kept in sync as the latest versions verify platform
functionalities that do not exist in the module branch, so disabling
them is less time-consuming than always resolving merge conflicts.

Test: builds
Merged-In: Ie212144f36c50db223c05f3fcb6bad745842cb5e
Change-Id: Ie212144f36c50db223c05f3fcb6bad745842cb5e
2020-08-31 14:02:06 +09:00
Chalard Jean
63e74e3131 Move utils from network stack to libs.
This package is using some common utilities from
a library that used to live in the network stack.
A better home for these utilities is frameworks/libs,
so this topic moves the files ther and also changes
the package of some utilities.

See aosp/1350222 and aosp/1350182 for a detailed
description of the specific files that moved.

Test: checkbuild
Original-change: aosp/1350083
Merged-In: I76a9b7790f3997e3e6b3c2f75ba6308286457cde
Change-Id: I76a9b7790f3997e3e6b3c2f75ba6308286457cde
2020-08-31 14:01:59 +09:00
Mark Chien
d7b755f92e Add usesCleartextTraffic to Tethering
usesCleartextTraffic needs to be true for the networkstack process so
that the NetworkStack module can use no-encrypted probes to detect
captive portals.

When loaded in the networkstack process, all packages in process must
set usesCleartextTraffic=true, otherwise there may be races causing
the flag not to be set for the process.

Bug: 161860610
Test: CtsTetheringTest, TetheringTests

Change-Id: If1ea472e2b7e715ab97851394dc8980ad269b7a1
Merged-In: Ife03ee0c7096ea242eb701b297a69b471e15b436
(cherry picked from commit 36fd800cb1)
2020-08-19 08:56:10 +00:00
Chiachang Wang
10235e5c79 Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code
for reference.

Test: m ; atest TetheringTests
Bug: 161896447
Change-Id: Idc58697c72fb00896bee00185fefc50c1a24dd35
Merged-In: Idc58697c72fb00896bee00185fefc50c1a24dd35
2020-08-07 05:40:26 +00:00
Mark Chien
88c627169a Merge changes If7997341,I7584253b into mainline-prod
* changes:
  Allow wifi p2p to use legacy dedicated address
  Address comment from aosp/1232197
2020-08-05 12:03:09 +00:00
markchien
be484d2ca1 Allow wifi p2p to use legacy dedicated address
Some exsting applications may expect wifi p2p use legacy
"192.168.49.1/24" address. Have a configuration for wifi p2p to
decide whether to use legacy dedicated address or random address.

Bug: 161520826
Test: atest TetheringTests
Change-Id: If79973416a6780ee19ee785c65772b1a2dc1fbf7
Merged-In: If79973416a6780ee19ee785c65772b1a2dc1fbf7
2020-08-05 06:45:35 +00:00
Treehugger Robot
af5885b7d4 Address comment from aosp/1232197
1. Call maybeRemoveDeprecatedUpstreams from Tethering rather than inside
PrivateAddressCoordinator because the building logic of this method based
on implementation details of Tethering.
2. Fix typo

Bug: 130879722
Test: -build, flash, boot
      -atest TetheringTests

Merged-In: I7584253b728bc17fc648fc19e492ca9f7ad2ff46
Change-Id: I7584253b728bc17fc648fc19e492ca9f7ad2ff46
2020-08-05 14:32:36 +08:00
markchien
a732b3a5a2 Always stop dhcp server even it is obsolete
If dhcp server is obsolete, explicitly stop it to shut down its thread.

Bug: 161418295
Test: atest CtsTetheringTest
Change-Id: Ic5b876bd23711ec8d832879a7baee0495246b218
Merged-In: Ic5b876bd23711ec8d832879a7baee0495246b218
2020-07-29 16:32:39 +08:00
Treehugger Robot
c7647a265b Fix EthernetTetheringTest failure if tethering is not supported am: 0275981699
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12137906

Change-Id: Ida17807b70116ad5ac648d780c226b6d50ed299e
2020-07-13 13:30:57 +00:00
Treehugger Robot
0275981699 Fix EthernetTetheringTest failure if tethering is not supported
Do not run ethernet tethering tests if tethering is not supported
because Tethering APIs would fail. Also skip the test if
EthernetManager is not avaliable. EthernetManager would be null if
there are no FEATURE_ETHERNET and FEATURE_USB_HOST.

Bug: 159869957
Test: atest CtsTetheringTest
Merged-In: I2b9be6799c6edeefc8cd74897a8704dbe80dd061
Change-Id: I2b9be6799c6edeefc8cd74897a8704dbe80dd061
2020-07-13 10:01:25 +00:00
Mark Chien
95482b5580 Merge "Skip testPhysicalEthernet if the test run adb over network" into rvc-dev am: a973bf1a56
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12105761

Change-Id: Idd2f94df2e477b33db887d5d7c0d4aebf507cb86
2020-07-09 00:39:52 +00:00
Treehugger Robot
6faf861994 Skip testPhysicalEthernet if the test run adb over network
If the test run adb over network and ethernet is available, it is likely
that adb may run over ethernet. Then the test would fail because adb
would break when ethernet is switching from client mode to server mode.

Bug: 160389275
Test: atest CtsTetheringTest

Merged-In: I57d365d33316881c50c3bf7fd1c98926d10842d3
Change-Id: I57d365d33316881c50c3bf7fd1c98926d10842d3
2020-07-08 05:40:52 +00:00
TreeHugger Robot
7b5ee8fbb1 Merge "Fix tethering jarjar rule for LocalLog" into rvc-dev am: 6127ca43d6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12040945

Change-Id: I1e80e3af6673d00c7b89bacd88111e14876376e7
2020-07-01 07:58:38 +00:00
markchien
683932315b Fix tethering jarjar rule for LocalLog
LocalLog is in android.util* instead of android.net*.
No crash happened because the methods used by tethering are
@UnsupportedAppUsage.

Bug: 160113128
Test: atest TetheringTests
Change-Id: I5f070b96f96aaabf7ec8da52a3d3444ed940fb56
2020-07-01 03:40:50 +00:00
Akshay Thakker
e0e3176269 Make change and version bump to r_aml_309999900 for mainline module file: packages/Tethering/apex/manifest.json
Change-Id: I0a80cda2e4a62ccd87e4fbbe1faa6d6fdb23f014
Exempt-From-Owner-Approval: Version bump only
2020-06-30 05:26:30 +00:00
TreeHugger Robot
ad2b78a5a1 Merge "tethering: offload: Netlink Req" into rvc-dev am: 0de458a801
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11970745

Change-Id: I14944e318cea5792941dcf2cf14c12ff468a846c
2020-06-24 06:51:39 +00:00
TreeHugger Robot
0de458a801 Merge "tethering: offload: Netlink Req" into rvc-dev 2020-06-24 06:46:47 +00:00
Lorenzo Colitti
0982de0ecf Merge "Tethering: Add WiGig support" into rvc-dev am: 7852107b29
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11953638

Change-Id: I505778640a8de2ef99e92447b7d1f4917245b151
2020-06-24 04:41:05 +00:00
Lorenzo Colitti
e8141aa9c3 tethering: offload: Netlink Req
Send netlink request over fd for offload config before
completing init sequence. Provides existing conntrack
entries to IPA. Resolves issue where there are NAT
misses in IPA due to IPA only having the conntrack
entries added after tethering starts.

Bug: 149109043
Test: OffloadHardwareInterfaceTest
Original-Change: https://android-review.googlesource.com/1290954
Merged-In: Iaf3e847e92f205b55f10fa85c17b9f3995d52099
Change-Id: Iaf3e847e92f205b55f10fa85c17b9f3995d52099
2020-06-24 04:21:47 +00:00
Dedy Lansky
4dd87aafc0 Tethering: Add WiGig support
This change is a combination of following changes:

1) Tethering: add TETHERING_WIGIG type
   Currently both WIFI and WIGIG use the same tethering type,
   TETHERING_WIFI. This causes conflicts between the frameworks,
   when both WIFI and WIGIG SoftAPs are started, one or both will
   not work.
   Fix this by using a seperate tethering type for WIGIG.

2) Tethering: remove TETHERING_WIGIG state machine on interface down
   The wigig state machine relies on a TETHERING_STATE_CHANGED broadcast
   that is sent when the tethering state machine is first created, during
   interface up. Currently the tethering state machine is not removed
   on interface down except for TETHERING_BLUETOOTH, and as a result
   wigig tethering only works the first time SoftAP is started.
   In order to fix this, remove the tethering state machine on interface
   down for TETHERING_WIGIG as well.

Bug: 143356416
Test: TetheringCoverageTests

Change-Id: Ic4d3aca0ed69234093af7f0206dab3335938c52a
Merged-In: Ic4d3aca0ed69234093af7f0206dab3335938c52a
2020-06-22 23:23:25 +00:00
Wayne Ma
4c847d23f1 Merge "Add framework-statsd dependency and make framework-statsd visible to Tethering package." into rvc-dev am: 7ce578a359
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11926261

Change-Id: I8d7444fb29ad1339d9b2d33f6e1688015c5613b7
2020-06-22 08:51:51 +00:00
waynema
b7048af0a9 Add framework-statsd dependency and make framework-statsd visible to
Tethering package.

Tethering needs StatsEvent and StatsLog which are in
framework-statsd.stubs.module_lib to write metrics.

Bug: 153942334

Test: make
Change-Id: I8ba142a9b3678de36e6c4880a64e992e00680f38
2020-06-22 06:57:51 +00:00
TreeHugger Robot
36eab72880 Merge "Let only Ethernet manage ethernet interface up and down" into rvc-dev am: 28c2d1dcca
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11908430

Change-Id: I3153f51a66df5eaf2f220ed50c2a83de960b83f7
2020-06-19 08:29:30 +00:00
TreeHugger Robot
930a956e50 Merge changes I2292c1cb,I8f60c137 into rvc-dev am: aee09af636
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11907887

Change-Id: Ifacd13ca8fc146c1a3f01ddf38dc9aed7678f08f
2020-06-19 06:51:45 +00:00
Lorenzo Colitti
d6741dcc4a Memory leak due to no stop for IpNeighborMonitor. am: 93e59ee726
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11910263

Change-Id: I4cfe32fab474ba9bab5e96a90329ad52e87eba77
2020-06-19 06:51:42 +00:00
Mark Chien
675697222a Let only Ethernet manage ethernet interface up and down
When LAN link is changed for using ethernet interface from Ethernet tethering to Ethernet,
there is confiict as Ethernet Tethering is trying to make ethernet link down and Ethernet is trying to make ethernet link up.

So, this would make Ethernet only manage ethernet interface link state.

Test: manual
Bug: 130840861
Merged-In: I1cd40ae764bdeecbb59e3889e9399b7f4b05f9cc
Change-Id: I1cd40ae764bdeecbb59e3889e9399b7f4b05f9cc
2020-06-19 06:49:46 +00:00
TreeHugger Robot
aee09af636 Merge changes I2292c1cb,I8f60c137 into rvc-dev
* changes:
  Test that IpNeighborMonitor is stopped when IpServer stops.
  Memory leak due to no stop for IpNeighborMonitor.
2020-06-19 06:36:50 +00:00
Treehugger Robot
a4a8a315fe Add owneship of tethering module
Bug: 158961959
Test: build/make/tools/checkowners.py packages/NetworkStack/OWNERS
Test: ./build/make/tools/checkowners.py \
frameworks/base/packages/Tethering/OWNERS

Merged-In: I13b291e5db6a8a8c9f2bfa477acabaea250aa48c
Change-Id: I13b291e5db6a8a8c9f2bfa477acabaea250aa48c
2020-06-19 03:37:43 +00:00
Treehugger Robot
9644bc01dd Test that IpNeighborMonitor is stopped when IpServer stops.
Bug: 159097215
Test: test-only change
Original-Change: https://android-review.googlesource.com/1343441
Merged-In: I2292c1cbff06a304f70191b88d833b19af2b8b92
Change-Id: I2292c1cbff06a304f70191b88d833b19af2b8b92
2020-06-19 03:06:05 +00:00
Lorenzo Colitti
93e59ee726 Memory leak due to no stop for IpNeighborMonitor.
1. When Wi-Fi enabled, ap0 interface is added and IpNeighborMonitor's
   start() is invoked in IpServer's constructor.
2. There's no stop for IpNeighborMonitor when IpServer stop.
3. During overnight test for Wi-Fi, networkstack is too slow to
   process request due to memory leak in IpNeighborMonitor and
   binder buffer is blocked causing exception.
Solution: Invoke IpNeighborMonitor.stop() in UnavailableState.enter().

Bug: 159097215
Test: automatic, turn on and off Wi-Fi every 6 seconds overnight
Original-Change: https://android-review.googlesource.com/1343440
Merged-In: I8f60c13706f05306e8f25a15f7861d7ecabbc10e
Change-Id: I8f60c13706f05306e8f25a15f7861d7ecabbc10e
2020-06-19 02:43:57 +00:00
Remi NGUYEN VAN
e7afe55beb Merge "Move Inet[4]AddressUtils to libs/net" into rvc-dev 2020-06-19 00:49:29 +00:00