Commit Graph

1676 Commits

Author SHA1 Message Date
Junyu Lai
e0f4a9bb6c Merge "Notify the keepalive is stopped after the slot has been released" am: 6d7c1854a8 am: b5e1feccbe am: 09ab7ad386 am: 4295a632b4 am: fcc06d418e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1112851

Change-Id: I86b9c01f99eaa9497acbd4e3e481c7330cf05667
2020-08-28 12:30:17 +00:00
Junyu Lai
09ab7ad386 Merge "Notify the keepalive is stopped after the slot has been released" am: 6d7c1854a8 am: b5e1feccbe
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1112851

Change-Id: Icdd61fb39ebd14963f4ec6e591b3a245e6b999b2
2020-08-28 11:09:43 +00:00
Junyu Lai
6d7c1854a8 Merge "Notify the keepalive is stopped after the slot has been released" 2020-08-28 10:12:44 +00:00
TreeHugger Robot
316b514902 Merge "Deprecated UserManager.getUsers(excludeDying) / added getAliveUsers()" 2020-08-26 05:37:22 +00:00
Treehugger Robot
5a4238cd78 Merge "Skip RAT type listener registration if IMSI is not available" am: b74cd6eb18 am: 649667642c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1409907

Change-Id: I34de6bc6dd862f8042489f60f4b6be76af7c961e
2020-08-25 20:49:04 +00:00
Treehugger Robot
b74cd6eb18 Merge "Skip RAT type listener registration if IMSI is not available" 2020-08-25 19:55:09 +00:00
junyulai
781bce9c7f 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-25 18:03:38 +08:00
Felipe Leme
6dc6d2b964 Deprecated UserManager.getUsers(excludeDying) / added getAliveUsers()
The existing method is confusing (the argument used to be called
includeDying) and it puts the burden on the caller (which need to
understand what the parameter means).

Furthermore:

- The majority of calls are for getUsers(excludeDying=true).
- The calls for getUsers(excludeDying=false) are equivalent to
  calls to getUsers()

Test: m
Test: a VpnTest ConnectivityServiceTest PermissionMonitorTest

Bug: 157921703
Change-Id: Ife767a40b7b7790ba28b5377046de822ddbf275c
2020-08-24 16:19:26 -07:00
Paul Hu
e94f3f922a Merge "Revert "[RFPM03] Check permission by uid."" am: 50bb631f03 am: 6c6c7cdb81 am: 45f2280d3a am: 1c66746130 am: ad67c0bbd9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1404654

Change-Id: I3f6108034a4dfcbae9e5d5cf466e924229f33965
2020-08-20 09:48:16 +00:00
Paul Hu
e458f8d4cd Merge "Revert "[RFPM04] Adjust hasRestrictedNetworkPermission method"" am: aad5331ee2 am: 4143779e4b am: bcc1edb897 am: 4f3df4b152 am: 3ad1384309
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1404653

Change-Id: Id24e6a79676aebfcc61f9b507ad8fca25b35b424
2020-08-20 09:47:22 +00:00
Paul Hu
45f2280d3a Merge "Revert "[RFPM03] Check permission by uid."" am: 50bb631f03 am: 6c6c7cdb81
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1404654

Change-Id: I393e91873923d7b6601d4e8c863cca6986f66f23
2020-08-20 08:52:04 +00:00
Paul Hu
bcc1edb897 Merge "Revert "[RFPM04] Adjust hasRestrictedNetworkPermission method"" am: aad5331ee2 am: 4143779e4b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1404653

Change-Id: Ifa19cb8fce8dca66ac5f4ecc7737c1c095b7b35b
2020-08-20 08:51:45 +00:00
Paul Hu
84aaef1274 Merge "Revert "[RFPM05] Add UidNetdPermissionInfo class"" am: f8115452a7 am: 654c328426 am: 62160754cf am: 1f8fc11362 am: 5ded9f9cca
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1404652

