Commit Graph

8708 Commits

Author SHA1 Message Date
Paul Hu
f8f45a92f5 Merge "Revert "[RFPM03] Check permission by uid."" am: fc98e38215
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1404654

Change-Id: I51b37f8e717123a2725ade859d5b9dcff19ef484
2020-08-20 08:33:41 +00:00
Paul Hu
d22d125329 Merge "Revert "[RFPM04] Adjust hasRestrictedNetworkPermission method"" am: c45d2d3848
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1404653

Change-Id: I35fe76f9cfedf0619f64023e9111d9a50cc3c41c
2020-08-20 08:27:16 +00:00
Paul Hu
fc98e38215 Merge "Revert "[RFPM03] Check permission by uid."" 2020-08-20 08:24:30 +00:00
Paul Hu
c45d2d3848 Merge "Revert "[RFPM04] Adjust hasRestrictedNetworkPermission method"" 2020-08-20 08:14:48 +00:00
Paul Hu
6a6253cddd Merge "Revert "[RFPM05] Add UidNetdPermissionInfo class"" am: 07c54c9804
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1404652

Change-Id: I8cef4a21aa8fd1923334c2a99e4ff2e864f516a5
2020-08-20 06:44:04 +00:00
Paul Hu
07c54c9804 Merge "Revert "[RFPM05] Add UidNetdPermissionInfo class"" 2020-08-20 06:25:06 +00:00
Paul Hu
9c60af3743 Revert "[RFPM03] Check permission by uid."
This reverts commit 8adb39a688.

Reason for revert: Regression in SW.  Bug:162499840

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

Reason for revert: Regression in SW.  Bug:162499840

Change-Id: I96bf28ffc9f2d8f3838cb6d2dac16f89a70177ed
2020-08-20 06:23:00 +00:00
Paul Hu
dfb26833f0 Revert "[RFPM05] Add UidNetdPermissionInfo class"
This reverts commit 1daf973605.

Reason for revert: Regression in SW.  Bug:162499840

Change-Id: I0e846efcc4fc06b53d97b2007e0d8e8f97c6ac10
2020-08-20 03:10:08 +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
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
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
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
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
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
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
Chalard Jean
616cc3dca9 Merge "Resolve the endpoint in legacy VPN" am: f54a70cdcd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1382496

Change-Id: I732bb2282cf5b4ba74653ecc0bd934bf991649de
2020-08-06 13:10:36 +00:00
Chalard Jean
84561026d0 Merge "Add a test for starting the legacy VPN." am: 20c118c89d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1372896

Change-Id: I31352ae32ddeba4a37cc37bdcf6d7568f63fd70a
2020-08-06 13:10:20 +00:00
Chalard Jean
f54a70cdcd Merge "Resolve the endpoint in legacy VPN" 2020-08-06 12:51:50 +00:00
Chalard Jean
20c118c89d Merge "Add a test for starting the legacy VPN." 2020-08-06 12:50:50 +00:00
Chalard Jean
950d10f9cb 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
c9077f2a38 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
Alex Light
9c3acacc5c Merge "Update language to comply with Android's inclusive language guidance" am: 56f5e6595b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1380906

Change-Id: Id2829bcdfb836db02db9842bb250e2eb628495aa
2020-08-03 21:01:33 +00:00
Alex Light
d9b1b9daeb Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 162536543
Test: Treehugger
Change-Id: I971050a2665c177870ff257bd0f41343db702892
Merged-In: I971050a2665c177870ff257bd0f41343db702892
2020-08-03 17:04:58 +00:00
Paul Hu
6f9bce51aa Merge "[RFPM04] Adjust hasRestrictedNetworkPermission method" am: 2933a04749
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1321322

Change-Id: I54758c3e9ec37c68d45360afb10a322f749564a9
2020-08-03 10:56:42 +00:00
Paul Hu
2933a04749 Merge "[RFPM04] Adjust hasRestrictedNetworkPermission method" 2020-08-03 10:37:52 +00:00
Peter Wang
1cd92f18b3 Merge "[Telephony Mainline] Rename getActiveAndHiddenSubscriptionIdList and guard with permission" am: c80aabbd2e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1260749

