Commit Graph

1677 Commits

Author SHA1 Message Date
Benedict Wong
d3d72d4452 Merge changes I97ba5903,Icd80b368 into rvc-dev
* changes:
  Make VpnProfile.maxMtu default value match Ikev2VpnProfile
  Add negotiated DNS servers to VPN config
2020-03-31 16:52:04 +00:00
Benedict Wong
c0192c1df6 Merge "Automatically set IPsec tunnel interface as up" into rvc-dev 2020-03-31 16:51:58 +00:00
Benedict Wong
cbb19fcba7 Make VpnProfile.maxMtu default value match Ikev2VpnProfile
This change corrects the VpnProfile's maxMtu defaults to match that of
the Ikev2VpnProfile. 1400 is too high as a default, and Settings will
run into an issue here quite often.

Bug: 152573931
Test: FrameworksNetTests passing
Change-Id: I97ba5903b3cc1ed6a21c706ed3d78bd8ecbeee0c
Merged-In: I97ba5903b3cc1ed6a21c706ed3d78bd8ecbeee0c
(cherry picked from commit d0a44f49df01a1aefa505ee90c9806dee135b4e4)
2020-03-30 22:59:17 -07:00
Benedict Wong
0943dac366 Merge "Make VpnProfile.maxMtu default value match Ikev2VpnProfile" 2020-03-31 02:22:54 +00:00
Cody Kesting
b65e18e638 Use IBinder as key for ConnectivityDiagnostics storage in CS.
This change updates ConnectivityService to use IBinder instances as keys
when storing ConnectivityDiagnosticsCallbacks.

When storing ConnectivityDiagnosticsCallbacks in ConnectivityService,
the IConnectivityDiagnsoticsCallback is used as the key for
ConnectivityService.mConnectivityDiagnosticsCallbacks. However,
IConnectivityDiagnosticsCallback instances are received as different
objects. This causes them to produce different hashCode() values, so
attempts to remove an IConnectivityDiagnosticsCallback fail.

Bug: 150867635
Test: atest FrameworksNetTests
Change-Id: Ib99e68d5ae47fa27e12428f9a60a2c1204ac59a2
Merged-In: Ib99e68d5ae47fa27e12428f9a60a2c1204ac59a2
(cherry picked from commit c7c6a4ac12beb7c216076958612869426da06da0)
2020-03-30 17:14:20 -07:00
Cody Kesting
fe059d8c30 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)
2020-03-30 17:13:55 -07:00
Cody Kesting
a365c81bfa Merge "Invoke onConnectivityReport on registering ConnectivityDiagnostics." 2020-03-31 00:06:26 +00:00
Cody Kesting
31f1ff693b Use IBinder as key for ConnectivityDiagnostics storage in CS.
This change updates ConnectivityService to use IBinder instances as keys
when storing ConnectivityDiagnosticsCallbacks.

When storing ConnectivityDiagnosticsCallbacks in ConnectivityService,
the IConnectivityDiagnsoticsCallback is used as the key for
ConnectivityService.mConnectivityDiagnosticsCallbacks. However,
IConnectivityDiagnosticsCallback instances are received as different
objects. This causes them to produce different hashCode() values, so
attempts to remove an IConnectivityDiagnosticsCallback fail.

Bug: 150867635
Test: atest FrameworksNetTests
Change-Id: Ib99e68d5ae47fa27e12428f9a60a2c1204ac59a2
2020-03-30 11:10:46 -07:00
Cody Kesting
b77bf707c6 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
2020-03-30 11:10:46 -07:00
Hall Liu
f5d30b7870 Merge changes from topic "phonestatelistener-limit-rvc-dev" into rvc-dev
* changes:
  Add gating, logging for PhoneStateListener's limit
  Institute limit on PhoneStateListener
2020-03-28 06:48:56 +00:00
Hall Liu
f4667b4925 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
2020-03-27 19:21:51 -07:00
Chalard Jean
199c91b659 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
2020-03-27 22:50:42 +00:00
Benedict Wong
ec51fecfe6 Make VpnProfile.maxMtu default value match Ikev2VpnProfile
This change corrects the VpnProfile's maxMtu defaults to match that of
the Ikev2VpnProfile. 1400 is too high as a default, and Settings will
run into an issue here quite often.