Change-Id: I10a4be2a1b88ddcc67d0b3467f9288b9c36f3b18
2020-08-20 08:27:03 +00:00
Paul Hu
50bb631f03 Merge "Revert "[RFPM03] Check permission by uid."" 2020-08-20 08:24:30 +00:00
Paul Hu
aad5331ee2 Merge "Revert "[RFPM04] Adjust hasRestrictedNetworkPermission method"" 2020-08-20 08:14:48 +00:00
Paul Hu
62160754cf Merge "Revert "[RFPM05] Add UidNetdPermissionInfo class"" am: f8115452a7 am: 654c328426
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1404652

Change-Id: I9edf5bfaa9cbc037e87f5781ba07a2c87932f3aa
2020-08-20 07:04:43 +00:00
Paul Hu
f8115452a7 Merge "Revert "[RFPM05] Add UidNetdPermissionInfo class"" 2020-08-20 06:25:06 +00:00
Paul Hu
7e947abcb5 Revert "[RFPM03] Check permission by uid."
This reverts commit ab4ad20eef.

Reason for revert: Regression in SW.  Bug:162499840

Change-Id: Ic93e762e41a728f66e200e5bc8e40ebe4c7b44f7
2020-08-20 06:23:16 +00:00
Paul Hu
2878288b3a Revert "[RFPM04] Adjust hasRestrictedNetworkPermission method"
This reverts commit 29100e8892.

Reason for revert: Regression in SW.  Bug:162499840

Change-Id: I96bf28ffc9f2d8f3838cb6d2dac16f89a70177ed
2020-08-20 06:23:00 +00:00
Paul Hu
93b5848141 Revert "[RFPM05] Add UidNetdPermissionInfo class"
This reverts commit 26263b3cd0.

Reason for revert: Regression in SW.  Bug:162499840

Change-Id: I0e846efcc4fc06b53d97b2007e0d8e8f97c6ac10
2020-08-20 03:10:08 +00:00
junyulai
eed8c6bb26 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
Junyu Lai
7f409aab46 Merge "Skip RAT type listener registration if IMSI is not available" 2020-08-20 02:20:31 +00:00
junyulai
80a8a63079 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
Change-Id: I408379b3c432d9e62e0837d6b4f6551cc7838e29
2020-08-19 15:15:51 +08:00
Chalard Jean
15292d87fb Merge "Rename Kotlin util files to not include the Kt suffix" am: b1a3247ab4 am: 9da93f616e am: 70572e1b82 am: a0794291ec am: a822fb621b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1350084

Change-Id: I89b50df2ea418f609d4ce7919f3154f54a1379b1
2020-08-13 05:14:14 +00:00
Chalard Jean
70572e1b82 Merge "Rename Kotlin util files to not include the Kt suffix" am: b1a3247ab4 am: 9da93f616e
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
b1a3247ab4 Merge "Rename Kotlin util files to not include the Kt suffix" 2020-08-13 03:52:47 +00:00
Chiachang Wang
35d1db163b Merge "Update language to comply with Android's inclusive language guidance" am: 2dd299c5db am: 0e7aefd000 am: 139402e852 am: 7ca59bc74f am: c70025945b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1379156

Change-Id: Ib455b42f7f360b75a295f86fd5166125fd0f69aa
2020-08-12 10:58:30 +00:00
Chiachang Wang
139402e852 Merge "Update language to comply with Android's inclusive language guidance" am: 2dd299c5db am: 0e7aefd000
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
2dd299c5db Merge "Update language to comply with Android's inclusive language guidance" 2020-08-12 09:30:11 +00:00
Paul Hu
1e527bc5b2 Merge "[RFPM05] Add UidNetdPermissionInfo class" am: 06697e0c43 am: f23a7a2d14 am: 30c2dc100e am: 9a46adade5 am: fc9c753145
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1322556

Change-Id: Ibf808ce55a63335a287c34fefee8a0bf50105db4
2020-08-12 07:42:57 +00:00
Paul Hu
30c2dc100e Merge "[RFPM05] Add UidNetdPermissionInfo class" am: 06697e0c43 am: f23a7a2d14
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
06697e0c43 Merge "[RFPM05] Add UidNetdPermissionInfo class" 2020-08-12 06:17:46 +00:00
Chiachang Wang
97698a6fc5 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
26263b3cd0 [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
77f8a30e29 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
Chalard Jean
8ab570d9c9 Merge "Resolve the endpoint in legacy VPN" am: 429b59c8a4 am: fc546021bb am: 4820e9d4e4 am: 9da9925389 am: 085726421e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1382496

Change-Id: I90bec6d85706fa9b2f9a01f81701138a54347005
2020-08-06 17:12:16 +00:00
Chalard Jean
dece7f3f74 Merge "Add a test for starting the legacy VPN." am: 869d4f597d am: 6926df6314 am: 4136a41652 am: 4d64450516 am: ca286d76ce
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1372896

Change-Id: I96f4bbb9b109e3e5813d083bed1989d88fb156b8
2020-08-06 17:11:25 +00:00
Chalard Jean
4820e9d4e4 Merge "Resolve the endpoint in legacy VPN" am: 429b59c8a4 am: fc546021bb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1382496

Change-Id: If649ab2763c9971c25af7732b32e97bfd50fb6f0
2020-08-06 16:06:20 +00:00
Chalard Jean
4136a41652 Merge "Add a test for starting the legacy VPN." am: 869d4f597d am: 6926df6314
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1372896

Change-Id: Idc49c61cc0547cdabe37cfa19b685c2beeda473b
2020-08-06 16:06:08 +00:00
Chalard Jean
429b59c8a4 Merge "Resolve the endpoint in legacy VPN" 2020-08-06 12:51:50 +00:00
Chalard Jean
869d4f597d Merge "Add a test for starting the legacy VPN." 2020-08-06 12:50:50 +00:00
Chalard Jean
197b4a7168 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: I714985f3c7919dad9c1854830c50f29c1f94a21e
2020-08-06 17:29:59 +09:00
Chalard Jean
b2a73dc872 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: I420b63db03a58e8c67a98a85c9f4c2d6ed7ad078
(cherry picked from commit 45846a03051a13d667732288e457eab4336a691e)
2020-08-06 17:16:00 +09:00
Paul Hu
ec1e785bbd Merge "[RFPM04] Adjust hasRestrictedNetworkPermission method" am: 89ca9dd063 am: b541b5fecf am: c5241a3cd1 am: 9675f2fa72 am: 6a065b325e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1321322

Change-Id: I6b0e7531effbb8c627697b3d7c475de3394b7f52
2020-08-03 12:20:18 +00:00
Paul Hu
c5241a3cd1 Merge "[RFPM04] Adjust hasRestrictedNetworkPermission method" am: 89ca9dd063 am: b541b5fecf
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1321322

Change-Id: Id91c6de75e524080d15e2508007d5de997c7fd92
2020-08-03 11:18:31 +00:00
Paul Hu
89ca9dd063 Merge "[RFPM04] Adjust hasRestrictedNetworkPermission method" 2020-08-03 10:37:52 +00:00
Peter Wang
8ba18c0508 Merge "[Telephony Mainline] Rename getActiveAndHiddenSubscriptionIdList and guard with permission" 2020-07-31 08:43:44 +00:00
Chalard Jean
96650db000 Merge "Move utils from network stack to libs." am: 21be4fabb5 am: bfadef51df am: 7a3454f47e am: 29826a7a2f am: c970ae31d6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1350083

Change-Id: I55c36bb60ea81f86daa193e9dff738846984e1e7
2020-07-31 01:34:46 +00:00
Chalard Jean
7a3454f47e Merge "Move utils from network stack to libs." am: 21be4fabb5 am: bfadef51df
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1350083

Change-Id: Ia163bc416e16ce56fc96855c1111a9905b712843
2020-07-31 01:09:46 +00:00
Chalard Jean
db2934f3cc Move utils from network stack to libs.
This package is using some common utilities from
a library that used to live in the network stack.
A better home for these utilities is frameworks/libs,
so this topic moves the files ther and also changes
the package of some utilities.

See aosp/1350222 and aosp/1350182 for a detailed
description of the specific files that moved.

Test: checkbuild
Change-Id: I76a9b7790f3997e3e6b3c2f75ba6308286457cde
2020-07-29 21:15:48 +09:00