Commit Graph

1857 Commits

Author SHA1 Message Date
James Mattis
424b59c392 Merge changes I5125755b,I312e55a5 into sc-dev
* changes:
  Updating tests to honor per-app TRACK_DEFAULT
  Changing per-app default request to TRACK_DEFAULT
2021-04-23 14:42:51 +00:00
James Mattis
268f2cd458 Updating tests to honor per-app TRACK_DEFAULT
Per-app APIs in ConnectivityService will now have their fallback
request which tracks the system default be of type TRACK_DEFAULT
as opposed to REQUEST. Existing tests which expect this fallback request
to be sent to network factories need to be updated to validate this
change.

Bug: 180452284
Bug: 176494815
Test: atest FrameworksNetTests
Change-Id: I5125755b3ed1ec535494e2d7a48c0860710ed056
2021-04-22 17:41:47 -07:00
Chiachang Wang
aa64c84fd9 Merge "Address API review feedback" into sc-dev 2021-04-23 00:30:51 +00:00
James Mattis
6402e58bc3 Changing per-app default request to TRACK_DEFAULT
Changing the per-app default request flows to fallback to a request of
type TRACK_DEFAULT as opposed to type REQUEST. The main benefit of this
change is that these requests will no longer be sent to the factories
which is desired.

Bug: 180452284
Bug: 176494815
Test: atest FrameworksNetTests
atest FrameworksNetIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I312e55a54f70aa82953a32ab9369d5afc02b75e5
2021-04-22 07:26:10 -07:00
Chalard Jean
e18832887c Merge "Enable policy ranking" into sc-dev 2021-04-22 13:24:32 +00:00
Aaron Huang
03372ab214 Merge "Add getters to UnderlyingNetworkInfo" into sc-dev 2021-04-22 03:09:41 +00:00
Aaron Huang
1d3726a35e Merge "Add getters to NetworkStateSnapshot" into sc-dev 2021-04-21 11:20:10 +00:00
Chalard Jean
5b5731cfb1 Enable policy ranking
Test: Passes all presubmits, been tested in labs
Bug: 184834350
Change-Id: If33884aa245bcc8817bbc9c2fdfab035249e7301
2021-04-21 11:16:44 +00:00
James Mattis
5e6b7f9aa2 Merge "Correctly count nri uid request counts" am: 5ab962df61 am: b039be7617 am: d2c14296e4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1655051

Change-Id: Ibec1f37f2062827cf390eb344dd30447bdabec13
2021-04-21 03:17:13 +00:00
James Mattis
5ab962df61 Merge "Correctly count nri uid request counts" 2021-04-21 02:06:33 +00:00
Nazanin Bakhshi
e7897d5495 Merge "Refactoring and mocking to make sure unit test doesn't call the real service" am: 348f5cb01e am: 3779168261 am: deab38d5bb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1668228

Change-Id: I92c9fc5f4dcfc0a7f80db78b885945a1021eab20
2021-04-20 17:13:46 +00:00
Aaron Huang
c8081e954e Add getters to NetworkStateSnapshot
Address API council feedback, add getters to NetworkStateSnapshot
instead of exposing the bare fields directly.

Bug: 183972826
Test: FrameworksNetTests
Change-Id: Id1707753b42ae88d2b95e4bd00a792609434e4f5
2021-04-20 21:55:56 +08:00
Chiachang Wang
2e98f6cd57 Address API review feedback
Address API review feedback to:
 - Rename NetworkAgent#setTeardownDelayMs to
   NetworkAgent#setTeardownDelayMillis
 - Use getters instead of fields in VpnTransportInfo
 - Rename registerDefaultNetworkCallbackAsUid to
   registerDefaultNetworkCallbackForUid in ConnectiivityManager

Bug: 183972850
Bug: 185246410
Fix: 184735863
Test: make update-api
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk
Test: atest FrameworksMockingServicesTests
Change-Id: I5e8c4bed8bda40d507afa894c359b5e24ee5d868
2021-04-20 09:30:59 +00:00
Aaron Huang
9a2db307ba Add getters to UnderlyingNetworkInfo
Address API review feedback, add getters to UnderlyingNetworkInfo
instead of exposing fields.

Instead of wasting memory by converting this into an array, have
migrateTun take a List<String>. In turn, tunAdjustmentInit should
also take a List<String>.

