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
f1c04ca9
Commit
f1c04ca9
authored
1 year ago
by
Mark Chien
Committed by
Gerrit Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "SyncSM11.1 make some functions inline" into main
parents
005fb887
2ca4b1d1
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
Tethering/src/com/android/networkstack/tethering/Tethering.java
+56
-67
56 additions, 67 deletions
...ing/src/com/android/networkstack/tethering/Tethering.java
with
56 additions
and
67 deletions
Tethering/src/com/android/networkstack/tethering/Tethering.java
+
56
−
67
View file @
f1c04ca9
...
...
@@ -2734,84 +2734,73 @@ public class Tethering {
}
}
private
IpServer
.
Callback
makeControlCallback
()
{
return
new
IpServer
.
Callback
()
{
@Override
public
void
updateInterfaceState
(
IpServer
who
,
int
state
,
int
lastError
)
{
notifyInterfaceStateChange
(
who
,
state
,
lastError
);
private
class
ControlCallback
extends
IpServer
.
Callback
{
@Override
public
void
updateInterfaceState
(
IpServer
who
,
int
state
,
int
lastError
)
{
final
String
iface
=
who
.
interfaceName
();
final
TetherState
tetherState
=
mTetherStates
.
get
(
iface
);
if
(
tetherState
!=
null
&&
tetherState
.
ipServer
.
equals
(
who
))
{
tetherState
.
lastState
=
state
;
tetherState
.
lastError
=
lastError
;
}
else
{
if
(
DBG
)
Log
.
d
(
TAG
,
"got notification from stale iface "
+
iface
);
}
@Override
public
void
updateLinkProperties
(
IpServer
who
,
LinkProperties
newLp
)
{
notifyLinkPropertiesChanged
(
who
,
newLp
);
}
mLog
.
log
(
String
.
format
(
"OBSERVED iface=%s state=%s error=%s"
,
iface
,
state
,
lastError
));
@Override
public
void
dhcpLeasesChanged
()
{
maybeDhcpLeasesChanged
();
// If TetherMainSM is in ErrorState, TetherMainSM stays there.
// Thus we give a chance for TetherMainSM to recover to InitialState
// by sending CMD_CLEAR_ERROR
if
(
lastError
==
TETHER_ERROR_INTERNAL_ERROR
)
{
mTetherMainSM
.
sendMessage
(
TetherMainSM
.
CMD_CLEAR_ERROR
,
who
);
}
@Override
public
void
requestEnableTethering
(
int
tetheringType
,
boolean
enabled
)
{
mTetherMainSM
.
sendMessage
(
TetherMainSM
.
EVENT_REQUEST_CHANGE_DOWNSTREAM
,
tetheringType
,
0
,
enabled
?
Boolean
.
TRUE
:
Boolean
.
FALSE
);
int
which
;
switch
(
state
)
{
case
IpServer
.
STATE_UNAVAILABLE
:
case
IpServer
.
STATE_AVAILABLE
:
which
=
TetherMainSM
.
EVENT_IFACE_SERVING_STATE_INACTIVE
;
break
;
case
IpServer
.
STATE_TETHERED
:
case
IpServer
.
STATE_LOCAL_ONLY
:
which
=
TetherMainSM
.
EVENT_IFACE_SERVING_STATE_ACTIVE
;
break
;
default
:
Log
.
wtf
(
TAG
,
"Unknown interface state: "
+
state
);
return
;
}
};
}
// TODO: Move into TetherMainSM.
private
void
notifyInterfaceStateChange
(
IpServer
who
,
int
state
,
int
error
)
{
final
String
iface
=
who
.
interfaceName
();
final
TetherState
tetherState
=
mTetherStates
.
get
(
iface
);
if
(
tetherState
!=
null
&&
tetherState
.
ipServer
.
equals
(
who
))
{
tetherState
.
lastState
=
state
;
tetherState
.
lastError
=
error
;
}
else
{
if
(
DBG
)
Log
.
d
(
TAG
,
"got notification from stale iface "
+
iface
);
mTetherMainSM
.
sendMessage
(
which
,
state
,
0
,
who
);
sendTetherStateChangedBroadcast
();
}
mLog
.
log
(
String
.
format
(
"OBSERVED iface=%s state=%s error=%s"
,
iface
,
state
,
error
));
// If TetherMainSM is in ErrorState, TetherMainSM stays there.
// Thus we give a chance for TetherMainSM to recover to InitialState
// by sending CMD_CLEAR_ERROR
if
(
error
==
TETHER_ERROR_INTERNAL_ERROR
)
{
mTetherMainSM
.
sendMessage
(
TetherMainSM
.
CMD_CLEAR_ERROR
,
who
);
}
int
which
;
switch
(
state
)
{
case
IpServer
.
STATE_UNAVAILABLE
:
case
IpServer
.
STATE_AVAILABLE
:
which
=
TetherMainSM
.
EVENT_IFACE_SERVING_STATE_INACTIVE
;
break
;
case
IpServer
.
STATE_TETHERED
:
case
IpServer
.
STATE_LOCAL_ONLY
:
which
=
TetherMainSM
.
EVENT_IFACE_SERVING_STATE_ACTIVE
;
break
;
default
:
Log
.
wtf
(
TAG
,
"Unknown interface state: "
+
state
);
@Override
public
void
updateLinkProperties
(
IpServer
who
,
LinkProperties
newLp
)
{
final
String
iface
=
who
.
interfaceName
();
final
int
state
;
final
TetherState
tetherState
=
mTetherStates
.
get
(
iface
);
if
(
tetherState
!=
null
&&
tetherState
.
ipServer
.
equals
(
who
))
{
state
=
tetherState
.
lastState
;
}
else
{
mLog
.
log
(
"got notification from stale iface "
+
iface
);
return
;
}
mLog
.
log
(
String
.
format
(
"OBSERVED LinkProperties update iface=%s state=%s lp=%s"
,
iface
,
IpServer
.
getStateString
(
state
),
newLp
));
final
int
which
=
TetherMainSM
.
EVENT_IFACE_UPDATE_LINKPROPERTIES
;
mTetherMainSM
.
sendMessage
(
which
,
state
,
0
,
newLp
);
}
mTetherMainSM
.
sendMessage
(
which
,
state
,
0
,
who
);
sendTetherStateChangedBroadcast
();
}
private
void
notifyLinkPropertiesChanged
(
IpServer
who
,
LinkProperties
newLp
)
{
final
String
iface
=
who
.
interfaceName
();
final
int
state
;
final
TetherState
tetherState
=
mTetherStates
.
get
(
iface
);
if
(
tetherState
!=
null
&&
tetherState
.
ipServer
.
equals
(
who
))
{
state
=
tetherState
.
lastState
;
}
else
{
mLog
.
log
(
"got notification from stale iface "
+
iface
);
return
;
@Override
public
void
dhcpLeasesChanged
()
{
maybeDhcpLeasesChanged
();
}
mLog
.
log
(
String
.
format
(
"OBSERVED LinkProperties update iface=%s state=%s lp=%s"
,
iface
,
IpServer
.
getStateString
(
state
),
newLp
));
final
int
which
=
TetherMainSM
.
EVENT_IFACE_UPDATE_LINKPROPERTIES
;
mTetherMainSM
.
sendMessage
(
which
,
state
,
0
,
newLp
);
@Override
public
void
requestEnableTethering
(
int
tetheringType
,
boolean
enabled
)
{
mTetherMainSM
.
sendMessage
(
TetherMainSM
.
EVENT_REQUEST_CHANGE_DOWNSTREAM
,
tetheringType
,
0
,
enabled
?
Boolean
.
TRUE
:
Boolean
.
FALSE
)
;
}
}
private
boolean
hasSystemFeature
(
final
String
feature
)
{
...
...
@@ -2853,7 +2842,7 @@ public class Tethering {
mLog
.
i
(
"adding IpServer for: "
+
iface
);
final
TetherState
tetherState
=
new
TetherState
(
new
IpServer
(
iface
,
mHandler
,
interfaceType
,
mLog
,
mNetd
,
mBpfCoordinator
,
mRoutingCoordinator
,
make
ControlCallback
(),
mConfig
,
mRoutingCoordinator
,
new
ControlCallback
(),
mConfig
,
mPrivateAddressCoordinator
,
mTetheringMetrics
,
mDeps
.
getIpServerDependencies
()),
isNcm
);
mTetherStates
.
put
(
iface
,
tetherState
);
...
...
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