Commit graph

8,674 commits

Message SHA1
Invoke onConnectivityReport on registering ConnectivityDiagnostics.
This change updates the behavior for registering
ConnectivityDiagnosticsCallbacks. Now, after a successful register()
call, callbacks will receive cached ConnectivityReports for all
matching, permissioned networks. This allows registrants to be updated
with the network state for their networks without having to wait for the
next network validation.

Bug: 147849853
Test: atest FrameworksNetTests
Change-Id: I924ba8fdcc847f453557021591bde38602fe089c
Merged-In: I924ba8fdcc847f453557021591bde38602fe089c
(cherry picked from commit 95ec0b206b759e1d26bc1dbb2255a515bb24358a)

Cody Kesting   commited 2020-03-30 17:13:55 -07:00
1bee2ea867
Clean up handling of NetworkCapabilities#administratorUids.
Update ConnectivityService's check for administrator UIDs to use
ArrayUtils to check for UID inclusion. Update the NetworkCapabilities
annotation on the administrator UIDs field to clarify that it is
NonNull.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: Id630fe9d76aacdaf038fdaa5360f0327520ee0c3
Merged-In: Id630fe9d76aacdaf038fdaa5360f0327520ee0c3
(cherry picked from commit 898496365aa1f3601cdbb305004ad0de11ff6bfc)

Cody Kesting   commited 2020-03-30 17:13:37 -07:00
5a4b20d623
Merge "Add CTS tests for ApfCapabilities static APIs." into rvc-dev
Xiao Ma   authored and   Android (Google) Code Review   commited 2020-03-30 07:46:30 +00:00
ac27736c5b
Add CTS tests for ApfCapabilities static APIs.
Add tests for getApfEtherTypeBlackList and getApfDrop8023Frames APIs.

Bug: 150640397
Test: atest CtsNetTestCasesLatestSdk:android.net.apf.ApfCapabilitiesTest
      on both of Q and R devices.

Change-Id: I11555934df4b27cbb6b7ddbb81022d8fb7c25e15
Merged-In: I11555934df4b27cbb6b7ddbb81022d8fb7c25e15
(cherry picked from commit 7d51a72487dba5b2747a9de12f50ba2087007264)

Xiao Ma   authored and   Lorenzo Colitti   commited 2020-03-30 05:41:02 +00:00
e43c74d97e
Unbreak testStartUsingNetworkFeature_enableHipri failure
aosp/1261619 break legacy API that only supported for SDK which is
smaller than android M, caller need to have network stack permission
to request network with legacy type. Fix failure by whitelist permission
check for the caller who built with order SDK(< M).

Bug: 152229492
Test: atest CtsTetheringTest
      atest ConnectivityManagerLegacyTest# \
      testStartUsingNetworkFeature_enableHipri

Change-Id: I02504c0eed10ee4e08c8fbf032951022255ba5fa
Merged-In: I367dff0429f26f266282300edc38637b55eece38
(cherry picked from commit b1c8acf0d6ba1fe35d8e81673d2c5c24fa2fea79)

Mark Chien   commited 2020-03-30 02:26:57 +00:00
41a28cae9d
Merge changes from topic "phonestatelistener-limit-rvc-dev" into rvc-dev
* changes:
  Add gating, logging for PhoneStateListener's limit
  Institute limit on PhoneStateListener

Hall Liu   authored and   Android (Google) Code Review   commited 2020-03-28 06:48:56 +00:00
9a5e26ef77
Add gating, logging for PhoneStateListener's limit
Add gating via PlatformCompat and DeviceConfig and logging via
PlatformCompat to the limit instituted on per-process listeners

Fixes: 152074216
Test: atest CtsTelephonyHostCases
Change-Id: I4d6681d90705b68c3349f4124e434a29b50fd3a2

Hall Liu   commited 2020-03-27 19:21:51 -07:00
2ca7c9a422
Merge changes from topics "api-fix-networkagent", "networkprovider_api", "satisfiedby" into rvc-dev
* changes:
  Rename satisfiedBy into canBeSatisfiedBy
  Address further API council comments.
  Update the NetworkProvider API for council comments

Chalard Jean   authored and   Android (Google) Code Review   commited 2020-03-27 22:50:42 +00:00
f7c2921f91
Merge "Clean up unit testing for ConnectivityDiagnostics." into rvc-dev
Cody Kesting   authored and   Android (Google) Code Review   commited 2020-03-27 19:09:00 +00:00
fc0eed5aa6
Merge "Restrict VPN Diagnostics callbacks to underlying networks." into rvc-dev
Cody Kesting   authored and   Android (Google) Code Review   commited 2020-03-27 18:22:20 +00:00
488c8e4734
Rename satisfiedBy into canBeSatisfiedBy
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I076876a6662bde143ef7d315ce3767acafff93c1

Chalard Jean   commited 2020-03-27 23:46:30 +09:00
e693268f50
Address further API council comments.
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I8a785ae0e74e659c317deaaa28c203356c7766ed

Chalard Jean   commited 2020-03-27 17:57:24 +09:00
c882f64b3c
Update the NetworkProvider API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Change-Id: I6b086572cfc72a0727f4510351cff0e74cbc4302

Chalard Jean   commited 2020-03-27 17:53:05 +09:00
4c7368a340
Merge changes from topic "networkagent_api" into rvc-dev
* changes:
  Update NetworkAgentConfig API for council comments
  Update the NetworkAgent API for council comments

Chalard Jean   authored and   Android (Google) Code Review   commited 2020-03-27 06:20:37 +00:00
6d25213263
Update NetworkAgentConfig API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Change-Id: Idca9f243a5c955f4caa30921ee520e1a93b0d11a

Chalard Jean   commited 2020-03-25 22:43:13 +09:00
74fe1c7205
Update the NetworkAgent API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Change-Id: I9a2691f783f4449348c3f767568e05620f0b9df5

Chalard Jean   commited 2020-03-25 22:35:41 +09:00
cb4711edd8
Allow MANAGE_TEST_NETWORKS to register limited agents
This puts in force some restrictions against test networks,
and in exchange relaxes the restrictions around registering
a network agent that provides a test network.
Test networks can only ever have transport TEST, and have
only a few capabilities available to them.

This is useful in particular to test CTS. See aosp/1253423
for first, basic usage of this capability.

Test: IpSecManagerTunnelTest
Test: new CTS aosp/1253423
Bug: 139268426

Change-Id: Ibd162792a7ab02fcbb06130f21a825a386678c05
(cherry picked from commit 2c129e97cca2234ee6dd079a9c07df0c530d8b36)

Chalard Jean   commited 2020-03-25 10:43:26 +00:00
136a2fe2a6
API review: make exception class and Builder final
- InvalidPacketException exception class should be final
- NetworkCapabilities.Builder should be final

Bug: 152203926
Test: atest FrameworksNetTests
Change-Id: If9b799151aff6d41c9bcd8bb86c65a58e46bad73

Aaron Huang   commited 2020-03-25 13:36:38 +08:00
1d4b09a9fa
Merge "Fix NetworkCapabilitiesTest fail on Q device" into rvc-dev
Lucas Lin   authored and   Android (Google) Code Review   commited 2020-03-25 02:00:35 +00:00
b3d186dda8
Fix NetworkCapabilitiesTest fail on Q device
The getSSID() has changed to getSsid() in Android R, adding
isAtLeastR() to prevent NetworkCapabilitiesTest fail on Android
Q.

Bug: 151322799
Test: Run "atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest"
      on Android Q & R device.
Change-Id: I602ae32dae1ad29fe3293c541fa6d2cef01b81d3

lucaslin   commited 2020-03-24 19:00:09 +08:00
e0bf23d34f
Fix addRoute replace default route unexpectedly
In aosp/1203789, if two routes are with the same destination,
it will be replaced instead of added when calling addRoute.
This breaks scenarios which rely on the ability to add multiple
default routes, such as multiple IPv6 default routes learned
via address autoconfiguration.