Bug: 183972554
Test: atest android.net.UnderlyingNetworkInfoTest
Change-Id: Id59744097208d91298a25ef110ade91a9cf291a1
2021-04-20 13:34:52 +08:00
James Mattis
fff0b7ce6d Correctly count nri uid request counts
Correctly count nri uid request counts in the per-app functionality in
connectivity currently used by set profile and set oem network
preference APIs. Previously, upon creation, nris would be created prior
to removing them. This would cause the uid request counts to
artificially increase and incorrectly throw an error if the request
count limit was hit even though in actuality an apps request count was
valid.

E.g., if there was an existing request for per-app functionality and
its owning app made a change to the per-app requests, it would double
count the existing requests. If the current count was say, one under the
limit, an error would be thrown even though it was being replaced which
should have resulted in no net change to the request count limit if
working correctly.

This patch will allow for the requests to be removed prior to creation
so that request counts are tabulated correctly.

Bug: 185849563
Bug: 183785319
Test: atest FrameworksNetTests
Change-Id: I13da0c81256cc02bea6aff2fe1ef99d6f6b0e764
2021-04-19 19:28:23 -07:00
Nazanin
8d18299e28 Refactoring and mocking to make sure unit test doesn't call the real service
Bug: 180938364
Test: utest
Change-Id: Ic6a5a84c1d985fa02f8cf52c8c2ff144669b30c1
2021-04-19 17:12:05 -07:00
Aaron Huang
b4f36cd5f8 Merge "Rename getAllNetworkStateSnapshot which should be pluralized" into sc-dev 2021-04-19 16:42:58 +00:00
Aaron Huang
20605e540a Rename getAllNetworkStateSnapshot which should be pluralized
Address API review feedback, ConnectivityManager#getAllNetworkStateSnapshot
should be pluralized so rename the method to getAllNetworkStateSnapshots

Bug: 183972554
Test: make, FrameworksNetTests
      FrameworksServicesTests
Change-Id: Ic18d17d05984fa2466c962c7843c0ef7183ce77c
2021-04-17 14:08:49 +08:00
Junyu Lai
d175339d58 Merge "[VCN19] Rename get/setSubIds to get/setSubscriptionIds" into sc-dev 2021-04-16 15:59:16 +00:00
Chalard Jean
3d71e308e0 [NS13] Remove the last usage of the legacy int
Note that this requires removing part of a test, because
that part is testing that the a 50 bonus of the legacy
int is stronger than the validation penalty, which is
not a mechanic we want to have. When WiFi is unvalidated
and cell is unvalidated, cell should be kept in case it
validates, like is described in comments in
isNetworkPotentialSatisfier ; however this test is
checking that it *IS* reaped off if the wifi score is
strong enough. This should be incorrect, and should not
be tested, so this patch removes the check.

Test: ConnectivityServiceTest
Bug: 184834350
Change-Id: I8966abee59fea2d9f10f082aba87df6588b72762
2021-04-16 18:13:10 +09:00
junyulai
e576c085c3 [VCN20] Change requestBackgroundNetwork argument order
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215095
Merged-In: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
Change-Id: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
  (cherry-picked from ag/14198667)
2021-04-16 00:16:21 +08:00
Junyu Lai
e3bad0320d Merge "[VCN20] Change requestBackgroundNetwork argument order" into sc-dev 2021-04-15 15:57:42 +00:00
junyulai
56ed9a3349 [VCN20] Change requestBackgroundNetwork argument order
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215095
Ignore-AOSP-First: avoid build break caused by multipatch automerge
Change-Id: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
2021-04-15 18:43:48 +08:00
junyulai
58153cc4c4 [VCN19] Rename get/setSubIds to get/setSubscriptionIds
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215036
Ignore-AOSP-First: avoid merge conflict
Change-Id: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
2021-04-15 18:05:38 +08:00
Chalard Jean
e634b28204 Allow network providers to set the linger duration.
Test: atest CtsNetTestCases:NetworkAgentTest#testSetLingerDuration
Ignore-AOSP-First: prevent merge conflict
CTS-Coverage-Bug: 184796264
Bug: 184227264
Change-Id: I7f420faa40863385114705d6971cf00887d03318
2021-04-14 20:26:12 +08:00
Chiachang Wang
00cb5f4763 Merge "Make getUid a method on UserHandle itself instead of static" am: 4bc8b1386f am: 84c2646d26 am: 7ebbfc98d2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669185

