Commit Graph

3312 Commits

Author SHA1 Message Date
Junyu Lai
1455b2db2a [MS03] Remove ServiceNotFoundException hidden API usage
Since ServiceNotFoundException is not a system API. Remove
the unsupported interface which uses this exception.
This is safe since the method annotated with maxTargetSdk = R
and from dashboard it is not using by anybody.

Test: TH
Bug: 204830222
Change-Id: Ib8c0ce7b165732d24929851792d35371b90a5dfc
2021-12-13 06:26:07 +00:00
Junyu Lai
e8278e6b3a Merge "[MS01] Move NetworkTemplate cloud backup functions to NetworkPolicy" am: 40eb40302d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1878037

Change-Id: I86a23381b25fba2512c2ad1d3ffeb60d12947202
2021-12-10 22:30:19 +00:00
Treehugger Robot
84b5f06d68 Merge changes from topic "ms07-movestats" am: 942c713c9d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1895044

Change-Id: I85d704b09dac07e91b8400a2bbd15867e2b80d6d
2021-12-10 18:57:08 +00:00
Junyu Lai
559d148349 [MS01] Move NetworkTemplate cloud backup functions to NetworkPolicy
Since NetworkTemplate will be moved into the mainline module.
It is necessary to remove hidden BackupUtil usage from
NetworkTemplate. Also, it is also a hazard to maintain
compatibility for byte buffer interfaces.

Thus, move out these cloud backup functions to NetworkPolicy
to address these concerns.

Test: atest NetworkPolicyTest NetworkPolicyManagerServiceTest
Bug: 204830222
Change-Id: I3ec55f7e419ea13db535acff2457d8e7aaebdce8
2021-12-10 16:11:09 +00:00
Junyu Lai
c8c87d4a01 [MS07.1] Move NetworkStatsCollection/IdentitySet into frameworks
These files are needed for the data migration util system Api
interfaces to allow OEMs to construct NetworkStats* objects.
Thus, they need to be moved into android.net package, and some
of them will be exposed as @SystemApi in T.

Eventually these classes will be moved into the Connectivity
module, but in the mean time they will be temporarily moved to
f/b/package/ConnectivityT for the preparation stage.
However, the tests are already in the module. Therefore for
the S-derived branch, the test cannot see the renamed classes
since any framework CLs will not be auto-merged into this branch.
Thus, the tests need to stay disabled on the S-derived branch,
and will be re-enabled after all files are moved into the module.

Test: TH
Bug: 197717846

Change-Id: I95278a99cf2437ada28001161ceea17a1d32f2a4
2021-12-10 16:11:08 +00:00
Junyu Lai
ad166b43df [MS08] Move NetworkStats files to f/b/package/ConnectivityT
NetworkStatsService is going to be moved into ConnectivityService
module. Move all related files to packages/ConnectivityT so that
it can be easily migrate these files to connectivity module
after clearing the hidden API usages.

Bug: 197717846
Test: TH
Change-Id: Iead00832b5eb7b1dc40a92027c5a14ae8316b16c
2021-12-10 16:11:08 +00:00
Zhomart Mukhamejanov
59d6787f97 Merge "Add javadoc to NetworkStats related classes." am: 96fe4ce495
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1917019

Change-Id: Ic92ff264664e714cdcf0a8deadf0e9a254ce752e
2021-12-10 15:39:26 +00:00
Zhomart Mukhamejanov
96fe4ce495 Merge "Add javadoc to NetworkStats related classes." 2021-12-10 15:21:07 +00:00
Zhomart Mukhamejanov
954da0d830 Add javadoc to NetworkStats related classes.
Bug: n/a
Test: n/a
Change-Id: If7f4d68ea89adbcbc02c1e0a06a11f6330f5d8f3
2021-12-09 21:28:05 -08:00
Aaron Huang
5921b50235 Merge "Move f/b/packages/Nsd files to f/b/packages/ConnectivityT" am: 610b585502
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1914528