Bug: 152573931
Test: FrameworksNetTests passing
Change-Id: I97ba5903b3cc1ed6a21c706ed3d78bd8ecbeee0c
2020-03-27 11:52:40 -07:00
Chalard Jean
51b8e287ad Rename satisfiedBy into canBeSatisfiedBy
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I076876a6662bde143ef7d315ce3767acafff93c1
2020-03-27 23:46:30 +09:00
Aaron Huang
a09a992749 Merge "API review: access field by method" 2020-03-27 07:03:25 +00:00
Benedict Wong
d6e8d4ab71 Automatically set IPsec tunnel interface as up
This change makes IPsec tunnel interfaces automatically get brought up
once they are created. Originally this was considered to be an
additional safety check, as they would not be start routing traffic
until explicitly brought up. However, in the intervening time, the
NetworkManagementController now requires the NETWORK_STACK permission to
set an interface as up. Additionally, that call is a hidden API, and
thus not usable for use cases such as IWLAN.

Bug: 149348618
Test: FrameworksNetTests, CtsNetTestCases passing.
Change-Id: I55b63a748463a388e1e2991d2d5d6b3023545e60
Merged-In: I55b63a748463a388e1e2991d2d5d6b3023545e60
(cherry picked from commit 7c5704d177a903034ae1b6ae4800cc3b8457977a)
2020-03-25 06:14:13 +00:00
Benedict Wong
bc74233e8a Merge "Automatically set IPsec tunnel interface as up" 2020-03-25 04:18:50 +00:00
Aaron Huang
005f9d10ae 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
Copy from ag/10731108
Change-Id: Id01e6135193716cc21bba11da529bf1507a954f7
Merged-In: Id01e6135193716cc21bba11da529bf1507a954f7
2020-03-24 10:55:18 +00:00
Automerger Merge Worker
21105c9771 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)
2020-03-23 17:35:15 -07:00
Cody Kesting
cf7bb0ee06 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)
2020-03-23 17:35:15 -07:00
Remi NGUYEN VAN
10adc9a7b9 Merge changes from topic "netstack_constant_cherrypick"
* changes:
  Remove usage of Context.NETWORK_STACK_SERVICE
  Remove NETWORK_STACK_SERVICE constant
2020-03-23 03:33:58 +00:00
Remi NGUYEN VAN
fbb0836bc6 Remove usage of Context.NETWORK_STACK_SERVICE
The NetworkStack.getService() API should be used instead.

Bug: 151243982
Test: atest FrameworksNetTests TetheringTests
      Manual tethering test
Merged-In: I7855090bffbe895c8349ad4903b8f2eb55515f0b
(clean cherry-pick from internal branch)

Change-Id: If4af2846a82605e828287a9a4680d5547b76b802
2020-03-23 11:29:06 +09:00
Aaron Huang
de4c7dcda4 Merge "API review: access field by method" into rvc-dev 2020-03-20 11:09:43 +00:00
Cody Kesting
1a78f835eb Merge "Change NetworkCapabilties administrator UIDs to be stored as int[]." 2020-03-19 18:09:26 +00:00
Automerger Merge Worker
5637fa73e3 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)
2020-03-19 06:53:04 +00:00
Junyu Lai
3def549f57 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
2020-03-19 06:29:38 +00:00
Aaron Huang
410236b92e 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
2020-03-19 11:38:24 +08:00
junyulai
b767c0b024 [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)
2020-03-19 10:10:07 +08:00
junyulai
678befa63c [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 and
 fix merge conflict in SettingsBackupTest)
2020-03-19 10:10:07 +08:00
junyulai
2632681cf0 [SM05] Enable record mobile network stats by collapsed rat type
Switch on the recording in device side. Metrics will be
collected in follow-up patches which can be independently
enabled/disabled.

This change also fix the fail in NetworkStatsCollectionTest
which caused by enabling this feature, where the rounding
problem happened when records are distributed into smaller
buckets and categorized into more NetworkIdentity.

Test: atest FrameworksNetTests
Bug: 129082217
Change-Id: If330e85330a4ff713dd420c98d42fa741eabd90a
Merged-In: If330e85330a4ff713dd420c98d42fa741eabd90a
(cherry picked from commit 2d4fa2c0fae8c2d79a25093d9f732a33c2f91dd4)
2020-03-19 10:10:07 +08:00
junyulai
92e995d9cd [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)
2020-03-19 01:41:53 +00:00
junyulai
7e6e807bec [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)
2020-03-19 01:40:55 +00:00
Remi NGUYEN VAN
411bf171fa Merge changes from topic "netstack_api_review" into rvc-dev
* changes:
  Remove usage of Context.NETWORK_STACK_SERVICE
  Remove NETWORK_STACK_SERVICE constant