Change-Id: Ic0b7887630c00404ff354c193b82a96930940556
2021-04-13 13:06:43 +00:00
Chiachang Wang
4bc8b1386f Merge "Make getUid a method on UserHandle itself instead of static" 2021-04-13 08:15:47 +00:00
Junyu Lai
314d51526b Merge "Fix nascent timer never get removed" into sc-dev 2021-04-13 03:34:49 +00:00
Chalard Jean
5b2817f17e Merge changes Ic4500dc8,I32477db5 into sc-dev
* changes:
  [NS12] Address comments on NS09
  [NS11] Fix yieldToBadWifi over the policy scoring
2021-04-12 12:41:17 +00:00
Chalard Jean
1fc552984a [NS11] Fix yieldToBadWifi over the policy scoring
This doesn't reactivate the test because it's not yet fixed over int
scoring.

Bug: 184834350
Test: Remove @Ignore and run testAvoidBadWifi
Change-Id: I32477db52eb50faabc499fa68e24ba07577782aa
2021-04-12 10:19:57 +00:00
James Mattis
2066a2dc84 Merge "Adding log history for setOemNetworkPreference()" am: 7fe91d40f1 am: 98b7cc58c6 am: 3842f94fe3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1666340

Change-Id: I123342002b462567174960aa30d1bc4727a8cec7
2021-04-09 17:54:44 +00:00
Remi NGUYEN VAN
43cc2bbfd7 Merge "Add option to make sign-in notification ongoing" into sc-dev 2021-04-09 06:17:17 +00:00
James Mattis
6e4405f926 Adding log history for setOemNetworkPreference()
Adding historical logging for the setOemNetworkPreference() calls. This
will last across reboots.

Bug: 177257940
Bug: 176494815
Test: atest FrameworksNetTests
Change-Id: I4fc35fd58ff741830aa292adc1c559b4279ad8f9
2021-04-08 17:40:06 -07:00
Chiachang Wang
97565cfdb3 Make getUid a method on UserHandle itself instead of static
This commit addresses the API review feedback that getUid()
will be better to make it be a method on UserHandle itself
rather than a static method.

Update as it is and update the corresponding usages.

Fix: 184735865
Test: make update-api
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I33844309224d84764704255d251fadc8940202ca
2021-04-09 08:33:07 +08:00
junyulai
2f4a5b3575 Fix nascent timer never get removed
By design, the nascent timer will be removed after a network
satisfied first request. However, this never happens.
Because the mInactive is false when that happens, so isNascent
is never true.

Furthermore, when removing a nascent timer, the inactivity
state can never be updated since no condition in the
updateInactivityState will be met to update the state correctly.

Thus, update inactive state accordingly when adding/removing the
nascent timer.

Test: TH
Bug: 184227264
Ignore-AOSP-First: prevent merge conflict
Change-Id: I4c1521b6e0ef68ac489771a2ab6b09ef3e381577
2021-04-08 18:29:28 +08:00
Remi NGUYEN VAN
f672f1b055 Add option to make sign-in notification ongoing
Add an overlay boolean that allows setting the SIGN_IN notification as
an ongoing notification.

This can be useful to make sure users can always easily find the
notification to sign in to a captive portal, as studies have found that
some users have a tendency to dismiss notifications before reading them.
At the same time the notification shade is generally too crowded, which
is what causes such behaviors in the first place, so this option is not
enabled by default and should generally not be enabled without proper
user studies or metrics.

Bug: 173171709
Test: atest NetworkNotificationManagerTest
Change-Id: Ic187d2a2b7e49ad152ea2aa35bb784864b97473c
2021-04-08 14:42:48 +09:00
Chiachang Wang
ec27c044d3 Merge "Assign the bit calculation as long to prevent overflow" am: d125112aa2 am: 7f5c1bc46c am: 67bdf0e830
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1664307

Change-Id: Ia3a1974227ebfd0069b288203df3551a561556eb
2021-04-07 06:06:50 +00:00
Chiachang Wang
d125112aa2 Merge "Assign the bit calculation as long to prevent overflow" 2021-04-07 04:24:46 +00:00
Treehugger Robot
4755f52830 Merge "ConnectivityManager: Address review comments from aosp/1595396" am: 7fe967c611 am: 938579f701 am: dfe1a80db6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1633279

Change-Id: I05777492db3ab9d7b4c6c69131f9404780e4e832
2021-04-07 02:47:49 +00:00
Chiachang Wang
7dd2a3d7db Assign the bit calculation as long to prevent overflow
The value should be assigned as a long to do the bit calculation
as the mNetworkCapabilities is intended to be a long. Otherwise,
the value will be temporary assigned into an integer then
assigned to the target long. When the bit shift calculation
is out of the integer scope, the calculation will overflow and
result in unexpected bebavior.

Without assigning to a long, ConnectivityServiceTest will get
Out-Of-Memory in StringBuilder while generating toString() in
NetworkCapabilities after updating tests to verify
NET_CAPABILITY_VSIM and NET_CAPABILITY_BIP.

Bug: 130869457
Test: atest FrameworksNetTests
Change-Id: I4d34c1215c7efb6dc352c314107792e3fa512ad7
2021-04-07 02:06:33 +00:00
Treehugger Robot
7fe967c611 Merge "ConnectivityManager: Address review comments from aosp/1595396" 2021-04-07 00:36:27 +00:00
Roshan Pius
f75ffaaded ConnectivityManager: Address review comments from aosp/1595396
Bug: 156867433
Test: atest android.net
Test: atest com.android.server
Change-Id: I7f5d043732ae22edd14bf581b7dc676c9236b545
2021-04-06 16:42:51 +00:00
Frank Li
133733bdd2 Merge "Add session ID to VpnTransportInfo" 2021-04-06 06:50:48 +00:00
James Mattis
eac282f62e Merge "Adding per-app support for app add/remove" am: 922249e2bb am: 08119d7700 am: a208c33fcf
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1633904

Change-Id: I72d9981b2a6febc218c30926e58072f43e8bf0a5
2021-04-06 06:12:06 +00:00
James Mattis
bd275dcf3d Adding per-app support for app add/remove
Adding support for per-app network functionality to react to application
installs, removals and updates. Also, opportunistic cleanup of a couple
annotations.

Bug: 177092163
Bug: 176494815
Test: atest FrameworksNetTests
atest NetworkStackTests
atest FrameworksNetIntegrationTests
atest NetworkStackIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I45acbd0d2ef50d575f14a944ce82b185ed69f219
2021-04-05 09:55:44 -07:00
Chalard Jean
01a6b34d1d Merge "Fix a bug where the wrong profile is queried" am: 167cc4a044 am: 92bbfaf0a2 am: 1bc19cb6a9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1662362

Change-Id: I5498b7eb2b1b3e4e195ac47d8d3b471496b779b6
2021-04-05 08:10:29 +00:00
Chalard Jean
167cc4a044 Merge "Fix a bug where the wrong profile is queried" 2021-04-05 05:48:17 +00:00
Benedict Wong
54c906b000 Merge "Downgrade list of subIds in NetworkCapabilities to @SystemApi" am: 87e0ab8905 am: d5af88a835 am: 01001e2ddf
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1652974

Change-Id: I7a85feb9753ae91ff3d67dc82c8bc880a6626074
2021-04-03 02:01:25 +00:00
Chalard Jean
0a04bdb730 Fix a bug where the wrong profile is queried
UserManager#isManagedProfile() is not aware of the user
handle of the context the UM instance is created on.
Instead, call isManagedProfile(int).

Bug: 183625645
Test: ConnectivityServiceTest
Change-Id: I1fef22d67d75df25a8c2d0694f857c3e1c1a1306
2021-04-02 19:24:44 +09:00
Benedict Wong
4310e45eff Downgrade list of subIds in NetworkCapabilities to @SystemApi
This change downgrades API visibility for the list-of-subIds in the
NetworkCapabilities to SystemApi

Bug: 175662146
Test: atest NetworkCapabilitiesTest#testSubIds
Test: atest FrameworksNetTests
Change-Id: I372fa9eaa7585aefd1710948ca007456feedd578
2021-04-02 01:18:11 -07:00