Change-Id: I9675aa02c8271ecc9d8d11c5cb544f56d8ff1f93
2021-12-10 02:30:08 +00:00
Aaron Huang
e500616efd Move f/b/packages/Nsd files to f/b/packages/ConnectivityT
Move Nsd files to ConnectivityT so that nsd, ipsec,
ethernet and netstats files can live in the same
directory and it will be easier to move everything
in frameworks/base/packages/ConnectivityT to
packages/modules/Connectivity after fixing all of the
hidden API usages.

Bug: 204153604
Test: FrameworksNetTests
      CtsNetTestCases
Change-Id: I411e242e8739d15920cfc2fe274115f7f39bd89f
2021-12-09 16:22:00 +08:00
Paul Hu
9db059bc70 Merge "Remove @hide symbols from NativeDaemonConnector" am: 68d5b22c2d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1899031

Change-Id: I6883153a5ec2f1002180905fe9972a650b9c0c84
2021-12-07 07:33:32 +00:00
Paul Hu
ab3f25795c Merge "Stop using NSD_ON setting" am: a37333ace6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1895245

Change-Id: I13cc751269756ba745f4327b35e3562e3aefd689
2021-12-07 06:01:15 +00:00
paulhu
8823a30b6f Remove @hide symbols from NativeDaemonConnector
- FgThread is an service internal class that NativeDaemonConnector
  can not use it after moving into mainline module. Thus, replace
  it by creating a new thread.

- Remove shutting down check because the original problem owner
  netd isn't used NativeDaemonConnector now.

Bug: 206702844
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Ib2e227ef1e361f96b397abd7c2a88420ad5a2f22
2021-12-07 11:47:34 +08:00
paulhu
5568f45b87 Stop using NSD_ON setting
NSD_ON setting has never been set since it created. Besides,
CTS tests assume that nsd service is always enabled otherwise
the tests will fail. Thus, remove the setting from NsdService
which is no need to read/write it and it's also a hidden symbols.

Bug: 206702844
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Id3cef7def96925cec5095e12910e9b97ba7efb11
2021-12-03 21:21:07 +08:00
Paul Hu
19cbd7c2e3 Merge "Replace @hide APIs" am: c0d2b740f0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1894755

Change-Id: I19d1193f80c38e8e9f1ffa143ebd7fe8d9393ac3
2021-12-03 02:30:44 +00:00
Paul Hu
6d87f472ee Merge "Centralize nsd associated files" am: 32942299d3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1895244

Change-Id: I15a6d3eaca8b0244258d08b1dc5e46f0394609cb
2021-12-02 03:26:56 +00:00
paulhu
b222570f37 Replace @hide APIs
NSD associated files are going to move into connectivity
mainline module in T, so need convert all hidden APIs to formal
API surfaces.

- Replace Slog with Log
- Remove useless implements Watchdog.Monitor
- Replace Build.IS_DEBUGGABLE with Build.isDebuggable()
- Replace Preconditions.checkState90 by checking null directly.
- Replace Lists.newArrayList() by new ArrayList<>()
- Replace DumpUtils.checkDumpPermission() by checking DUMP
  permission directly.

Bug: 206702844
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I6bc478b852c10591959d9e0615af63e675532abe
2021-12-01 22:31:50 +08:00
paulhu
73a8203a9d Centralize nsd associated files
Move all nsd associated files include framework, service and test
to package/Nsd first. After clear all hidden API dependencies, we
can easily migrate these files into connectivity mainline module.

Bug: 206893064
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Id26f471a10fe7882e31ccc2dbb73219461f00dbd
2021-11-29 23:08:06 +08:00
Chalard Jean
1440cc42d4 Merge "net: fix NPE when reading IP configurations" am: ca9a233b8d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1879657

Change-Id: I9ad5d7bdb2c9aa08bcfeca78c0a4858101f28444
2021-11-26 07:23:37 +00:00
Chalard Jean
ca9a233b8d Merge "net: fix NPE when reading IP configurations" 2021-11-26 07:04:34 +00:00
Treehugger Robot
23629a31e2 Merge "[MS06] Add carrier template fields into cloud backup/restore" am: e5864eb632
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1892336

