When the default Android system is first used, the mobile data connection is automatically opened. If you have a SIM card, there will be traffic. Although there is a setup wizard at the first use that prompts you if you want to turn off the data connection, it's a little uncomfortable when you see it: Mobile data is open without my consent. You may be able to close the data connection quickly, but when you have finished setting up, and then go to settings-and-traffic usage, you can see that the mobile data is generating traffic.
Recently there is such a demand, in the android4.4 off the system default data connection, combined with the Internet to find information, tracking to Connectivityservice class, location is frameworks/base/services/java/com/ Android/server,
In which the following methods are found:
public Boolean getmobiledataenabled () { //todo:this detail should probably is in Dataconnectiontracker ' s //
which is where we store the value and maybe make this // asynchronous. Enforceaccesspermission (); Boolean retVal = Settings.Global.getInt (Mcontext.getcontentresolver (), Settings.Global.MOBILE_DATA, 1) = = 1; if (vdbg) log ("getmobiledataenabled returning" + retVal); return retVal; }
The default value where you can Settings.Global.MOBILE_DATA the string corresponds to the initial value of 1,getmobiledataenabled is true. When you try to change the default value to 0, the mobile data connection still has a connection.
During the test, the mobile data is still connected and then closed. This is because Google connects to a test site the first time it is powered on, so it causes the connection to move data and generate traffic.
The solution is to find the method checkmobileprovisioning () in the Connenctivityservice.java class , and then add the following code at the beginning:
Final int uid = Binder.getcallinguid (); Log ("checkmobileprovisioning callinguid" + uid); Boolean ismobileprovision = Mcontext.getresources (). Getboolean (Com.mediatek.internal.r.bool.is_mobile_ Provision_ Enabled); Log ("Ismobileprovision:" + ismobileprovision ); if (!ismobileprovision) {
How to turn off mobile data connection for Android 4.4 first boot