Commit Graph

11509 Commits

Author SHA1 Message Date
junyulai
75125f2131 Notify the keepalive is stopped after the slot has been released
Currently, the callbacks of stopping were fired when stop procedure
is started, because the upper layer apps only care about the reason
of stopping instead of stopping result. Thus, there is no need to
wait for the result comes back. However, this behavior generates
races if apps want to re-start keepalive immediately since the
resources are not released yet.

Fix: 134891441
Fix: 140305589
Test: atest com.android.server.ConnectivityServiceTest#testPacketKeepalives \
      --rerun-until-failure 1000

Change-Id: I987776a9211a50e964c4675b747bc10e203750f1
2020-08-20 11:00:08 +08:00
junyulai
a57040886b Skip RAT type listener registration if IMSI is not available
Currently, if SIM is inserted but IMSI is not available, such
as SIM PIN locked state. Information of such SIM will still
be available but IMSI is not. Which makes
NetworkStatsSubscriptionMonitor failed to store IMSI locally
for later RAT type query. Hence, NETWORK_TYPE_UNKNOWN is
always returned for such SIM.

Skip the registration until the IMSI is available. This is safe
since there will be another onSubscriptionsChanged event when
that happens.

Test: enable SIM PIN and manually test
Test: atest NetworkStatsSubscriptionsMonitorTest#testSubscriberIdUnavailable
Test: ./out/host/linux-x86/bin/statsd_testdrive 10082
Bug: 160941101
Merged-In: I408379b3c432d9e62e0837d6b4f6551cc7838e29
Change-Id: I408379b3c432d9e62e0837d6b4f6551cc7838e29
(cherry-picked from ag/12400327)
2020-08-19 09:53:20 +00:00
Chalard Jean
150edd2987 Merge "Rename Kotlin util files to not include the Kt suffix" am: 9f2f0ce903 am: 05784f0a5a am: 9be3ecf9b3 am: af253ce94a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1350084

Change-Id: I69da39a99014256dd1188cb522e8d0900deb66d1
2020-08-13 04:57:30 +00:00
Chalard Jean
af253ce94a Merge "Rename Kotlin util files to not include the Kt suffix" am: 9f2f0ce903 am: 05784f0a5a am: 9be3ecf9b3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1350084

Change-Id: I6d7b924f9c0e8722400611cec31b4bf4222548ad
2020-08-13 04:43:45 +00:00
Chalard Jean
9be3ecf9b3 Merge "Rename Kotlin util files to not include the Kt suffix" am: 9f2f0ce903 am: 05784f0a5a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1350084

Change-Id: I6362695120ea8669e1da84bb686e886b85efd6a3
2020-08-13 04:26:11 +00:00
Chalard Jean
05784f0a5a Merge "Rename Kotlin util files to not include the Kt suffix" am: 9f2f0ce903
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1350084

Change-Id: I7e1f015c21d54591a1a25b5fa461e751bc707509
2020-08-13 04:09:27 +00:00
Chalard Jean
9f2f0ce903 Merge "Rename Kotlin util files to not include the Kt suffix" 2020-08-13 03:52:47 +00:00
Chiachang Wang
0375537cf0 Merge "Update language to comply with Android's inclusive language guidance" am: e559544470 am: bafca91de9 am: f8ceddc7ca am: e0a40cdf0c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1379156

Change-Id: I0d9947b6e4591d515a3c318be38e3c46a119a7f7
2020-08-12 10:43:42 +00:00
Chiachang Wang
e0a40cdf0c Merge "Update language to comply with Android's inclusive language guidance" am: e559544470 am: bafca91de9 am: f8ceddc7ca
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1379156

Change-Id: Ib078acdf9210f7c80b5cdb50ae5b860aea2a5626
2020-08-12 10:28:50 +00:00
Chiachang Wang
f8ceddc7ca Merge "Update language to comply with Android's inclusive language guidance" am: e559544470 am: bafca91de9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1379156