This change treats the route is an update if the destination
and nexthop are the same, but different in other properties.

Test: atest OffloadControllerTest#testSetUpstreamLinkPropertiesWorking
Test: atest LinkPropertiesUtilsTest#testLinkPropertiesIdenticalEqual
Test: atest ConnectivityServiceTest#testStackedLinkProperties
Test: atest ConnectivityServiceTest#testRouteAddDeleteUpdate
  (only directly related tests are listed)
Fix: 152170074
Fix: 151911339
Bug: 142892223

Change-Id: I7153ec9866f14a109ba8155c905e5d9e4f85eb64
Merged-In: I7153ec9866f14a109ba8155c905e5d9e4f85eb64
(cherry picked from commit 11aa9cb44aee289329b306cfc51a73cfe1456b61)

Treehugger Robot   authored and   Junyu Lai   commited 2020-03-24 08:41:44 +00:00
77a77390cb
Clean up unit testing for ConnectivityDiagnostics.
Connectivity Diagnostics included an unnecessary try-catch for verifying
that the permissions check for invoking ConnectivityDiagnosticsCallbacks
doesn't throw when the uid and package name do not match.

Bug: 149119324
Test: atest FrameworksNetTests
Change-Id: Ie302b1f4f437e819fdd15ec28adb0b56750c2c53
Merged-In: Ie302b1f4f437e819fdd15ec28adb0b56750c2c53
(cherry picked from commit 66b5e081b785a3b7e2a032342d4d424905581cf9)

Automerger Merge Worker   authored and   Cody Kesting   commited 2020-03-23 17:35:15 -07:00
aa7f80a5d8
Restrict VPN Diagnostics callbacks to underlying networks.
ConnectivityDiagnosticsCallbacks should only be invoked for the
underlying networks declared by active VPNs. This encourages VPN apps to
declare their underlying networks.

The previous permission model for VPNs allowed active VPNs to receive
callbacks on any network.

Bug: 148903617
Test: atest FrameworksNetTests
Change-Id: Ic08cdd2e2532580fda0fd3034e2bdff27e0ff84b
Merged-In: Ic08cdd2e2532580fda0fd3034e2bdff27e0ff84b
(cherry picked from commit e1f0c56f74593d3781bfa4ee4871a5efbabe303c)

Cody Kesting   commited 2020-03-23 17:35:15 -07:00
e14e1869aa
Merge "API review: access field by method" into rvc-dev
Aaron Huang   authored and   Android (Google) Code Review   commited 2020-03-20 11:09:43 +00:00
854250037c
Merge "Create a builder for NetworkCapabilities." into rvc-dev
Junyu Lai   authored and   Android (Google) Code Review   commited 2020-03-20 11:03:47 +00:00
448b243f52
Merge "Expose netId by adding getter API" into rvc-dev
Junyu Lai   authored and   Android (Google) Code Review   commited 2020-03-20 11:03:05 +00:00
21da2b6432
Merge "Make Ethernet interfaces more testable." into rvc-dev
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2020-03-19 14:31:57 +00:00
7f11f2d84f
Merge "Move NetworkCallback to last parameter for new exposed requestNetwork" into rvc-dev
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2020-03-19 13:40:51 +00:00
b6c84e985d
Create a builder for NetworkCapabilities.
Bug: 151322799
Test: FrameworksWifiTests
Change-Id: I06eb97e50d5583579b3c26d1365d2dbaec8bfc99

Chalard Jean   commited 2020-03-19 21:55:57 +09:00
dfcbc07b3e
Make Ethernet interfaces more testable.
This CL adds a setIncludeTestInterfaces method to EthernetManager
that, when called, causes the Ethernet service to recognize and
manage test interfaces created by TestNetworkManager.

Bug: 150644681
Test: Tested by EthernetTetheringTest in same topic
Change-Id: I86eef7a93267f800dbfc8eafd307effa76a344ca
Merged-In: I86eef7a93267f800dbfc8eafd307effa76a344ca
(cherry picked from commit 3410fb0aa92bbd4f9d7dc031e89f6f528ff34245)

Lorenzo Colitti   commited 2020-03-19 12:30:39 +00:00
8687436656
Merge "TetheringManager API clean up" into rvc-dev
Mark Chien   authored and   Android (Google) Code Review   commited 2020-03-19 12:04:05 +00:00
3da1e71044
Move NetworkCallback to last parameter for new exposed requestNetwork
Bug: 151243698
Test: atest TetheringTests
Change-Id: I87ef1d451eefa6998b9793c4eacabae978376d24

markchien   commited 2020-03-19 19:10:23 +08:00
0fe1140651
TetheringManager API clean up
Per API review:
- @IntDef defined on the type integer parameter
- have getters on each parameter that is set in the
  TetheringRequest.Builder
- new added API should not be deprecated
Below APIs is moved from system-current to module-lib-current that only
plafrom code(e.g. ConnectivityManager and Settings) can use them.
TetheringRequest.
onTetherableInterfaceRegexpsChanged, TetheringInterfaceRegexps:
Only platform code can use them because interfaces by regular
expressions are a mechanism which is planning to be deprecated.

Also rename some constants for easier to understand.

Bug: 149858697
Bug: 151243337
Test: m doc-comment-check-docs
      atest TetheringTests
Change-Id: Idd041f0fbeca411ea23e49786a50dd7feb77ef45

markchien   commited 2020-03-19 16:32:37 +08:00
68b6784942
Expose netId by adding getter API
Bug: 151156820
Test: m
      atest TetetheringTests
Change-Id: Ieb1483c146aa2f7d8f251157e6e81d71c44ae899
(cherry picked from commit 8831c4b54178753013d568c0b76bbf7487db8122)

markchien   authored and   Chalard Jean   commited 2020-03-19 15:57:31 +09:00
d069cf9367
Kill ConnectivityManager.CONNECTIVITY_ACTION_SUPL
CONNECTIVITY_ACTION_SUPL is marked as a "temporary hack" and has
never been public. Remove this intent definition since no one is
receiving this intent and should use network callback to know the
connection change.

Bug: 109636544
Test: atest FrameworksNetTests
Change-Id: Ie9e5127742beba04f1c191e894e8a29fe1e704bb
Merged-In: Ie9e5127742beba04f1c191e894e8a29fe1e704bb
(cherry picked from aosp/1224697)

Automerger Merge Worker   authored and   Paul Hu   commited 2020-03-19 06:53:04 +00:00
b5255d439e
Merge changes I7eaca623,Ic94da540,If330e853,Ie2d229be,Ic6b2f10f into rvc-dev
* changes:
  [SM08] Add NetworkTemplate unit test for fetching mobile data usage
  [SM07] Make combine subtype configurable from Settings
  [SM05] Enable record mobile network stats by collapsed rat type
  [SM04] Support fetching data with NetworkTemplate with subType
  [SM02] Support record mobile network stats by collapsed rat type

Junyu Lai   authored and   Android (Google) Code Review   commited 2020-03-19 06:29:38 +00:00
7d06b09387
API review: access field by method
- InvalidPacketException, public field should be a method so
  add getter to get error code.
- KeepalivePacketData, public fields should be methods so
   add getter for fields.

Bug: 151322799
Test: atest FrameworksNetTests
      atest FrameworksWifiTests
      atest FrameworksTelephonyTests: some failure in CarrierAppUtilsTest
Change-Id: Id01e6135193716cc21bba11da529bf1507a954f7

Aaron Huang   commited 2020-03-19 11:38:24 +08:00
c3e9562525
Merge "Add version check to prevent test fail on Android Q" into rvc-dev
Lucas Lin   authored and   Android (Google) Code Review   commited 2020-03-19 03:09:46 +00:00
f425a3103a
[SM08] Add NetworkTemplate unit test for fetching mobile data usage
Test: atest NetworkTemplateTest
Bug: 129082217

Change-Id: I7eaca623adf93f9b8d53c2e5857ecae90ea572ab
Merged-In: I7eaca623adf93f9b8d53c2e5857ecae90ea572ab
(cherry picked from commit 4670baace6c8dafe3a30330596c333d6b2389e4d)