2020-03-19 01:21:29 +00:00
Paul Hu
57b993bfb5 Merge "Kill ConnectivityManager.CONNECTIVITY_ACTION_SUPL" 2020-03-19 01:10:55 +00:00
Lorenzo Colitti
9ab1503877 Merge "mtu: Add MTU parameter to Routes" into rvc-dev 2020-03-19 00:50:57 +00:00
Cody Kesting
5ab1f55d1f Change NetworkCapabilties 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
Merged-In: I2652a5b0f276b8944454af5cb4b1383a3e054cfa
2020-03-18 15:18:47 -07:00
Cody Kesting
4074c2d181 Merge "Restrict VPN Diagnostics callbacks to underlying networks." 2020-03-18 20:07:52 +00:00
Cody Kesting
5c6b1f1fd0 Merge "Change NetworkCapabilities administrator UIDs to be stored as int[]." into rvc-dev 2020-03-18 19:40:39 +00:00
Cody Kesting
46a0db809f 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
2020-03-18 17:40:24 +00:00
Lorenzo Colitti
6ccc8aa265 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)
2020-03-18 11:18:37 +00:00
Junyu Lai
84c3f44278 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)
2020-03-18 10:09:44 +00:00
Remi NGUYEN VAN
aa5dfd816a Remove usage of Context.NETWORK_STACK_SERVICE
The NetworkStack.getService() API should be used instead.

Bug: 151243982
Test: atest FrameworksNetTests TetheringTests
      Manual tethering test
Change-Id: I7855090bffbe895c8349ad4903b8f2eb55515f0b
2020-03-18 18:31:39 +09:00
junyulai
56b6a95256 [SM05] Enable record mobile network stats by collapsed rat type
Switch on the recording in device side. Metrics will be
collected in follow-up patches which can be independently
enabled/disabled.

This change also fix the fail in NetworkStatsCollectionTest
which caused by enabling this feature, where the rounding
problem happened when records are distributed into smaller
buckets and categorized into more NetworkIdentity.

Test: atest FrameworksNetTests
Bug: 129082217
Change-Id: If330e85330a4ff713dd420c98d42fa741eabd90a
Merged-In: If330e85330a4ff713dd420c98d42fa741eabd90a
(cherry picked from commit 2d4fa2c0fae8c2d79a25093d9f732a33c2f91dd4)
2020-03-18 08:08:01 +00:00
junyulai
80bf34b2af Fix flaky ConnectivityServiceTest#testNetworkFactoryUnregister
Test: atest ConnectivityServiceTest#testNetworkFactoryUnregister \
      --geneate-new-metrics 100
Bug: 151792032
Change-Id: Iece9e8ad5c51170cd404ac995d0005392d37fe0c
2020-03-18 15:22:54 +08:00
Lorenzo Colitti
9839a4311a Merge "mtu: Add MTU parameter to Routes" 2020-03-18 07:20:01 +00:00
Junyu Lai
52ee59fb03 Merge "[SP25] Rename functions that add Entry conditionally" 2020-03-18 03:16:41 +00:00
junyulai
a896436ef2 [SP25] Rename functions that add Entry conditionally
Currently, in NetworkStats, there are many methods to manipulate
the records. However, some methods are similar and ambiguous,
such as addEntry, addValues, setValues, addIfaceValues,
combineValues and combineAllValues.

Thus, properly grouping and renaming methods are necessary.
In this change, for methods that add one record conditionally,
name them addEntry.
  addValues -> addEntry

Test: atest FrameworksNetTests ImsPhoneCallTrackerTest TetheringTests
Fix: 148895143
Change-Id: I9495a198cf247e6c79100f7ac1edcea370b071de
Merged-In: I9495a198cf247e6c79100f7ac1edcea370b071de
(cherry picked from ag/10700816)
2020-03-18 00:29:15 +00:00
Junyu Lai
6fb3f0aafa Merge changes from topics "am-ad04c8ad832c4674be35bfc5fe4280dd-rvc-dev", "sp21-api-review-feedback", "sp25-networkstats-rename" into rvc-dev
* changes:
  [SP25] Rename functions that add Entry conditionally
  [SP24] Rename functions that add Entry unconditionally
  [SP23] Address misc API review comment about NetworkStats
  [SP21] Address comments for API council review about aosp/1172143
  [SP20] Check signature permission when accessing network stats provider
2020-03-17 23:11:34 +00:00
Cody Kesting
5596ba1619 Merge "Update ConnectivityDiagnosticsCallback function name." 2020-03-17 19:00:39 +00:00
Cody Kesting
fa1ef5eb1b Update ConnectivityDiagnosticsCallback function name.
API Council feedback suggests renaming ConnectivityDiagnosticsCallback
'onConnectivityReport' function to be 'onConnectivityReportAvailable'.

Bug: 150598997
Test: atest FrameworksNetTests
Change-Id: Ieea727ecee6cf358a53a215fd4b06233dfe967ea
Merged-In: Ieea727ecee6cf358a53a215fd4b06233dfe967ea
2020-03-17 17:10:38 +00:00