Change-Id: I65e9824a56727bd6a2386b2c6407fe407060d43c
2021-11-26 05:26:27 +00:00
Treehugger Robot
e5864eb632 Merge "[MS06] Add carrier template fields into cloud backup/restore" 2021-11-26 05:07:26 +00:00
Treehugger Robot
66a67824a7 Merge "Clear calling identity when notifying alert/limit reached" am: 8c2ccc1a91
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1896540

Change-Id: If2b8b6e8b8856d6db2aa167484c71163e06828c2
2021-11-26 03:47:01 +00:00
Treehugger Robot
8c2ccc1a91 Merge "Clear calling identity when notifying alert/limit reached" 2021-11-26 03:28:58 +00:00
Junyu Lai
7d7e1ca87b [MS06] Add carrier template fields into cloud backup/restore
NetworkTemplate with MATCH_CARRIER can be created in NPMS,
and can be backup by SettingsBackupAgent. However, since
the meteredness is not stored in the backup. After incorrectly
deducing from match rule, meteredness always becomes
METERED_ALL after restoring from backup.

This change also adds debug log if any non-persistable template
is being backed up.

Test: TH, dedicated test is included in the follow-up CL.
Bug: 204830222

Change-Id: I865b1d6e571ed998a75b776f01afc7c2534af2dc
2021-11-26 03:04:37 +00:00
gary-wzl77
92304baa2c net: fix NPE when reading IP configurations
When the default gateway is not used in IP configurations,
for example the gateway info in ip configurations was fed with
custom gateway address

```
    out.writeUTF(GATEWAY_KEY);
    out.writeInt(0);  // Default route.
    out.writeInt(1);  // Have a gateway.
    out.writeUTF(staticIpConfiguration.getGateway().getHostAddress());
```

A NPE occurred.

When there is no destination, assume it is default route and use
the gateway address in all cases.

Test: manual
Change-Id: I5904efad5d277de6724f81d99e62c21ff8347caa
Signed-off-by: gary-wzl77 <gary.wang@canonical.com>
2021-11-25 22:05:31 +08:00
Junyu Lai
ee13d6aeee Clear calling identity when notifying alert/limit reached
When the NetworkStatsProvider reports alert/limit reached,
NetworkStatsService will relay the event to other services
such as NPMS or NMS. The identity should be cleared before
calling into other services.

Test: TH
Bug: 181106917
Change-Id: I2a7b273dc30156a84b30566319894ec3a42d4429
2021-11-25 06:53:52 +00:00
Remi NGUYEN VAN
d00247b308 Merge "Remove AsyncChannel usage in NsdManager" am: c882adba33
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1823015

Change-Id: I06087e1d4828f4fee7a1b9a42e8bb2596e22684c
2021-11-22 06:19:18 +00:00
Remi NGUYEN VAN
c882adba33 Merge "Remove AsyncChannel usage in NsdManager" 2021-11-22 05:58:15 +00:00
Xin Li
7fcc316196 Merge sc-qpr1-dev-plus-aosp-without-vendor@7810918
Bug: 205056467
Merged-In: I13199bc39e9445929195f3d15579cbffe94e92b0
Change-Id: I35fa3c6c2abf679c51033f1395a08d511ed8739f
2021-11-18 17:00:37 +00:00
Maciej Żenczykowski
ac792aafc7 bpf is required so /sys/fs/bpf/map_netd_app_uid_stats_map always exists
(we cannot just remove the argument, since the test code path still
 goes via the legacy xt_qtaguid code paths with sample data)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I044d0363aaab0dbbb90c40ca466cc48f169d649a
2021-11-18 06:11:00 +00:00
Maciej Żenczykowski
26929b1c5d bpf is required - remove mUseBpfTrafficStats field
Test: git grep mUseBpfTrafficStats
  TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0be3b802e2ebd175b2a58061bf821aba02a8ec8a