Change-Id: Ibe13b2dad841e2ade2762558d1c3978a89cb825d
2020-08-12 10:10:11 +00:00
Chiachang Wang
bafca91de9 Merge "Update language to comply with Android's inclusive language guidance" am: e559544470
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1379156

Change-Id: Iecf8601b2f9e286cefca0675476d0892436d5e5b
2020-08-12 09:52:30 +00:00
Chiachang Wang
e559544470 Merge "Update language to comply with Android's inclusive language guidance" 2020-08-12 09:30:11 +00:00
Paul Hu
7d4e77f07e Merge "[RFPM05] Add UidNetdPermissionInfo class" am: 829abbcb31 am: e173360f82 am: c9892ecb25 am: 6ddb94f5c8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1322556

Change-Id: I390c22d8b114d94990a5e81ad02d47beea115680
2020-08-12 07:25:48 +00:00
Paul Hu
6ddb94f5c8 Merge "[RFPM05] Add UidNetdPermissionInfo class" am: 829abbcb31 am: e173360f82 am: c9892ecb25
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1322556

Change-Id: I6992464abf1f79bde4da0b0ac6e9d13619ef485d
2020-08-12 07:11:46 +00:00
Paul Hu
c9892ecb25 Merge "[RFPM05] Add UidNetdPermissionInfo class" am: 829abbcb31 am: e173360f82
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1322556

Change-Id: I0878281e2033f093f3b9cbf608c30c44bdd99278
2020-08-12 06:53:13 +00:00
Paul Hu
e173360f82 Merge "[RFPM05] Add UidNetdPermissionInfo class" am: 829abbcb31
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1322556

Change-Id: I91a603d8b37ee750c3f582363bec94977d70014e
2020-08-12 06:37:34 +00:00
Paul Hu
829abbcb31 Merge "[RFPM05] Add UidNetdPermissionInfo class" 2020-08-12 06:17:46 +00:00
Chiachang Wang
263ce447ca 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 ; atest FrameworkNetTests
Change-Id: Ib6b4c9526992c31e05e82be80e2b9b86bc0b57ef
2020-08-12 12:23:59 +08:00
paulhu
1daf973605 [RFPM05] Add UidNetdPermissionInfo class
Add UidNetdPermissionInfo class to store netd permission info of
each uid. Use the bit mask for combining all netd permission into
one value which can update and get the uid permission easily.
Moreover, aosp/1340042 add carryover package info into this class
which centralizes all netd permissions relevant data.

Bug: 132784544
Test: atest FrameworksNetTests
Change-Id: I3b81ea2a5017e8f4d0d603144a33c9b08640d7ba
2020-08-12 10:33:18 +08:00
Chalard Jean
39175f2670 Rename Kotlin util files to not include the Kt suffix
Callers don't care what language the utilities are written in

Test: builds
Change-Id: Ie212144f36c50db223c05f3fcb6bad745842cb5e
2020-08-12 10:02:50 +09:00
Junyu Lai
d85b91d2ac [automerger skipped] Merge "Fix fd leak in KeepaliveTracker." into rvc-d1-dev am: c9f7253224 -s ours am: 4f1ea123e0 -s ours
am skip reason: Change-Id Ice9fc9abe2959a84ad138a95c900dff676653665 with SHA-1 461a122ae6 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12325557

Change-Id: Ib986336e2d7ef9c34474cc8c21d181f680b4823e
2020-08-11 05:28:38 +00:00
Junyu Lai
4f1ea123e0 [automerger skipped] Merge "Fix fd leak in KeepaliveTracker." into rvc-d1-dev am: c9f7253224 -s ours
am skip reason: Change-Id Ice9fc9abe2959a84ad138a95c900dff676653665 with SHA-1 461a122ae6 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12325557

Change-Id: Ie4999416cdf9e3a05f3193e3402eae3129481703
2020-08-11 05:14:45 +00:00
Lorenzo Colitti
f5c38386a6 Fix fd leak in KeepaliveTracker.
The semantics of FileDescriptor in AIDL are that the callee must close
the file descriptor it receives manually.

