Commit graph android_packages_modules_Co.../core/java
Message SHA1
Revert "Revert "Move Inet[4]AddressUtils to libs/net""
This patch is still needed and should go in now that the
error is fixed.
The patch was submitted into rvc-dev and is already in
rvc-dev-plus-aosp (patch in in ag/11923559, revert
skipped in ag/12072199). A follow-up will remove the
unused services.net-module-wifi target.

Test: originally tested in aosp/1324109
Test: m; manual: flashed, wifi and telephony working
Test: atest NetworkStackCoverageTests
Change-Id: I1074eedb0b0f156a1135e11210ec102de15ea674
Merged-In: Icd141a992c46290c74929785e261a1cd57bc001b

Chalard Jean   commited 2020-08-07 03:31:04 +00:00
059356d83f
Merge "Gracefully handle integer overflows."
Junyu Lai   authored and   Gerrit Code Review   commited 2020-07-29 01:19:07 +00:00
cdb1f03144
Merge "Update language to comply with Android's inclusive language guidance"
Chiachang Wang   authored and   Gerrit Code Review   commited 2020-07-28 10:51:53 +00:00
f702025bdf
Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code
for reference.

Bug: 161896447
Test: m
Change-Id: I6c3c03c0c2d1302af6d5245486823c13a3432900

Chiachang Wang   commited 2020-07-28 15:36:30 +08:00
3b9549f408
Gracefully handle integer overflows.
Avoid recording negative data by doing integer-based
math as much as possible, but switch to double-based
math if we detect that we'd end up causing an overflow.

Test :

    - Builds, Boots
    - High data throughput scenarios
    - NetworkStatsHistoryTest, NetworkStatsCollectionTest,
      NetworkStatsTest

Bug: 119527458
Change-Id: I55d4aa649bea3ae201ad513074ff2b71cb918dad

Pavan Kumar M   commited 2020-07-28 11:36:49 +05:30
e55ab87e5d
Merge "Remove ProxyInfo(String) and update callers to use ProxyInfo(Uri)"
Aaron Huang   authored and   Gerrit Code Review   commited 2020-07-17 05:40:31 +00:00
c36f17d32e
Remove ProxyInfo(String) and update callers to use ProxyInfo(Uri)
Update all callers to use ProxyInfo(Uri) and remove ProxyInfo(String).

Bug: 160557668
Test: build pass
      atest FrameworksNetTests

Change-Id: I4c980764c8839c48acf03208bb68cd53eb910121

Aaron Huang   commited 2020-07-06 11:59:27 +00:00
ffb76492e0
Add some more public doc for MacAddress
Bug: 140807677
Test: doc-only change
Change-Id: I0f6e59eda42fd92ec34db0e9bc2d26d2e83d41d0

Chalard Jean   commited 2020-07-04 09:01:58 +09:00
ded38fda42
Revert "Move Inet[4]AddressUtils to libs/net"
This reverts commit c98e38195d.

Reason for revert: Breaks the build b/160390899

Merged-In: Icd141a992c46290c74929785e261a1cd57bc001b
Change-Id: Ie10e66f61393602f17fbb61bf17230b176bf1f44

Chalard Jean   authored and   Remi NGUYEN VAN   commited 2020-07-02 23:47:35 +00:00
064d18d188
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

Remi NGUYEN VAN   commited 2020-07-02 10:52:31 +09:00
c98e38195d
Merge "Disable sockets and DNS if process lacks INTERNET permission."
Luke Huang   authored and   Gerrit Code Review   commited 2020-06-24 18:42:08 +00:00
9f5ade331a
Disable sockets and DNS if process lacks INTERNET permission.
This is a Client-only solution.
  - Add to NetdClient a per-process std::atomic_boolean
    similar to netIdForProcess and netIdForResolv.
  - The boolean says whether the process should be
    allowed Internet connectivity.
  - Add an @hide method to NetUtils.java to set the boolean;
    call it from the initialization code of the new
    process just after forking from zygote.
  - Make netdClientSocket and dnsOpenProxy check the
    boolean. If the boolean is false, return EPERM from
    socket calls.

Bug: 150028556
Test: atest NetworkUtilsTest
Test: atest CtsAppSecurityHostTestCases:UseProcessTest
(cherry-pick from internal branch, ag/11881939)
Merged-In: If002280fbad493dfc2db3d9d505c0257d49a9056
Change-Id: If002280fbad493dfc2db3d9d505c0257d49a9056

Luke Huang   commited 2020-06-24 11:58:57 +00:00
caaee1d0ec
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

Luke Huang   commited 2020-06-24 11:32:26 +00:00
ff0dc5cf49
Merge "Treat RouteInfo with different interfaces as different routes"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-06-17 12:51:08 +00:00
d77e15c125
Treat RouteInfo with different interfaces as different routes
On Android different interfaces usually use different routing tables.
As a result, a change in interface should not be treated as route
update, but rather a remove and an add.

This change fixes a bug in VPN seamless handover where routes
failed to be updated when a new tunnel interface replaces the existing
one within the same network.

Bug: 158696878
Test: atest com.android.cts.net.HostsideVpnTests
Test: atest NetworkStackTests
Test: atest CtsNetTestCases
Test: atest FrameworksNetTests
Change-Id: I57987233d42a0253eaee2e1ca5f28728c2354620

Rubin Xu   commited 2020-06-17 12:01:41 +01:00
bc4c5caa4f
Merge "Set correct owner UID for VPN agentConnect()"
Benedict Wong   authored and   Gerrit Code Review   commited 2020-06-15 17:09:46 +00:00
2f7bb517fd
Merge "Document the limitation to a hundred callbacks."
Chalard Jean   authored and   Gerrit Code Review   commited 2020-06-11 12:31:09 +00:00
f60ed54d33
Document the limitation to a hundred callbacks.
Some developers have been surprised by this limitation and had trouble
figuring out what the issue was. Add documentation to address this.

This also includes a drive-by removal of a duplicate check.

Bug: 149867479
Test: doc-only change
Change-Id: I5911d01984695550b6c9afe7a8eb535bf5e320a1

Chalard Jean   commited 2020-06-11 12:30:21 +00:00
a5ff113bff
Cleanup config_mobile_hotspot_provision_app usage
config_mobile_hotspot_provision_app would be move out of framework and
only private for tethering only.
enforceTetherChangePermission is no longer needed because its only
caller PanService already gate by other privileged permission
(BLUETOOTH_PRIVILEGED).

Bug: 146918263
Test: m

Change-Id: I030871c2bc46bc09c4e52970b4995f98d31bb90e

markchien   authored and   Mark Chien   commited 2020-06-10 15:52:24 +00:00
e9aad6fa2b
Set correct owner UID for VPN agentConnect()
This commit changes agentConnect to set the owner UID as the mOwnerUid
field instead of the Binder.getCallingUid().

Binder.getCallingUid() can return incorrect results for platform VPNs,
as agentConnect() is called under a clean calling UID.

Additionally, this relaxes the ownerUid sanitization check to allow a
VPN network's owner to see it's own ownership information.

Vpn.mOwnerUid is guaranteed to be correct, as all VPNs MUST have called
prepareInternal() at some previous point, which sets mOwnerUid as the
package's UID (or SYSTEM_UID if this is legacy VPN).

Bug: 150135470
Test: CTS tests showing ownership information
Change-Id: Ic979dad73983d722365849fbfb0becfd432b894c

Benedict Wong   commited 2020-06-08 14:33:01 -07:00
bf004e9830
Merge "Update javadoc to use complete sentence"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-06-05 03:02:36 +00:00
d3068f93c3
Update javadoc to use complete sentence
Avoid using the "iff" abbreviation in our Javadoc.

Bug: 158092978
Test: m doc-comment-check-docs and check the generated doc
Change-Id: I41bf8a6ddad200f00524d9b2dd1bf169810ee460

Chiachang Wang   commited 2020-06-04 07:46:14 +00:00
8b60559b7e
Update extra info before registering
The extra info is taken into NetworkMonitor from while creating
it. The NetworkMonitor is created when a new agent is registered
but the extra info is not available at that time. Make sure the
field is set in the NetworkInfo when registering.

Bug: 156173829
Test: adb shell dumpsys network and check the apn in the extra
      info shown correctly
Test: atest FrameworkNetTests
Change-Id: Ieaad8cbf1a28af3b97c7f98f74358e417fcad661

Chiachang Wang   commited 2020-06-03 13:01:01 +08:00
9774ceb3ea
Allow TRANSPORT_TEST ethernet networks
Ethernet networks using tap interfaces should have TRANSPORT_TEST so
they are not considered by network selection.

Test: atest CaptivePortalApiTest FrameworksNetTests
Bug: 156319532
Change-Id: I0d9477977c88aa055625ab4046577a41e76b05ff

Remi NGUYEN VAN   commited 2020-05-29 10:22:50 +09:00
656c566cf1
Forward unknown Data Stall types to Connectivity Diagnostics.
This CL forwards suspected Data Stall events detected with unknown
detection methods to ConnectivityDiagnostics.

Currently, ConnectivityService drops any data stall events with unknown
detection methods, which leads to false negatives for Connectivity
Diagnostics registrants. This change ensures that registrants will still
be notified as NetworkStack is updated to use new detection methods.

The documentation for ConnectivityDiagnosticsManager#DataStallReport is
also updated to reflect that the detection methods included in the
report are a bit mask of detection methods used. Implicitly, this means
that data stalls detected via unknown methods will have an empty bit
mask (0x00).

Bug: 156294356
Test: atest ConnectivityDiagnosticsManager
Change-Id: I62d0bf91fcc17c7921afd519c72551399906bd6b

Cody Kesting   commited 2020-05-19 10:57:29 -07:00
b37958eec9
Merge "Create TestApi for simulating a Data Stall on ConnectivityService."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-05-12 16:52:35 +00:00
e743a30aa7
Merge "Set owner and administrator UIDs for test networks."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-05-12 16:52:07 +00:00
2ba1b8ecd1
Added a new capability for temporarily unmetered network.
Added a new network capability TEMOPORARILY_NOT_METERED to support
the case that a network can temporarily become unmetered. This
allows carriers to deploy unmetered 5G network. When devices
camp on 5G network, this capability will be dynamically added
to the network and will be removed once leaving 5G coverage.

Bug: 153081494
Test: Manual
Change-Id: I10e26cb0852e67f614e7b9c4e49f95e078602e21
Merged-In: I10e26cb0852e67f614e7b9c4e49f95e078602e21

Jack Yu   authored and   Sarah Chin   commited 2020-05-06 13:13:45 -07:00
0298306ba0
Create TestApi for simulating a Data Stall on ConnectivityService.
This change adds a TestApi for simulating a Data Stall to
ConnectivityService. This allows for Data Stalls to be triggered without
having to manipulate the signals used by NetworkMonitor . This also
allows NetworkMonitor to update the ways it detects Data Stalls without
affecting CTS tests for ConnectivityDiagnosticsManager.

Bug: 148032944
Test: atest ConnectivityDiagnosticsManagerTest
Change-Id: Icad439efa2ab4c872c21d3ee6ceaae8c5b49f18d

Cody Kesting   commited 2020-04-27 20:55:00 -07:00
f53a075913
Set owner and administrator UIDs for test networks.
This change sets the owner and administrator UIDs for test networks when
their initial values match the UID for the app creating the test
network. This ensures that apps registering test networks can only make
themselves owners / administrators of the network.

Bug: 153449964
Test: atest NetworkAgentTest
Change-Id: I3a974700aa1d83cb285295ed1de0aa263e2e5b58

Cody Kesting   commited 2020-04-27 20:54:57 -07:00
fc7cad313d
Set attributionTag for noteOp(WRITE_SETTINGS) calls
Test: atest FrameworksNetTests TetheringTests:TetheringServiceTest
Bug: 136595429
Merged-In: I33f787644c44d7b0e5ce17a433820cfcd985cdfb
Change-Id: Ic3d937e7bb5141798234ed5b2852c1f768e97495

Philip P. Moltmann   commited 2020-04-20 18:00:03 -07:00
7bc33dfb89
Allow testing of signal strength
- Let any process with NETWORK_SETTINGS register for signal strength
  wakeup.
- Allow agents registering test networks to assign them a signal
  strength.

Test: NetworkAgentTest
Bug: 139268426
Change-Id: I2b4b89be3e69f4853fd6978d2c8f5c8eb4271f21

Chalard Jean   commited 2020-04-13 21:55:32 +09:00
6b59b8fbcc
Add instrumentation to test NetworkAgent.
Test: NetworkAgentTest, new tests using this API
Bug: 139268426
Change-Id: Ia83b1c896df63bb18e2aa4b74d6cc09eba990eb5

Chalard Jean   commited 2020-04-13 15:44:07 +09:00
be9447be58
Fix a theoretical NPE
Test: NetworkAgentTests
Bug: 153718627
Change-Id: I08f57cce0cd85d5cd66e9a0ef948224290e9200e