2021-11-18 06:10:46 +00:00
Maciej Żenczykowski
667b94d131 bpf is required - remove checkBpfStatsEnable()
Test: git grep 'nativeGetTotalStat|nativeGetIfaceStat|nativeGetUidStat'
    - shows all locations have been updated
  git grep 'checkBpfStatsEnable'
    - find nothings relevant (just services/art-profile)
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib584ea57c39d5ab0605787b05133097fd2c82a39
2021-11-18 06:10:35 +00:00
Maciej Żenczykowski
b6d8c8c7a8 remove qtaguid parsing
This removes the legacy (and untested) xt_qtaguid
non-ebpf code path (ie. dead code).

Test: git grep 'QTAGUID_IFACE_STATS|QTAGUID_UID_STATS|parseIfaceStats|parseUidStats'
  finds nothing
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I922910238474f2cfb74eba19b219bc792ce4abc3
2021-11-18 06:10:14 +00:00
Maciej Żenczykowski
ba9fa56fc2 replace R + 1 with S
Test: TreeHugger
Bug: 170424293
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic28aa1a568bbd0b6d4f06abb7294415afd695fff
2021-11-10 18:16:42 -08:00
Remi NGUYEN VAN
62eb76e273 Remove AsyncChannel usage in NsdManager
Replace AsyncChannel with two AIDL interfaces: INsdManagerCallback and
INsdServiceConnector.

This will be helpful to move NsdManager into a module, avoiding the
dependency on the hidden AsyncChannel utility.

Bug: 190249673
Test: atest FrameworksNetTests CtsNetTestCases:NsdManagerTest
Change-Id: Id9e8feb95cbb5ba16f00893f6c3f37fced3358c1
2021-11-04 17:59:51 +09:00
Les Lee
c59e530a82 Fix normalize doesn't work on carrier template
From android 12, the subscriberId is being used for different network
types. For instances:
The TYPE_WIFI with subscriberId means that it is a merged wifi network.
The TYPE_CARRIER means that the network associate to specific carrier
network (subscriberId).

So remove the check "isMatchRuleMobile" and only check whether subscriberId
is being used in NetworkTemplate or not.

Bug: 194939211
Test: atest -c NetworkTemplateTest
Change-Id: I80c9f887cf8b4714716d657da92ed273a532ce27
2021-11-04 14:12:09 +08:00
paulhu
00e3456488 Replace @hide APIs in IpSecService
- Replace Slog with Log
- Replace Binder.withCleanCallingIdentity with
  BinderUtils.withCleanCallingIdentity

Bug: 204153604
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I63083b3a4e50afe5154b4e8585d0eee46da819c6
2021-10-28 06:39:38 +00:00
Aaron Huang
35cc186110 Adapt NET_CAPABILITY_TEMPORARILY_NOT_METERED in NetworkIdentity
NET_CAPABILITY_TEMPORARILY_NOT_METERED is a capability indicates
networks are generally metered, but are currently unmetered.
NetworkIdentity currently did not consider it which will cause
Settings shows high data usage. To exclude unmetered 5g from the
metered usage, NetworkIdentity should consider a network with
NET_CAPABILITY_TEMPORARILY_NOT_METERED capabilities as not metered.

Bug: 183776809
Test: FrameworksNetTests:NetworkIdentityTest
Change-Id: Iadbc082b52f16708207e8aecf0904356bc0898ab
2021-10-26 05:57:24 +00:00
Aaron Huang
559c51f903 Have buildTemplateMobileWithRatType take metered parameter
To support unmetered 5g, have buildTemplateMobileWithRatType take
metered parameter to build a template which could be used to filter
an unmetered network.

Bug: 183776809
Test: atest FrameworksNetTests:NetworkStatsServiceTest
Change-Id: Ia310d90eceeb572a35ce9518de02b198cae16705
Merged-In: Ia310d90eceeb572a35ce9518de02b198cae16705
2021-10-25 15:10:15 +00:00
Aaron Huang
7cf5cd3044 Respect metered filter in matchesMobile*
In old design, only metered mobile network would be matched,
which means that only metered stats could be read if callers
query the mobile stats.