junyulai   authored and   Junyu Lai   commited 2020-03-19 01:41:53 +00:00
e36b07b902
[SM07] Make combine subtype configurable from Settings
Note that enabling/disabling would not take effect until device
reboot. This will be addressed in follow-up patch.

Test: 1. atest NetworkStatsServieTest SettingsBackupTest
      2. adb shell settings put global netstats_combine_subtype_enabled 1|0
Bug: 146415925

Change-Id: Ic94da540afa479ed18f1b6fbda4ae3216c37476b
Merged-In: Ic94da540afa479ed18f1b6fbda4ae3216c37476b
(cherry picked from commit c4f77ac90bf2e48a655ad19b162fe74a23bf3fb0)

junyulai   authored and   Junyu Lai   commited 2020-03-19 01:40:55 +00:00
8c526ea1bf
Merge "Move sensitive field parceling bool to constructor" into rvc-dev
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2020-03-19 01:32:48 +00:00
9718cbefcf
Merge "Make LinkPropertiesTest backwards compatible" into rvc-dev
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2020-03-19 01:32:17 +00:00
7b1c3b760f
Merge changes from topic "netstack_api_review" into rvc-dev
* changes:
  Remove usage of Context.NETWORK_STACK_SERVICE
  Remove NETWORK_STACK_SERVICE constant

Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2020-03-19 01:21:29 +00:00
799e84ed01
Merge "mtu: Add MTU parameter to Routes" into rvc-dev
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2020-03-19 00:50:57 +00:00
27247d1f5d
Merge "Change NetworkCapabilities administrator UIDs to be stored as int[]." into rvc-dev
Cody Kesting   authored and   Android (Google) Code Review   commited 2020-03-18 19:40:39 +00:00
cb9847691f
Change NetworkCapabilities administrator UIDs to be stored as int[].
NetworkCapabilities#mAdministratorUids is used to track the UIDs that
are administrators of the given Network. This value was previously
stored as List<Integer>. However, general Android API Council guidelines
recommend using Arrays for primitive values. In order to be consistent
with the guidelines, updating the field to use an Array.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: I2652a5b0f276b8944454af5cb4b1383a3e054cfa

Cody Kesting   commited 2020-03-18 17:40:24 +00:00
1043927267
Merge "Fix flaky ConnectivityServiceTest#testNetworkFactoryUnregister" into rvc-dev
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2020-03-18 11:49:09 +00:00
1d204ac218
mtu: Add MTU parameter to Routes
- Change route to update existing route
- MTU parameter added to AddRoute

Bug: 142892223
Test: unit test
Change-Id: I2164808ef628eb7c12e875f0bde7f5151bf6a5b5
Merged-In: Ie339d0cee5be12c2232a4631fed61219a0facc64
(cherry picked from commit e521f07e8b03102f1b510a3fb401993513d9c127)

Lorenzo Colitti   commited 2020-03-18 11:18:37 +00:00
7d505a6436
Merge changes I97015365,Ic9db4b9b into rvc-dev
* changes:
  Add NattKeepalivePacketDataTest
  Add KeepalivePacketDataTest

Chiachang Wang   authored and   Android (Google) Code Review   commited 2020-03-18 10:15:15 +00:00
13097923fa
Fix flaky ConnectivityServiceTest#testNetworkFactoryUnregister
Test: atest ConnectivityServiceTest#testNetworkFactoryUnregister \
      --geneate-new-metrics 100
Bug: 151792032

Change-Id: I1ee7a26186885d3a79a32ec9e45f5bcd656a6680
Merged-In: I1ee7a26186885d3a79a32ec9e45f5bcd656a6680
Merged-In: Iece9e8ad5c51170cd404ac995d0005392d37fe0c
(cherry picked from commit 31c26cdbeb35a6fd6a53a1c25cce6d36b825bf41)

Junyu Lai   commited 2020-03-18 10:09:44 +00:00
6d4e01e422