An exclamation mark on the Android 5.1 WiFi icon and its solution

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/w6980112/article/details/45843129

  第一次调试android5.1的 WIFI更改小功能

The relevant path directory of Wifi source code
packages/apps/settings/src/com/android/settings/wifi/
frameworks/base/wifi/java/android/net/wifi/
Frameworks/base/services/core/java/com/android/server/connectivity
frameworks/opt/net/wifi/service/java/com/android/server/wifi/
Frameworks/base/core/

Positioning on the one hand according to the screen display information, on the other hand see Logcat captured information, from which will find useful. Logcat will tell you some clues. There is also the relevant code distribution directory. Will use Baidu Google search information, android5.1 WiFi,
Wifi_no_internet, no Internet Access detected, won\ ' t automatically reconnect .......

1, the framework layer plus printing information first declare header file import Android.util.Log;
When printing information, note the upper and lower positions, such as not under return XX, and note that the name of the variable changes, the object will change. Numnointernetaccessrepor or Xxx.umnointernetaccessreports
Can I re-edit it?
2, packages/apps/settings/res/is the screen display of the string information resources,
No Internet Access detected, won\ ' t automatically reconnect. Can be in
Search for Wifi_no_internet strings under PACKAGES/APPS/SETTINGS/SRC. Where to print the Out Summary.append (context.getstring (r.string.wifi_no_internet));
else if (mconfig! = null && mconfig.hasnointernetaccess ())
Then trace the mconfig.hasnointernetaccess () function,
public Boolean hasnointernetaccess () {
Return numnointernetaccessreports > 0 &&!validatedinternetaccess;
}
Again tracking numnointernetaccessreports, in this point, in a number of directions, need to analyze the grammar, most likely to go that piece.
Execute command grep numnointernetaccessreports-rn./frameworks/
The target in the path is as follows: Frameworks/opt/net/wifi/service/java/com/android/server/wifi/wifistatemachine.java +7648
Need to study this function public boolean processmessage (Message message) {}
Find the invocation of this function networkstatus ().
In Frameworks/base/core/java/android/net/networkagent.java +194 case cmd_report_network_status: {
if (vdbg) {
Log ("Cmd_report_network_status (" +
(Msg.arg1 = = Valid_network?) "VALID)": "INVALID)");
}
NetworkStatus (MSG.ARG1);
Then Trace Md_report_network_status in
Frameworks/base/services/core/java/com/android/server/connectivityservice.java +1988
Then trace case networkmonitor.event_network_tested in
Frameworks/base/services/core/java/com/android/server/connectivity/networkmonitor.java +360
Find this class private class Offlinestate extends state
Private final state mofflinestate = new Offlinestate ()

Find Mofflinestate again in
Frameworks/base/services/core/java/com/android/server/connectivity/networkmonitor.java +487
Study the function of Transitionto (mofflinestate)
The root cause is because of the iscaptiveportal () function, where the defined path is
Frameworks/base/services/core/java/com/android/server/connectivity/networkmonitor.java +635
Check the data is to try to access the Android URL, based on the value of the HTTP return to determine whether the network is connected, which returned to 204 is normal, but because the domestic blocked the URL, so in China This feature does not apply, so the WiFi signal has an exclamation mark.

The workaround is if (!miscaptiveportalcheckenabled) return 204 Let this sentence be set, the tracking code is called in the
miscaptiveportalcheckenabled = Settings.Global.getInt (Mcontext.getcontentresolver (), Settings.Global.CAPTIVE_ portal_detection_enabled, 1) = = 1;
Tracking Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED
Path in
Android-5.1-m200-mr1/frameworks/base/core/java/android/provider/settings.java +6175
Follow the instructions to change the above macro to 0 to turn off this function. We follow the principle of not changing the Android source code, not directly change,
Add such a word to the/frameworks/base/packages/settingsprovider/res/values/defaults.xml
1

At Frameworks/base/packages/settingsprovider/src/com/android/providers/settings/databasehelper.java +2648
Add loadintegersetting (stmt, Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED, R.integer.def_captive_portal_ detection_enabled);
Frameworks/base/packages/settingsprovider/src/com/android/providers/settings/databasehelper.java This file is used to generate setting.db.

Frameworks/base/packages/settingsprovider/res/values/defaults.xml
The factory default initial values for each table in the setting.db are generally placed in this file and read in the Databasehelper.java.

Then add the device/ingenic/dorado/overlay/frameworks/base/packages/settingsprovider/res/values/in the device configuration file of your manufacturer Defaults.xml

In this case can be re-initialized to the macro 0 this value, compile the Android source code, and then compile to this side, so that the previous to cover out, later in the code to see clearly the way Android default configuration is open for 1.
0

An exclamation mark on the Android 5.1 WiFi icon and its solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.