Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_packages_modules_Connectivity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LMODroid
platform_packages_modules_Connectivity
Commits
86b95d40
Commit
86b95d40
authored
1 year ago
by
Ken Chen
Committed by
Gerrit Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "Reference DataSaver setting from BPF map on V+ only" into main
parents
bccd95fa
9e1865e4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DnsResolver/DnsBpfHelper.cpp
+16
-8
16 additions, 8 deletions
DnsResolver/DnsBpfHelper.cpp
with
16 additions
and
8 deletions
DnsResolver/DnsBpfHelper.cpp
+
16
−
8
View file @
86b95d40
...
...
@@ -62,16 +62,24 @@ base::Result<bool> DnsBpfHelper::isUidNetworkingBlocked(uid_t uid, bool metered)
if
(
isBlockedByUidRules
(
enabledRules
.
value
(),
uidRules
))
return
true
;
// For data saver.
if
(
!
metered
)
return
false
;
// DataSaverEnabled map on V+ platforms is the only reliable source of information about the
// current data saver status. While ConnectivityService offers two ways to update this map for U
// and V+, the U- platform implementation can have delays, potentially leading to inaccurate
// results. Conversely, the V+ platform implementation is synchronized with the actual data saver
// state, making it a trustworthy source. Since this library primarily serves DNS resolvers,
// relying solely on V+ data prevents erroneous blocking of DNS queries.
if
(
android
::
modules
::
sdklevel
::
IsAtLeastV
()
&&
metered
)
{
// The background data setting (PENALTY_BOX_MATCH) and unrestricted data usage setting
// (HAPPY_BOX_MATCH) for individual apps override the system wide Data Saver setting.
if
(
uidRules
&
PENALTY_BOX_MATCH
)
return
true
;
if
(
uidRules
&
HAPPY_BOX_MATCH
)
return
false
;
// The background data setting (PENALTY_BOX_MATCH) and unrestricted data usage setting
// (HAPPY_BOX_MATCH) for individual apps override the system wide Data
Saver
s
etting
.
if
(
uidRules
&
PENALTY_BOX_MATCH
)
return
true
;
if
(
uidRules
&
HAPPY_BOX_MATCH
)
return
false
;
auto
dataSaverSetting
=
mDataSaverEnabledMap
.
readValue
(
DATA_SAVER_ENABLED_KEY
);
RETURN_IF_RESULT_NOT_OK
(
data
Saver
S
etting
);
return
dataSaverSetting
.
value
()
;
}
auto
dataSaverSetting
=
mDataSaverEnabledMap
.
readValue
(
DATA_SAVER_ENABLED_KEY
);
RETURN_IF_RESULT_NOT_OK
(
dataSaverSetting
);
return
dataSaverSetting
.
value
();
return
false
;
}
}
// namespace net
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment