Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
frameworks_opt_net_wifi
Commits
6b7f403e
Commit
6b7f403e
authored
10 years ago
by
Jeff Davidson
Committed by
Android (Google) Code Review
10 years ago
2
Browse files
Options
Download
Plain Diff
Merge "Support conversion of untrusted networks to trusted." into lmp-mr1-dev
parents
917a6ea4
3aed1e5a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
6 deletions
+35
-6
service/java/com/android/server/wifi/WifiConfigStore.java
service/java/com/android/server/wifi/WifiConfigStore.java
+2
-0
service/java/com/android/server/wifi/WifiStateMachine.java
service/java/com/android/server/wifi/WifiStateMachine.java
+33
-6
No files found.
service/java/com/android/server/wifi/WifiConfigStore.java
View file @
6b7f403e
...
...
@@ -564,6 +564,8 @@ public class WifiConfigStore extends IpConfigStore {
List
<
WifiConfiguration
>
networks
=
new
ArrayList
<>();
for
(
WifiConfiguration
config
:
mConfiguredNetworks
.
values
())
{
WifiConfiguration
newConfig
=
new
WifiConfiguration
(
config
);
// When updating this condition, update WifiStateMachine's CONNECT_NETWORK handler to
// correctly handle updating existing configs that are filtered out here.
if
(
config
.
autoJoinStatus
==
WifiConfiguration
.
AUTO_JOIN_DELETED
||
config
.
ephemeral
)
{
// Do not enumerate and return this configuration to any one,
// for instance WiFi Picker.
...
...
This diff is collapsed.
Click to expand it.
service/java/com/android/server/wifi/WifiStateMachine.java
View file @
6b7f403e
...
...
@@ -4344,12 +4344,7 @@ public class WifiStateMachine extends StateMachine {
c
.
numConnectionFailures
=
0
;
// Tell the framework whether the newly connected network is trusted or untrusted.
if
(
c
.
ephemeral
)
{
mNetworkCapabilities
.
removeCapability
(
NetworkCapabilities
.
NET_CAPABILITY_TRUSTED
);
}
else
{
mNetworkCapabilities
.
addCapability
(
NetworkCapabilities
.
NET_CAPABILITY_TRUSTED
);
}
mNetworkAgent
.
sendNetworkCapabilities
(
mNetworkCapabilities
);
updateCapabilities
(
c
);
}
if
(
c
!=
null
)
{
ScanResult
result
=
getCurrentScanResult
();
...
...
@@ -6345,9 +6340,25 @@ public class WifiStateMachine extends StateMachine {
netId
=
message
.
arg1
;
config
=
(
WifiConfiguration
)
message
.
obj
;
mWifiConnectionStatistics
.
numWifiManagerJoinAttempt
++;
boolean
updatedExisting
=
false
;
/* Save the network config */
if
(
config
!=
null
)
{
String
configKey
=
config
.
configKey
(
true
/* allowCached */
);
WifiConfiguration
savedConfig
=
mWifiConfigStore
.
getWifiConfiguration
(
configKey
);
if
(
savedConfig
!=
null
)
{
// There is an existing config with this netId, but it wasn't exposed
// (either AUTO_JOIN_DELETED or ephemeral; see WifiConfigStore#
// getConfiguredNetworks). Remove those bits and update the config.
config
=
savedConfig
;
loge
(
"CONNECT_NETWORK updating existing config with id="
+
config
.
networkId
+
" configKey="
+
configKey
);
config
.
ephemeral
=
false
;
config
.
autoJoinStatus
=
WifiConfiguration
.
AUTO_JOIN_ENABLED
;
updatedExisting
=
true
;
}
result
=
mWifiConfigStore
.
saveNetwork
(
config
,
message
.
sendingUid
);
netId
=
result
.
getNetworkId
();
}
...
...
@@ -6415,6 +6426,11 @@ public class WifiStateMachine extends StateMachine {
if
(
didDisconnect
)
{
/* Expect a disconnection from the old connection */
transitionTo
(
mDisconnectingState
);
}
else
if
(
updatedExisting
&&
getCurrentState
()
==
mConnectedState
&&
getCurrentWifiConfiguration
().
networkId
==
netId
)
{
// Update the current set of network capabilities, but stay in the
// current state.
updateCapabilities
(
config
);
}
else
{
/**
* Directly go to disconnected state where we
...
...
@@ -6570,6 +6586,17 @@ public class WifiStateMachine extends StateMachine {
}
}
private
void
updateCapabilities
(
WifiConfiguration
config
)
{
if
(
config
.
ephemeral
)
{
mNetworkCapabilities
.
removeCapability
(
NetworkCapabilities
.
NET_CAPABILITY_TRUSTED
);
}
else
{
mNetworkCapabilities
.
addCapability
(
NetworkCapabilities
.
NET_CAPABILITY_TRUSTED
);
}
mNetworkAgent
.
sendNetworkCapabilities
(
mNetworkCapabilities
);
}
private
class
WifiNetworkAgent
extends
NetworkAgent
{
public
WifiNetworkAgent
(
Looper
l
,
Context
c
,
String
TAG
,
NetworkInfo
ni
,
NetworkCapabilities
nc
,
LinkProperties
lp
,
int
score
)
{
...
...
This diff is collapsed.
Click to expand it.
Mark Stevens
@mstevens
mentioned in commit
c49eb6a7
·
8 years ago
mentioned in commit
c49eb6a7
mentioned in commit c49eb6a79fd5275d31b3937b8fe8994baf0ab169
Toggle commit list
Mark Stevens
@mstevens
mentioned in commit
49a3e82f
·
8 years ago
mentioned in commit
49a3e82f
mentioned in commit 49a3e82fc56087986a6d7c712c7c9c5f8fb9c449
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment