Commit Graph

482 Commits

Author SHA1 Message Date
Chiachang Wang
14aaefcb12 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
2020-07-29 12:05:04 +08:00
Treehugger Robot
b68d322521 Merge "Skip testPhysicalEthernet if the test run adb over network" 2020-07-08 04:41:34 +00:00
Chalard Jean
6b66d70ba1 Revert "Move Inet[4]AddressUtils to libs/net"
This reverts commit cf86031c12.

Reason for revert: Breaks the build b/160390899

Merged-In: Icd141a992c46290c74929785e261a1cd57bc001b
Change-Id: Ie10e66f61393602f17fbb61bf17230b176bf1f44
2020-07-02 23:47:35 +00:00
markchien
37ad92e058 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

Change-Id: I57d365d33316881c50c3bf7fd1c98926d10842d3
2020-07-02 23:26:46 +08:00
Remi NGUYEN VAN
cf86031c12 Move Inet[4]AddressUtils to libs/net
The classes should not be picked up from frameworks/base, as they are
part of several mainline modules.

Also refine comments in DhcpResults following feedback in previous
change.

(cherry-pick from internal branch skipping wifi classes; no other
conflict)

Bug: 151052811
Test: m; manual: flashed, wifi and telephony working
Test: atest NetworkStackCoverageTests
Merged-In: I7074651c6a2a7a6b11bcf13cc4bb03833d7d655f

Change-Id: I7074651c6a2a7a6b11bcf13cc4bb03833d7d655f
2020-07-02 10:52:31 +09:00
Mark Chien
5ac18c5049 Merge "Fix tethering jarjar rule for LocalLog" 2020-07-01 09:30:24 +00:00
markchien
a8ac97cf22 Fix tethering jarjar rule for LocalLog
LocalLog is in android.util* instead of android.net*.
No crash happen becaue the methods used by tethering are
@UnsupportedAppUsage.

Bug: 160113128
Test: atest TetheringTests
(cherry-pick from internal branch with conflicts)
Merged-In: I5f070b96f96aaabf7ec8da52a3d3444ed940fb56

Change-Id: I5f070b96f96aaabf7ec8da52a3d3444ed940fb56
2020-06-30 15:30:55 +00:00
Paul Hu
6b2b4e6514 Merge "Correct PendingIntent#getActivity() flags" 2020-06-29 11:53:18 +00:00
Treehugger Robot
cdf6b4202c Merge "Use unstable networkstack AIDLs in development branches" 2020-06-29 04:02:49 +00:00
paulhu
67aeab2eee 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
2020-06-29 00:32:19 +08:00
Orion Hodson
c6b2c39d04 Merge changes from topic "lnh-platform-split"
* changes:
  Update to use nativehelper/JNIPlatformHelp.h
  Sync with libnativehelper refactoring
2020-06-25 07:36:05 +00:00
Orion Hodson
0cdccd707f Sync with libnativehelper refactoring
jniGetFDFromFileDescriptor() is now a legacy method and moved to a
separate header.

Bug: 151443957
Bug: 158749603
Test: m
Change-Id: Icd06e9a315680c2251dbb9032a904dd6d66aa359
Merged-In: Icd06e9a315680c2251dbb9032a904dd6d66aa359
Exempt-From-Owner-Approval: cherry pick
(cherry picked from commit a5c4682505)
2020-06-24 14:13:13 +01:00
Luke Huang
895594dcc2 Move DnsPacket to libs net
This class might be used by some mainline modules.

Bug: 151052811
Test: atest DnsPacketTest
Test: atest DnsResolverTest
(clean cherry-pick from internal branch)
Merged-In: I8841d91456952ded5efbf8ea221289aecc7746ad
Change-Id: I8841d91456952ded5efbf8ea221289aecc7746ad
2020-06-24 11:32:26 +00:00
Lorenzo Colitti
b90c974174 Merge "tethering: offload: Netlink Req" 2020-06-24 03:11:26 +00:00
Dedy Lansky
6896f6193f 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
2020-06-22 21:17:46 +08:00
Xiao Ma
e5e0743057 Use unstable networkstack AIDLs in development branches
Development branches should use the -unstable version of the
NetworkStack AIDLs so that refreezing is not necessary for each
modification.
The versions will be re-frozen before each release instead.

Bug: 157534516
Test: m
Merged-In: I74b4a16266bda7b8ac740b3a0193268da260fc2f
Change-Id: I1c2fe707d865e6a1953b4ab82194d4b9132258f9
2020-06-22 10:15:13 +00:00
markchien
4c9428a135 Protect invalid entitlement app configuration
There is a protection in Settings that Settings would gray out if
tethering requires entitlement check but the entitlement app is
invalid. Tethering resource is moved from framework to tethering
module, so Settings can not fetch entitlement app name anymore.

In this change, tethering module would check whether entitltement app
package name is exsited if entitlement check is needed. Tethering would
be not supported (Settings tethering option would be hidded) if
entitlement app is not installed.

After moving the protection into tethering module,
TetherUtil#isProvisioningNeeded is no longer needed. Because The
only use case is Settings wants to gray out tethering setting
when entitltement check is needed but entitlement app is invalid.

Bug: 146918263
Test: atest TetheringCoverageTests
Change-Id: I9a5ff5dbc1db3f3be7fcd7146862a16b373507e6
Merged-In: I9a5ff5dbc1db3f3be7fcd7146862a16b373507e6
2020-06-20 10:19:25 +08:00
markchien
902043f5c3 Pass entitlement configuration to Settings for entitlement check
Tethering resource configuration is move from framwork to tethering
module. Since tethering resource would not be accessible from outside
of tethering module, EntitlementManager would tell Settings the
entitlement configuration via intent extra when run entitlement check.

Bug: 146918263
Test: atest TetheringTests
Change-Id: I6f23553bb1da5f0b767f920b32a86fafb9e00b9e
Merged-In: I6f23553bb1da5f0b767f920b32a86fafb9e00b9e
2020-06-20 10:19:21 +08:00
Mark Chien
ac8445ca3b Merge "Let only Ethernet manage ethernet interface up and down" 2020-06-19 05:55:35 +00:00
Milim Lee
9807816e09 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
Change-Id: I1cd40ae764bdeecbb59e3889e9399b7f4b05f9cc
2020-06-19 12:44:22 +09:00
Treehugger Robot
3fd7eb2154 Merge "Test that IpNeighborMonitor is stopped when IpServer stops." 2020-06-19 02:36:06 +00:00
Lorenzo Colitti
4cc7532355 Merge "Memory leak due to no stop for IpNeighborMonitor." 2020-06-18 15:57:01 +00:00
Lorenzo Colitti
00ea6cecd8 Test that IpNeighborMonitor is stopped when IpServer stops.
Bug: 159097215
Test: test-only change
Change-Id: I2292c1cbff06a304f70191b88d833b19af2b8b92
2020-06-18 23:51:56 +09:00
h.zhang
d244bd097c 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
Change-Id: I8f60c13706f05306e8f25a15f7861d7ecabbc10e
2020-06-18 23:51:16 +09:00
Treehugger Robot
51a573cd07 Merge "Add owneship of tethering module" 2020-06-18 06:14:44 +00:00
markchien
c907a99efd 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

Change-Id: I13b291e5db6a8a8c9f2bfa477acabaea250aa48c
2020-06-18 11:34:29 +08:00
Hungming Chen
bfdcfe4ecd [BOT.13] Make offload coordinator poll interval configurable
Bug: 150736748
Test: BpfCoordinatorTest
Change-Id: I7f8dde3b57ee14eb33edbe2fd383df33cccc231c
2020-06-16 18:01:24 +08:00
Hungming Chen
8b3af8d775 [BOT.12] Add unit test for disabling BpfCoordinator by config
Bug: 150736748
Test: BpfCoordinatorTest
Change-Id: Iedb936b7592b6be773d1b84a2498bfc5a440a198
2020-06-16 18:01:17 +08:00
Hungming Chen
519f1201ca [BOT.11] BpfCoordinator could be disabled by device config
Bug: 150736748
Test: BpfCoordinatorTest
Change-Id: Id413b7f2f7edb2e5c3e02d5677fe536ed52fbbcb
2020-06-15 21:16:26 +08:00
Hungming Chen
e571cfd53f [BOT.8] Dump BPF offload information in dumpsys
$ adb shell dumpsys tethering
BPF offload:
  Polling started
  Stats provider registered
  Upstream quota: {rmnet_data2=9223372036854775807}
  Forwarding stats:
    12(rmnet_data2) - ForwardedStats(rxb: 1065, rxp: 5, txb: 0, txp: 0)
  Forwarding rules:
    [wlan1]: iif(iface) oif(iface) v6addr srcmac dstmac
      12(rmnet_data2) 31(wlan1) /2401:e180:8831:77ae:a900:a03b:41fb..

Bug: 150736748
Test: Enable tethering on mobile data and check dumpsys tethering
Change-Id: I95ea3050d92f3ba8136a63cd399d3450d183c8dc
2020-06-15 21:14:28 +08:00
Hungming Chen
47f7a44350 [BOT.10] Add unit test for data limit and rule change in BpfCoordinator
The applying data limit is based on the forwarding rule changes.
Add the tests for verifying their interactions with netd.

Bug: 150736748
Test: BpfCoordinatorTest
Change-Id: I5a98c4cd74e2de6005ee05defa761f6af3fd4e75
2020-06-11 19:53:36 +08:00
Treehugger Robot
7e6ff1bde1 Merge "Address comment from aosp/1232197" 2020-06-09 17:19:33 +00:00
Treehugger Robot
73dd6f71f8 Merge "[BOT.6] Make BpfCoordinator to support data limit" 2020-06-09 12:58:20 +00:00
Hungming Chen
269c0886ed [BOT.6] Make BpfCoordinator to support data limit
The BPF tethering coordinator listens to the forwarding rule
changes for updating data limit which is applied in the following
conditions.
- After adding the first rule on a given upstream, add data limit.
- After removing the last rule on a given upstream, clear data limit.
- The service applies a new data limit on current upstream.

The reason for relying on rule changes is because the Tethering and
IpServer objects have multi-internal state machines. It is hard to
synchronize all of their states.

Note that the data limit cleanup for stopping or switching upstream
relies on offload rules are all removed as well.

Bug: 150736748
Test: manual
Change-Id: I829d36339973f9473fe6b616c48aa288f18d1c46
2020-06-09 17:33:03 +08:00
Mark Chien
597265fa13 Merge "Move TetheringTests to presubmit" 2020-06-09 08:48:13 +00:00
Lorenzo Colitti
fd349683c9 Merge "[BOT.9] Add unit test for data warning in BpfCoordinator" 2020-06-09 02:22:59 +00:00
Lorenzo Colitti
cdf210fd71 Merge "[BOT.4] Make BpfCoordinator to support data warning" 2020-06-09 02:22:43 +00:00
Paul Hu
51241a168c Merge "Make tether settings intent explicit" 2020-06-08 10:31:21 +00:00
Hungming Chen
b1406cf0d6 [BOT.9] Add unit test for data warning in BpfCoordinator
Bug: 150736748
Test: atest BpfCoordinatorTest
Change-Id: Ic1f37de75b064d7c8717e1b496e13174bb8693ec
2020-06-08 17:31:51 +08:00
Hungming Chen
c42a0ffc0d [BOT.4] Make BpfCoordinator to support data warning
Invoke the existing polling thread to update data alert statistics.
Once the data alert limit has reached, trigger the notification.

Bug: 150736748
Test: BpfCoordinatorTest
Change-Id: Ibf25560ca2e9f003d8eba01361dc7d35ec1b1627
2020-06-08 17:31:34 +08:00
paulhu
3fe5434d19 Make tether settings intent explicit
Currently tethering notification is sending a pending intent for
redirecting user to tether settings page. However, this intent
is implicit that only create with
Settings.ACTION_TETHER_SETTINGS. For security reasons, this
intetnt should specify an explicit component to be delivered to.
Thus, specify the settings package name to this intent.

Test: atest TetheringTests
Bug: 156353008
Change-Id: I49187aee8a004caa890e2a73c0a28d280215c7d4
2020-06-08 06:04:19 +00:00
Xin Li
d56d89c8a6 Merge QQ3A.200605.002 into master
Bug: 158095402
Merged-In: I5e28537689d1a53e99f91eafd494eb3a0c890f46
Change-Id: I436ef37a509cbe56d02c6d8d3a38c776f4b4883f
2020-06-03 10:45:02 -07:00
Maciej Żenczykowski
22238ed86f Merge "Stop reducing RA advertised ipv6 mtu by 16 - not needed." am: cfacebd651
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1322377

Change-Id: I5e28537689d1a53e99f91eafd494eb3a0c890f46
2020-06-03 05:32:55 +00:00
Maciej Żenczykowski
cfacebd651 Merge "Stop reducing RA advertised ipv6 mtu by 16 - not needed." 2020-06-03 05:21:45 +00:00
Maciej Żenczykowski
f99d2a103d Stop reducing RA advertised ipv6 mtu by 16 - not needed.
This effectively reverts:

  commit da0fb1bca8
  Author: Maciej Żenczykowski <maze@google.com>
  Date:   Wed Feb 19 01:24:39 2020 -0800

      Reduce advertised ipv6 mtu by 16 to fit ethernet header

      This is a temporary hack to workaround the inability of current
      kernel's ebpf bpf_skb_change_mode() function to prefix a 14-byte
      ethernet header on to a packet without going over the upstream
      (source, rawip) interface's mtu *before* we bpf_redirect() to
      the downstream (destination, ethernet) interface.

      Test: build, atest, atest TetheringTests
      Bug: 149816401

Test: flashed a flame with new kernel and it works at 1500 mtu
Bug: 149816401
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I76a75a16fa27b47d78816b2f9379ef4bb68beb00
Merged-In: I76a75a16fa27b47d78816b2f9379ef4bb68beb00
2020-06-02 22:20:39 -07:00
Paul Duffin
5b8f3bede8 Merge "Switch to standard naming scheme" am: b04aea2791
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1322775

Change-Id: Ic1b75b3a6cd0db02d485ecd2ed3939d9faca8200
2020-06-02 19:41:30 +00:00
Paul Duffin
94261519be Merge "Clean up the visibility rules for framework modules" am: 415e2387ae
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1322774

Change-Id: If3a3993f35d4eb09aee4ab4ff04cd41c4d9c28ab
2020-06-02 19:41:03 +00:00
Paul Duffin
dfc7fb7f75 Switch to standard naming scheme
Removes use of the special framework-modules naming scheme.

Bug: 155164730
Test: m java
Exempt-From-Owner-Approval: Build cleanup.
Change-Id: I3896d7c91e937f503b49f5df011c21ee51219652
Merged-In: I0c31e2183353dfb5bd49f04f3455cb7b10be6866
Merged-In: I3b78fcbcacc3df787e171d6eedeef1e51b087615
(cherry picked from adac7d2cc3)
2020-06-02 14:15:28 +00:00
Paul Duffin
2a8d380f40 Clean up the visibility rules for framework modules
Switching from java_library to java_sdk_library switched the meaning
of the module name from referring to the implementation library to
referring to the stubs. This change updates the visibility rules to
reflect that new meaning.

Visibility rules that were previously set for the java_library have
been moved to the impl_library_visibility property and the special
//visibility:override value has been prepended to prevent it from
inheriting the values from the visibility property.

Visibility rules set for the stubs (via stubs_library_visibility)
property have been moved to the visibility property.

Bug: 155164730
Test: m nothing
Exempt-From-Owner-Approval: Build cleanup
Change-Id: Icc9bc5a9ef86cf7ba0f15c2b2a4abd596ec9f640
Merged-In: Icc9bc5a9ef86cf7ba0f15c2b2a4abd596ec9f640
(cherry picked from a17cf677b5)
2020-06-02 11:41:07 +01:00
Treehugger Robot
dc1e33c9b3 Merge "Gate exemptFromEentitlementCheck by Network_STACK permission" am: 650c23fdc2
Original change: undetermined

Change-Id: I7dc479b54bbcb511b68a59d6f70f880e32c309bc
2020-06-02 03:48:14 +00:00