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
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
- 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
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
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
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
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
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>
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
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
Merged-In: I80c9f887cf8b4714716d657da92ed273a532ce27
(cherry picked from commit e6498416d6)
Merged-In:I80c9f887cf8b4714716d657da92ed273a532ce27
(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
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
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
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
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
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
A test should test the actual behavior as much as possible.
However, if the flag is true, matchesMobile/matchesMobileWildcard
will always return true regardless of the network type and metered.
Thus, remove this flag would be closer to the actual behavior.
Bug: 183776809
Test: atest FrameworksNetTests
Change-Id: I0907a08ca1dd8a14a738db4057ea5ff6a0cd925a