Chalard Jean   commited 2020-04-10 23:08:00 +09:00
35a06972cc
Merge "Fix a stupid NPE"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-04-07 05:53:10 +00:00
16f4882784
Fix a bug where the legacy extra info is reset on connect.
Bug: 149459996
Test: NetworkAgentTest FrameworksNetTests FrameworksWifiTests FrameworksTelephonyTests
Change-Id: I5f8f6d962ee3317e101d19518c767b3c327c0c47

Chalard Jean   commited 2020-04-06 12:46:19 +09:00
56c327341e
Fix a stupid NPE
Okay so this is really not a behavior change as it converts an
NPE into an illegal argument exception, but still, that's what
should happen (and that's what the upcoming test actually tests
for).

Test: upcoming NetworkAgentTest
Bug: 139268426
Change-Id: I3e17211c03bc74426bf5e2e414ec322d73b0060b

Chalard Jean   commited 2020-04-03 07:17:13 +09:00
380318053b
Merge changes from topics "api-fix-networkagent", "satisfiedby"
* changes:
  Rename satisfiedBy into canBeSatisfiedBy
  Address further API council comments.

Chalard Jean   authored and   Gerrit Code Review   commited 2020-04-02 05:51:02 +00:00
9122e56202
Merge "Only apply VPN isolation if it's fully routed"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-04-02 04:10:12 +00:00
5c5d1a1282
Rename satisfiedBy into canBeSatisfiedBy
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I076876a6662bde143ef7d315ce3767acafff93c1
Merged-In: I076876a6662bde143ef7d315ce3767acafff93c1

Chalard Jean   authored and   Aaron Huang   commited 2020-04-01 20:38:30 +08:00
c62f9a53d8
Only apply VPN isolation if it's fully routed
VPN is considered fully routed if both IPv4 and IPv6 have
either a default route or a prohibit route.

Bug: 145332510
Test: atest FrameworksNetTests
Change-Id: I59cf48552bca98092d1212e3d718fd420add5458

Rubin Xu   commited 2020-04-01 09:36:29 +01:00
ab8cf306ea
Address further API council comments.
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Copy from ag/10866511
Change-Id: I8a785ae0e74e659c317deaaa28c203356c7766ed
Merged-In: I8a785ae0e74e659c317deaaa28c203356c7766ed

Chalard Jean   authored and   Aaron Huang   commited 2020-04-01 16:01:04 +08:00
691a34d96b
Merge changes from topics "networkagent_api", "networkprovider_api"
* changes:
  Update the NetworkProvider API for council comments
  Update NetworkAgentConfig API for council comments
  Update the NetworkAgent API for council comments

Aaron Huang   authored and   Gerrit Code Review   commited 2020-04-01 05:33:28 +00:00
f210e24871
Merge "Clarify comments for Connectivity Diagnostics reports."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-31 17:43:44 +00:00
87ce14f328
Merge "Sort administrator UIDs for NetworkCapabilities."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-31 17:43:02 +00:00
c350963548
Merge "Add combine() and equals() for NetworkCapabilities admin UIDs."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-31 17:42:18 +00:00
e4df39ba4b
Update the NetworkProvider API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Copy from ag/10826397
Change-Id: I6b086572cfc72a0727f4510351cff0e74cbc4302
Merged-In: I6b086572cfc72a0727f4510351cff0e74cbc4302

Chalard Jean   authored and   Aaron Huang   commited 2020-03-31 11:57:59 +00:00
5f12f81206
Update NetworkAgentConfig API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Copy from ag/10826396
Change-Id: Idca9f243a5c955f4caa30921ee520e1a93b0d11a
Merged-In: Idca9f243a5c955f4caa30921ee520e1a93b0d11a

Chalard Jean   authored and   Aaron Huang   commited 2020-03-31 11:51:05 +00:00
aea539a13e
Update the NetworkAgent API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Copy from ag/10824609
Change-Id: I9a2691f783f4449348c3f767568e05620f0b9df5
Merged-In: I9a2691f783f4449348c3f767568e05620f0b9df5

Chalard Jean   authored and   Aaron Huang   commited 2020-03-31 11:34:42 +00:00
f5d1bfd77f
Merge "Invoke onConnectivityReport on registering ConnectivityDiagnostics."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-31 00:06:26 +00:00
a365c81bfa