Fix: 157789860
Bug: 155136951
Test: treehugger
Change-Id: Ice9fc9abe2959a84ad138a95c900dff676653665
Merged-In: Ice9fc9abe2959a84ad138a95c900dff676653665
(cherry picked from commit db8ae41da255caad7640fc2c1b58d16aafb0e62b)
2020-08-11 04:46:09 +00:00
Chalard Jean
34a4918757 [automerger skipped] Merge changes I33b70b0a,I1074eedb am: 0714d122ac am: 934e9a5d9f -s ours am: 535804696d -s ours am: 480e662684 -s ours
am skip reason: Change-Id Icd141a992c46290c74929785e261a1cd57bc001b with SHA-1 7007e35032 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1392725

Change-Id: I8a133f595e5f40a0aec4b831070997c9a0fa4bdc
2020-08-07 07:37:08 +00:00
Chalard Jean
d289fa5c7d [automerger skipped] Revert "Revert "Move Inet[4]AddressUtils to libs/net"" am: 059356d83f am: 6f82a0f220 -s ours am: f5dedc3745 -s ours am: 80a8b293d2 -s ours
am skip reason: Change-Id Icd141a992c46290c74929785e261a1cd57bc001b with SHA-1 7007e35032 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1382497

Change-Id: I3fa582c372cf3b4c9d4063e343411eaa71ef438b
2020-08-07 07:37:06 +00:00
Chalard Jean
480e662684 [automerger skipped] Merge changes I33b70b0a,I1074eedb am: 0714d122ac am: 934e9a5d9f -s ours am: 535804696d -s ours
am skip reason: Change-Id Icd141a992c46290c74929785e261a1cd57bc001b with SHA-1 7007e35032 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1392725

Change-Id: I039772ce9b09d2f0f9d07fbf632d3d8efa01630b
2020-08-07 07:26:54 +00:00
Chalard Jean
80a8b293d2 [automerger skipped] Revert "Revert "Move Inet[4]AddressUtils to libs/net"" am: 059356d83f am: 6f82a0f220 -s ours am: f5dedc3745 -s ours
am skip reason: Change-Id Icd141a992c46290c74929785e261a1cd57bc001b with SHA-1 7007e35032 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1382497

Change-Id: I853068e1d6301fc99466f255e9084a130d122971
2020-08-07 07:26:47 +00:00
Chalard Jean
535804696d [automerger skipped] Merge changes I33b70b0a,I1074eedb am: 0714d122ac am: 934e9a5d9f -s ours
am skip reason: Change-Id Icd141a992c46290c74929785e261a1cd57bc001b with SHA-1 7007e35032 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1392725

Change-Id: I462f911d13e7574a0babd6d661c0b569f0265b58
2020-08-07 07:16:28 +00:00
Chalard Jean
f5dedc3745 [automerger skipped] Revert "Revert "Move Inet[4]AddressUtils to libs/net"" am: 059356d83f am: 6f82a0f220 -s ours
am skip reason: Change-Id Icd141a992c46290c74929785e261a1cd57bc001b with SHA-1 7007e35032 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1382497

Change-Id: I5b15fde5cb76d1dc178a3cb2b1597e0c27aa7af2
2020-08-07 07:16:23 +00:00
Chalard Jean
934e9a5d9f Merge changes I33b70b0a,I1074eedb am: 0714d122ac
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1392725

Change-Id: I18869fe6bddd51f77068a91034b524f12c5a3450
2020-08-07 06:59:30 +00:00
Chalard Jean
6f82a0f220 Revert "Revert "Move Inet[4]AddressUtils to libs/net"" am: 059356d83f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1382497

Change-Id: Ia5e7e926bc3a9af8b03f8970738e6abe4c6d15b6
2020-08-07 06:59:26 +00:00
Automerger Merge Worker
bb9f8738a2 Merge "[automerger skipped] Resolve the endpoint in legacy VPN am: 75d9e28a07 am: 926a2a40cf -s ours" into rvc-qpr-dev-plus-aosp 2020-08-07 06:54:59 +00:00
Automerger Merge Worker
7733abae6b Merge "[automerger skipped] Resolve the endpoint in legacy VPN am: 75d9e28a07 -s ours am: dbb502397d -s ours" into rvc-qpr-dev-plus-aosp 2020-08-07 06:54:54 +00:00
Chalard Jean
5e4a05e4c1 [automerger skipped] Resolve the endpoint in legacy VPN am: 75d9e28a07 am: 926a2a40cf -s ours
am skip reason: Change-Id I96691f6091c43377f23a00621242ed034fcb0444 with SHA-1 678245fef4 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12325669

Change-Id: I9ecb2fdf57554028c60084f6ed86f2e4d08fc387
2020-08-07 06:54:54 +00:00
Automerger Merge Worker
df7118cdf6 Merge "[automerger skipped] Add a test for starting the legacy VPN. am: 3103a6ee03 am: 6995503731 -s ours" into rvc-qpr-dev-plus-aosp 2020-08-07 06:54:48 +00:00
Chalard Jean
a20054ad32 [automerger skipped] Resolve the endpoint in legacy VPN am: 75d9e28a07 -s ours am: dbb502397d -s ours
am skip reason: Change-Id I96691f6091c43377f23a00621242ed034fcb0444 with SHA-1 678245fef4 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12325669

Change-Id: Ie5b037df1d53019c773ecebf7db9d38dd9dd8df0
2020-08-07 06:54:29 +00:00
Chalard Jean
2bacb6817d [automerger skipped] Add a test for starting the legacy VPN. am: 3103a6ee03 am: 6995503731 -s ours
am skip reason: Change-Id I3c4a94181bd71df68121fa0f71669fa4fa588bdd with SHA-1 7b76f806dd is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12330622

Change-Id: Ifee93b0591d129129731d6dcf9c47e0a6ca2f5a9
2020-08-07 06:54:27 +00:00
Chalard Jean
f2482451c0 [automerger skipped] Add a test for starting the legacy VPN. am: 3103a6ee03 -s ours am: cd5e78689a -s ours
am skip reason: Change-Id I3c4a94181bd71df68121fa0f71669fa4fa588bdd with SHA-1 7b76f806dd is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12330622

Change-Id: Ic7c62d74001747f8983b9e6585de1ddbda16b06e
2020-08-07 06:54:10 +00:00
Chalard Jean
0714d122ac Merge changes I33b70b0a,I1074eedb
* changes:
  Remove the services.net-module-wifi module target.
  Revert "Revert "Move Inet[4]AddressUtils to libs/net""
2020-08-07 06:45:15 +00:00
Chalard Jean
dbb502397d [automerger skipped] Resolve the endpoint in legacy VPN am: 75d9e28a07 -s ours
am skip reason: Change-Id I96691f6091c43377f23a00621242ed034fcb0444 with SHA-1 678245fef4 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12325669

Change-Id: If767dc2c9fd68e0a6610a42319f2a61d7fb60c1f
2020-08-07 06:45:05 +00:00
Chalard Jean
cd5e78689a [automerger skipped] Add a test for starting the legacy VPN. am: 3103a6ee03 -s ours
am skip reason: Change-Id I3c4a94181bd71df68121fa0f71669fa4fa588bdd with SHA-1 7b76f806dd is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12330622

Change-Id: Ieff977b6742a93b3a8f335ff6022cf1fbdcec2e7
2020-08-07 06:44:53 +00:00
Chalard Jean
75d9e28a07 Resolve the endpoint in legacy VPN
This adds code to resolve the endpoint in the legacy VPN
runner if it was specified as a hostname, and enables the
previously added test that was disabled because this was
broken until this patch. See the linked bug for details.

This patch uses the async DNS API to do the resolution.
This lets the resolution be fully cancellable, though the
code is more complex than with the non-interruptible
getByName.

Test: VpnTest and in particular VpnTest#testStartRacoon
      Fixes the test meant to test this
      Also manual testing that resolution of a real
      hostname works as expected, that failure to resolve
      returns correctly, and that cancellation/interruption
      will unblock the thread and terminate immediately.
Bug: 158974172
Change-Id: I90bec6d85706fa9b2f9a01f81701138a54347005
Merged-In: I96691f6091c43377f23a00621242ed034fcb0444
(cherry picked from commit 8ab570d9c9eb5e52b2c038818e3e4d1d3b98fda0)
2020-08-07 06:43:22 +00:00
Lorenzo Colitti
c86ad7fb09 Merge "Fix fd leak in KeepaliveTracker." am: 3dbbfa10bb am: 2e7172387e am: 7122f9b616 am: f4056df345
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1361907

Change-Id: Idee2fcb96d2b94120d5b53b8d402faa11c94d142
2020-08-07 06:30:11 +00:00
Lorenzo Colitti
f4056df345 Merge "Fix fd leak in KeepaliveTracker." am: 3dbbfa10bb am: 2e7172387e am: 7122f9b616
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1361907

Change-Id: I69f4f8073b057f294e0665ab7b1dcf57818d3089
2020-08-07 06:17:00 +00:00
Lorenzo Colitti
7122f9b616 Merge "Fix fd leak in KeepaliveTracker." am: 3dbbfa10bb am: 2e7172387e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1361907

Change-Id: I68dcb3da95c803179733861604e092582eefb254
2020-08-07 06:02:12 +00:00
Lorenzo Colitti
2e7172387e Merge "Fix fd leak in KeepaliveTracker." am: 3dbbfa10bb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1361907

Change-Id: I13df61b292a9ec964854641ba170d39caf66125a
2020-08-07 05:48:00 +00:00
Lorenzo Colitti
3dbbfa10bb Merge "Fix fd leak in KeepaliveTracker." 2020-08-07 05:40:33 +00:00
Chalard Jean
3103a6ee03 Add a test for starting the legacy VPN.
The legacy VPN has, among many parameters, a host to connect to.
This host can be specified as a numeric address, or as a hostname.
When it's a name, resolution is required. Currently, name
resolution is performed by the native VPN daemons racoon and
mtpd. When a hostname is used, the framework does not know the
IP address of the VPN server and does not add a throw route for
the VPN server IP address. On older kernels this does not matter
because the legacy PPP kernel code binds the PPP socket to the
right network, but on newer devices that use the upstream PPP
code, this does not work. See b/133797637.

This patch instruments the legacy VPN code so that it can be
run in tests, and uses this instrumentation to simulate passing
a configuration that contains a host, and verifies that the
arguments passed to the mptd and racoon daemons receive the
expected server address, and that the expected throw route is
correctly installed.
It then adds two tests : one specifying the server as a numeric
address, and one as a hostname. As the resolution is currently
broken, the latter of these tests is added disabled, and the
followup fix to the issue enables it.

This test is basic and very targeted, but it's what we need right
now. Also there are plans to remove this entire code path in S, so
the test being ad-hoc is not much of a problem.

Test: this
Bug: 158974172
Change-Id: I96f4bbb9b109e3e5813d083bed1989d88fb156b8
Merged-In: I3c4a94181bd71df68121fa0f71669fa4fa588bdd
(cherry picked from commit dece7f3f74cb67f2a046f3a2a9757b559abc2aac)
2020-08-07 05:11:43 +00:00
Chalard Jean
059356d83f 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
2020-08-07 03:31:04 +00:00
Josh Gao
461a122ae6 Fix fd leak in KeepaliveTracker.
The semantics of FileDescriptor in AIDL are that the callee must close
the file descriptor it receives manually.

Bug: http://b/157789860
Test: treehugger
Change-Id: Ice9fc9abe2959a84ad138a95c900dff676653665
2020-08-07 03:22:38 +00:00