Wifi turns automatically on when charging

I have a Fairphone first generation running Kola Nut 1.8.7. I do regular updates of my apps whenever the Playstore notifies me of new updates.

I always turn off the wifi connection before going to bed and I usually plug in the charging cable. In the last few weeks, I really don’t know since when exactly, when I got up I noticed that my phone’s wifi was on. I thought it strange, because I couldn’t recall enabling it in the first place. Since then this started to happen more and more often and now I realized, when I plug in the charger cable, eventually the wifi turns itself on automatically. Sometimes it takes a couple of minutes, sometimes it take one 5 seconds.

I was looking for this behaviour and I found a lot of threads on other android forums but they always seemed to be related to specific “smart wifi” app/settings installed by the carriers (spring, at&t, etc). And there were always US carriers. This doesn’t apply to me because I live in Germany and my carrier has no software installed on my phone.

I tried to find some obscure setting (perhaps I enabled something without realizing what I was doing) and then I went to Settings -> Wifi and then I pressed on the left button to to the advanced settings. There I found the setting “Keep Wi-Fi on during sleep”. I set this option from Always to Never, hoping that this would help but it doesn’t. Whenever I charge my phone, wifi turns itself on.

I don’t know what to do. It could be that an app got updated and brought a new setting by default like “turn wifi on when charging”, something like the “smart wifi” apps from the carriers mentioned above. I looked at many of the apps I usually use and I haven’t found any setting that goes in that direction. I cannot check every app to see which may be causing trouble, that would take me ages.

Does anybody have or had this issue? Do you know some way that I can track which app or which process is turning on the wifi? Perhaps some debugging option in the developer’s menu?


You could install an app that reads the logs (logcat) or use #dic:adb to read the logs.

Hi Stefan

thank you for your quick replay. The logcat app you mentioned, is the “CatLog - Logcat Reader” on the playstore?

There are several. I prefer open source apps. You could try this one:

Logcat (Android Logcat without Root) - https://f-droid.org/app/com.tananaev.logcat

I installed the CatLog, but I’ll test the Logcat from F-droid. In the mean time I saved a log file where I have this behaviour. Even though I cleared the log before plugin in the usb cable the log got long very quicky.

2017-06-26-22-35-44.pdf (29.5 KB)

On page at the beginning I see that wpa_supplicant is active and shortly thereafter the wifi turns itself on. However I cannot determine which process spawns the activation of the wifi. Would you please take a quick look?


Try to reset wpa_supplicant.

Well, restarting wpa_supplicant didn’t solve the problem. When I plug in a an USB cable connected to my computer or a charging usb cable the wifi turns itself on.

I wasn’t able to install Logcat (Android Logcat without Root), F-droid displays the entry gray and the “Install” button is missing. I downloaded the apk file from the website you posted and I only got an error that parsing the file went wrong.

I want to try adb but it seems I’m doing something wrong.

@home I use Gentoo and installed dev-util/android-tools (5.1.1_p13) which has the adb command.

With adb shell I was able to connect to my phone. Executing logcat gets me a lot of logs, I’m unable to find anything. Do you have a suggestion what I should be filtering for?

Okay, sorry, I’m using an alpha build of #kitkat. Seems that the app I linked to doesn’t work below Android 4.4. It’s quite a hassle to use anyway, since it works without root.

You can directly use adb logcat. Filter for wifi for example.

Another idea that came to my mind: I use the app “Autostarts” (F-Droid) to block other apps that automatically start at certain events. I have one app that starts at the event “Power disconnected”. Maybe you have an app installed that does something on “Power connected”.

I found these entries interesting

40049 D/WifiManager(19000): Enter init, sThreadRefCount:0 40050 W/System.err( 555): java.lang.SecurityException: WifiService: Neither user 10154 nor current process has android.permission.CHANGE_WIFI_STATE. 40051 W/System.err( 555): at android.app.ContextImpl.enforce(ContextImpl.java:1613) 40052 W/System.err( 555): at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1642) 40053 W/System.err( 555): at com.android.server.WifiService.enforceChangePermission(WifiService.java:641) 40054 W/System.err( 555): at com.android.server.WifiService.getWifiServiceMessenger(WifiService.java:1067) 40055 W/System.err( 555): at android.net.wifi.IWifiManager$Stub.onTransact(IWifiManager.java:408) 40056 W/System.err( 555): at android.os.Binder.execTransact(Binder.java:351) 40057 W/System.err( 555): at dalvik.system.NativeStart.run(Native Method) 40058 E/WifiManager(19000): mWifiServiceMessenger == null


40140 D/StatusBar.BatteryController( 668): mBatteryPercentage is 100% mShouldShowBatteryPercentage is true mLabelViews.size() 1 40141 D/PowerUI ( 668): action = android.intent.action.BATTERY_CHANGED 40142 D/PowerUI ( 668): Intent start() ret = false mHideLowBDialog= true 40143 D/PowerUI ( 668): oldBatteryLevel = 100mBatteryLevel = 100 40144 D/PowerUI ( 668): dismissLowBatteryWarning 40145 D/Bluetooth HS/HF( 737): [BT][HFG] [API] mStateReceiver.onReceive(android.intent.action.BATTERY_CHANGED) 40146 D/Bluetooth HS/HF( 737): [BT][HFG] [API] mHandler.handleMessage(9) 40147 D/Bluetooth HS/HF( 737): [BT][HFG] [API] updateBatteryState 40148 D/WifiService( 555): onReceive, action:android.intent.action.BATTERY_CHANGED 40149 V/Provider/Settings( 555): from settings cache , name = wifi_idle_ms , value = null 40150 V/Provider/Settings( 555): from settings cache , name = stay_on_while_plugged_in , value = 0 40151 D/WifiService( 555): ACTION_BATTERY_CHANGED pluggedType: 2

the logs appear so fast, I think this is the place where the wifi activated itself. It seems that the WifiService activates when there is a trigger from ACTION_BATTERY or something. I don’t know what to do :frowning:

I am not aware of having such an app. I haven’t installed new apps for a long time, I’ve been just updating my current apps. How could I find out if I have such an app? I’ll try the Autostarts app.


I didn’t find a “Autostarts” app on F-Droid, but I found this http://elsdoerfer.name/android-autostarts is that the app you meant?

yep thats the app. :slight_smile:

Edit: It was free on F-Droid.
Edit2: It should be available in the F-Droid archive that can be enabled in F-Droid’s settings.

Thanks a lot, I’ll try the F-Droid archives tomorrow, it’s getting late.

1 Like

Did you also disable “Scanning always available” in Settings > WiFi > Advanced?

Hi Stefan

I don’t have that option. I only have “Network notification” (not checked), “Keep Wifi on…”, “wifi optimization” (checked), “MAC Address” (read-only) and “IP Address” (also read-only).

I installed autostarts, in the “Power connected” section I have:

  • AccuWeather
  • Amazon Shopping
  • Fairphone Updater
  • Google+ (4 times)
  • Picasa Uploader
  • Google Play services (3 times)
  • IBM Verse
  • Flashlight
  • Navigation

I disabled them all (using the disable option in the autostarts app) but when I plug in the charging cord the wifi turns on again :frowning:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.