Currently, the caller in NetworkPolicyManagerService was updated
to use the NetworkTemplate constructor with metered parameter in
aosp/1563312 which means that the template will be created by a
given meteredness. Thus, the hardcode metered can be removed.

Remove the metered check from matches method will cause a
different behavior. Therefore, to keep the original behavior,
if the match rule is MATCH_MOBILE or MATCH_MOBILE_WILDCARD,
it should pass METERED_YES to the constructor to build a
metered template.

Also, if a caller creates a template by calling the constructor
with metered as a parameter, the behavior will also be changed.
Therefore, if the caller expects to get metered stats then it
should change to pass METERED_YES. If the caller expects to get
both metered and unmetered stats then it should remain METERED_ALL
and it would be a bug that been fixed by this patch.

Bug: 183776809
Bug: 202092687
Test: atest FrameworksNetTests:NetworkStatsServiceTest
      manually test by generating traffic and check the data counts
      from "adb shell dumpsys netstats --uid" almost equal to the
      result from "adb shell cmd stats pull-source 10082"
Change-Id: I66dd51b020f6d895cd002acc05bef6b6315cd447
Merged-In: I66dd51b020f6d895cd002acc05bef6b6315cd447
2021-10-25 15:09:21 +00:00
Xin Li
7dacadb1ea [automerger skipped] Merge "Merge Android 12" am: c03b0fa033 -s ours am: c259e66801 -s ours am: bbc8ff259a -s ours
am skip reason: Merged-In Iba1443da42161f4a41830081f2e1985b30444cc0 with SHA-1 ee05ff24d8 is already in history

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

Change-Id: I25a7ef9d68d597dae37704c4b0f4e36b5e34478e
2021-10-08 07:56:37 +00:00
Xin Li
bbc8ff259a [automerger skipped] Merge "Merge Android 12" am: c03b0fa033 -s ours am: c259e66801 -s ours
am skip reason: Merged-In Iba1443da42161f4a41830081f2e1985b30444cc0 with SHA-1 ee05ff24d8 is already in history

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

Change-Id: Ie051fa26cd626cb4d9a5a9e54ca3e42a340dc024
2021-10-08 01:39:21 +00:00
Xin Li
be0b993fae Merge Android 12
Bug: 202323961
Merged-In: Iba1443da42161f4a41830081f2e1985b30444cc0
Change-Id: I2bebe60bb7114706a3ba6af35522268cdf031f41
2021-10-06 22:53:28 +00:00
Luke Huang
2715753fca Merge "Keep the native mdns daemon alive for pre-S application" am: b2d3a48ae8 am: 67584fa3fe am: 260cbdfab6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1763368

Change-Id: Ib6e173d0b68469d596cf8491b729d50ed1f5263a
2021-09-29 04:26:15 +00:00
Luke Huang
260cbdfab6 Merge "Keep the native mdns daemon alive for pre-S application" am: b2d3a48ae8 am: 67584fa3fe
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1763368

Change-Id: I0312c8abb2eb11d8f788ca915a13ba0f23b5430a
2021-09-29 04:10:28 +00:00
Luke Huang
67584fa3fe Merge "Keep the native mdns daemon alive for pre-S application" am: b2d3a48ae8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1763368

Change-Id: Id0f1e097c9903897a35846e0ec6026d29228a39a
2021-09-29 03:50:49 +00:00
Luke Huang
b2d3a48ae8 Merge "Keep the native mdns daemon alive for pre-S application" 2021-09-29 03:35:20 +00:00
Aaron Huang
049dc2d23d Merge "Remove forceAllNetworkTypes from test" am: bc48cdaf46 am: 478733ce72 am: 5e54c22073
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1824613

Change-Id: I3cf9ca855b0a98c1bd65772e6617809a8c7194bb
2021-09-17 12:53:36 +00:00