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
packages_apps_Settings
Commits
de58555d
Commit
de58555d
authored
13 years ago
by
Irfan Sheriff
Committed by
Android (Google) Code Review
13 years ago
Browse files
Options
Download
Plain Diff
Merge "Fixed wifi refresh bug, b/5021754"
parents
06285deb
e2c6e752
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
src/com/android/settings/wifi/AccessPoint.java
src/com/android/settings/wifi/AccessPoint.java
+20
-16
No files found.
src/com/android/settings/wifi/AccessPoint.java
View file @
de58555d
...
...
@@ -71,7 +71,6 @@ class AccessPoint extends Preference {
private
int
mRssi
;
private
WifiInfo
mInfo
;
private
DetailedState
mState
;
private
ImageView
mSignal
;
static
int
getSecurity
(
WifiConfiguration
config
)
{
if
(
config
.
allowedKeyManagement
.
get
(
KeyMgmt
.
WPA_PSK
))
{
...
...
@@ -145,12 +144,14 @@ class AccessPoint extends Preference {
super
(
context
);
setWidgetLayoutResource
(
R
.
layout
.
preference_widget_wifi_signal
);
loadConfig
(
config
);
refresh
();
}
AccessPoint
(
Context
context
,
ScanResult
result
)
{
super
(
context
);
setWidgetLayoutResource
(
R
.
layout
.
preference_widget_wifi_signal
);
loadResult
(
result
);
refresh
();
}
AccessPoint
(
Context
context
,
Bundle
savedState
)
{
...
...
@@ -204,17 +205,16 @@ class AccessPoint extends Preference {
@Override
protected
void
onBindView
(
View
view
)
{
s
etTitle
(
ssid
);
mS
ignal
=
(
ImageView
)
view
.
findViewById
(
R
.
id
.
signal
);
s
uper
.
onBindView
(
view
);
ImageView
s
ignal
=
(
ImageView
)
view
.
findViewById
(
R
.
id
.
signal
);
if
(
mRssi
==
Integer
.
MAX_VALUE
)
{
mS
ignal
.
setImageDrawable
(
null
);
s
ignal
.
setImageDrawable
(
null
);
}
else
{
mSignal
.
setImageResource
(
R
.
drawable
.
wifi_signal
);
mSignal
.
setImageState
((
security
!=
SECURITY_NONE
)
?
signal
.
setImageLevel
(
getLevel
());
signal
.
setImageResource
(
R
.
drawable
.
wifi_signal
);
signal
.
setImageState
((
security
!=
SECURITY_NONE
)
?
STATE_SECURED
:
STATE_NONE
,
true
);
}
refresh
();
super
.
onBindView
(
view
);
}
@Override
...
...
@@ -245,14 +245,19 @@ class AccessPoint extends Preference {
}
boolean
update
(
ScanResult
result
)
{
// We do not call refresh() since this is called before onBindView().
if
(
ssid
.
equals
(
result
.
SSID
)
&&
security
==
getSecurity
(
result
))
{
if
(
WifiManager
.
compareSignalLevel
(
result
.
level
,
mRssi
)
>
0
)
{
int
oldLevel
=
getLevel
();
mRssi
=
result
.
level
;
if
(
getLevel
()
!=
oldLevel
)
{
notifyChanged
();
}
}
// This flag only comes from scans, is not easily saved in config
if
(
security
==
SECURITY_PSK
)
if
(
security
==
SECURITY_PSK
)
{
pskType
=
getPskType
(
result
);
}
refresh
();
return
true
;
}
return
false
;
...
...
@@ -260,7 +265,8 @@ class AccessPoint extends Preference {
void
update
(
WifiInfo
info
,
DetailedState
state
)
{
boolean
reorder
=
false
;
if
(
info
!=
null
&&
networkId
!=
-
1
&&
networkId
==
info
.
getNetworkId
())
{
if
(
info
!=
null
&&
networkId
!=
WifiConfiguration
.
INVALID_NETWORK_ID
&&
networkId
==
info
.
getNetworkId
())
{
reorder
=
(
mInfo
==
null
);
mRssi
=
info
.
getRssi
();
mInfo
=
info
;
...
...
@@ -309,13 +315,11 @@ class AccessPoint extends Preference {
return
"\""
+
string
+
"\""
;
}
/** Updates the title and summary; may indirectly call notifyChanged() */
private
void
refresh
()
{
if
(
mSignal
==
null
)
{
return
;
}
Context
context
=
getContext
();
mSignal
.
setImageLevel
(
getLevel
());
setTitle
(
ssid
);
Context
context
=
getContext
();
if
(
mState
!=
null
)
{
// This is the active connection
setSummary
(
Summary
.
get
(
context
,
mState
));
}
else
if
(
mRssi
==
Integer
.
MAX_VALUE
)
{
// Wifi out of range
...
...
This diff is collapsed.
Click to expand it.
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