Change-Id: I43a19b479d4c77bb19af31381e7d998527bc068a
2020-07-31 09:04:43 +00:00
Peter Wang
c80aabbd2e Merge "[Telephony Mainline] Rename getActiveAndHiddenSubscriptionIdList and guard with permission" 2020-07-31 08:43:44 +00:00
Chalard Jean
64573a945a Merge "Move utils from network stack to libs." am: 21be4fabb5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1350083

Change-Id: I846dae9b7e36ddf6360bb946cc07beb8c44a34a5
2020-07-31 00:53:12 +00:00
Chalard Jean
3b7591e1f5 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
paulhu
de5b46c10b [RFPM04] Adjust hasRestrictedNetworkPermission method
There are two parts in hasRestrictedNetworkPermission method.
One is carryover package check and one is uid permission
check. Seperate carryover package check part to another method
to be clearer the usage of hasRestrictedNetworkPermission method.

Bug: 132784544
Test: atest FrameworksNetTests
Change-Id: Iab0609fcaa52acb0dfcb31ca957f22bfe8d62392
2020-07-29 14:14:27 +08:00
Paul Hu
77cba9c18e Merge "[RFPM03] Check permission by uid." am: 563de5b8c7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1320375

Change-Id: I520b5d271d6d5214653ebaaeb5d6713c191b911d
2020-07-29 05:47:15 +00:00
Paul Hu
563de5b8c7 Merge "[RFPM03] Check permission by uid." 2020-07-29 05:41:32 +00:00
Junyu Lai
fe6c5793ce Merge "Gracefully handle integer overflows." am: cdb1f03144
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1316217

Change-Id: I779298886cfaef330b433fea6009860682df35bd
2020-07-29 01:37:48 +00:00
Junyu Lai
cdb1f03144 Merge "Gracefully handle integer overflows." 2020-07-29 01:19:07 +00:00
Chiachang Wang
ef723b7617 Merge "Update language to comply with Android's inclusive language guidance" am: f702025bdf
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1373160

Change-Id: Ifcb4682d75b8df577281030c58b61eff53e6ae20
2020-07-28 11:04:20 +00:00
Chiachang Wang
f702025bdf Merge "Update language to comply with Android's inclusive language guidance" 2020-07-28 10:51:53 +00:00
paulhu
8adb39a688 [RFPM03] Check permission by uid.
PermissionMonitor check permission by each package name but only
update the uid permission to netd. It's better to check
permission by uid directly. Thus, use
ActivityManager#checkUidPermission to check permissions for each
uid.

Bug: 132784544
Test: atest FrameworksNetTests
Change-Id: I057d34383b4dc408b2773e4c6b146774ba0c5eb2
2020-07-28 18:23:38 +08:00
Chiachang Wang
3b9549f408 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
Change-Id: I6c3c03c0c2d1302af6d5245486823c13a3432900
2020-07-28 15:36:30 +08:00
Pavan Kumar M
e55ab87e5d Gracefully handle integer overflows.
Avoid recording negative data by doing integer-based
math as much as possible, but switch to double-based
math if we detect that we'd end up causing an overflow.

Test :

    - Builds, Boots
    - High data throughput scenarios
    - NetworkStatsHistoryTest, NetworkStatsCollectionTest,
      NetworkStatsTest

Bug: 119527458
Change-Id: I55d4aa649bea3ae201ad513074ff2b71cb918dad
2020-07-28 11:36:49 +05:30
Aaron Huang
5463bbece5 Merge "Remove ProxyInfo(String) and update callers to use ProxyInfo(Uri)" am: c36f17d32e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1146757

Change-Id: Ib3e7b1ff5c2fbe3fd9a049b58faf26a6c355ad8f
2020-07-17 05:53:43 +00:00