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
9b6420bc
Commit
9b6420bc
authored
1 year ago
by
Motomu Utsumi
Committed by
Gerrit Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "Update mActiveIdleTimers to use netId as a key" into main
parents
0b5d7850
473c38d1
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
service/src/com/android/server/ConnectivityService.java
+11
-7
11 additions, 7 deletions
service/src/com/android/server/ConnectivityService.java
with
11 additions
and
7 deletions
service/src/com/android/server/ConnectivityService.java
+
11
−
7
View file @
9b6420bc
...
...
@@ -11468,7 +11468,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
// If there is no default network, default network is considered active to keep the existing
// behavior. Initial value is used until first connect to the default network.
private volatile boolean mIsDefaultNetworkActive = true;
private final ArrayMap<String, IdleTimerParams> mActiveIdleTimers = new ArrayMap<>();
// Key is netId. Value is configured idle timer information.
private final SparseArray<IdleTimerParams> mActiveIdleTimers = new SparseArray<>();
private static class IdleTimerParams {
public final int timeout;
...
...
@@ -11496,7 +11497,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
public void handleReportNetworkActivity(NetworkActivityParams activityParams) {
ensureRunningOnConnectivityServiceThread();
if (mActiveIdleTimers.
isEmpty()
) {
if (mActiveIdleTimers.
size() == 0
) {
// This activity change is not for the current default network.
// This can happen if netd callback post activity change event message but
// the default network is lost before processing this message.
...
...
@@ -11572,6 +11573,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
*/
private boolean setupDataActivityTracking(NetworkAgentInfo networkAgent) {
final String iface = networkAgent.linkProperties.getInterfaceName();
final int netId = networkAgent.network().netId;
final int timeout;
final int type;
...
...
@@ -11596,7 +11598,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
if (timeout > 0 && iface != null) {
try {
mActiveIdleTimers.put(
iface
, new IdleTimerParams(timeout, type));
mActiveIdleTimers.put(
netId
, new IdleTimerParams(timeout, type));
mNetd.idletimerAddInterface(iface, timeout, Integer.toString(type));
return true;
} catch (Exception e) {
...
...
@@ -11612,6 +11614,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
*/
private void removeDataActivityTracking(NetworkAgentInfo networkAgent) {
final String iface = networkAgent.linkProperties.getInterfaceName();
final int netId = networkAgent.network().netId;
final NetworkCapabilities caps = networkAgent.networkCapabilities;
if (iface == null) return;
...
...
@@ -11627,11 +11630,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
try {
updateRadioPowerState(false /* isActive */, type);
final IdleTimerParams params = mActiveIdleTimers.
remove(iface
);
final IdleTimerParams params = mActiveIdleTimers.
get(netId
);
if (params == null) {
// IdleTimer is not added if the configured timeout is 0 or negative value
return;
}
mActiveIdleTimers.remove(netId);
// The call fails silently if no idle timer setup for this interface
mNetd.idletimerRemoveInterface(iface, params.timeout,
Integer.toString(params.transportType));
...
...
@@ -11702,9 +11706,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
pw.print("mIsDefaultNetworkActive="); pw.println(mIsDefaultNetworkActive);
pw.println("Idle timers:");
try {
for (
Map.Entry<String, IdleTimerParams> ent :
mActiveIdleTimers.
entrySet()
) {
pw.print(" "); pw.print(
ent.getKey(
)); pw.println(":");
final IdleTimerParams params =
ent.getValue(
);
for (
int i = 0; i <
mActiveIdleTimers.
size(); i++
) {
pw.print(" "); pw.print(
mActiveIdleTimers.keyAt(i
)); pw.println(":");
final IdleTimerParams params =
mActiveIdleTimers.valueAt(i
);
pw.print(" timeout="); pw.print(params.timeout);
pw.print(" type="); pw.println(params.transportType);
}
...
...
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