9

I have seen this problem on a Nexus 4 and Nexus 5. Bluetooth is switched on unexpectedly. It can be turned off, but will come back a minute or so later.

Googling around, it seems that this could be due to a misbehaving app, but there doesn't seem to be a good solution for finding out which app.

Is there a way to find out what is responsible for reactivating Bluetooth all the time?


If it is of any use, I captured some of the adb output after disabling Bluetooth.

When disabling:

D/BluetoothManagerService(  578): disable(): mBluetooth = android.bluetooth.IBluetooth$Stub$Proxy@42d29fa0 mBinding = false
D/BluetoothManagerService(  578): Message: 2
D/BluetoothManagerService(  578): Sending off request.
D/BluetoothAdapterState(23958): CURRENT_STATE=ON, MESSAGE = USER_TURN_OFF
D/BluetoothAdapterProperties(23958): Setting state to 13
I/BluetoothAdapterState(23958): Bluetooth adapter state changed: 12-> 13
D/BluetoothAdapterService(23958): Broadcasting updateAdapterState() to 1 receivers.
D/BluetoothAdapterProperties(23958): onBluetoothDisable()
I/BluetoothAdapterState(23958): Entering PendingCommandState State: isTurningOn()=false, isTurningOff()=true
D/BluetoothManagerService(  578): Message: 60
D/BluetoothManagerService(  578): MESSAGE_BLUETOOTH_STATE_CHANGE: prevState = 12, newState=13
D/BluetoothManagerService(  578): Bluetooth State Change Intent: 12 -> 13
D/BluetoothMapService(23958): onReceive
D/BluetoothMapService(23958): STATE_TURNING_OFF
D/BluetoothMapService(23958): MAP Service closeService in
I/BtOppRfcommListener(23958): stopping Accept Thread
I/CompanionService(13584): bluetoothStateChangeReceiver action = android.bluetooth.adapter.action.STATE_CHANGED
D/CachedBluetoothDevice(14368):  Clearing all connection state for dev:Bose SoundLink Wireless Mobile speaker
D/CachedBluetoothDevice(14368):  Clearing all connection state for dev:ANDY
D/CachedBluetoothDevice(14368):  Clearing all connection state for dev:obd2ecu
D/CachedBluetoothDevice(14368):  Clearing all connection state for dev:Glass 6014
D/CachedBluetoothDevice(14368):  Clearing all connection state for dev:P311
D/CachedBluetoothDevice(14368):  Clearing all connection state for dev:Logitech MX5000 Keyboard
W/ContextImpl(14368): Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1487 android.content.ContextWrapper.startService:494 android.content.ContextWrapper.startService:494 com.android.set
tings.bluetooth.DockEventReceiver.beginStartingService:134 com.android.settings.bluetooth.DockEventReceiver.onReceive:115
D/DockEventReceiver(14368): finishStartingService: stopping service
D/BluetoothPbap(14368): Proxy object disconnected
D/PbapServerProfile(14368): Bluetooth service disconnected
W/BluetoothAdapterState(23958): Timeout will setting scan mode..Continuing with disable...
D/BluetoothAdapterState(23958): CURRENT_STATE=PENDING, MESSAGE = BEGIN_DISABLE, isTurningOn=false, isTurningOff=true
E/bt-btif (23958): btif_disable_bluetooth : not yet enabled

Then, moments later:

D/BluetoothAdapterState(23958): CURRENT_STATE=PENDING, MESSAGE = DISABLE_TIMEOUT, isTurningOn=false, isTurningOff=true
E/BluetoothAdapterState(23958): Error disabling Bluetooth
D/BluetoothAdapterProperties(23958): Setting state to 12
I/BluetoothAdapterState(23958): Bluetooth adapter state changed: 13-> 12
D/BluetoothAdapterService(23958): Broadcasting updateAdapterState() to 1 receivers.
D/BluetoothManagerService(  578): Message: 60
D/BluetoothManagerService(  578): MESSAGE_BLUETOOTH_STATE_CHANGE: prevState = 13, newState=12
D/BluetoothManagerService(  578): Broadcasting onBluetoothStateChange(true) to 13 receivers.
D/BluetoothPan(  578): onBluetoothStateChange(on) call bindService
I/BluetoothAdapterState(23958): Entering On State
andypaxo
  • 403
  • 1
  • 4
  • 11
  • Quick question, I am presuming this is for "Stock Rom" for both Nexus devices?

    If so, could you run adb shell dumpsys meminfo.. It may as well be a package you installed on yourphones which could be the culprit.

    FYI - I performed the same tests on my Nexus 5 - rooted phone with stock ROM. and all is working for me.. however I find this log line interesting where the state change from 13 -> 10 when I stopped the Bluetooth service...

    D/BluetoothManagerService( 1683): Bluetooth State Change Intent: 13 -> 10

    – Rushnosh Aug 11 '14 at 00:01
  • @Rushnosh, yes this is stock Google Android on both devices. I'll do the memory dump later and add what I find from that to the question. – andypaxo Aug 11 '14 at 00:16
  • ok, also Andriod build version if at all possible? – Rushnosh Aug 11 '14 at 00:26
  • Got the State change ID's also:

    12 = STATE_ON - BT Device is on 10 = STATE_OFF - BT Device is off 13 = STATE_TURNING_OFF - BT Device is turning off 11 = STATE_TURNING_ON - BT Device is turning ON

    More info here: http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#STATE_TURNING_OFF

    – Rushnosh Aug 11 '14 at 00:31
  • Now just compairing with your logs to mine here I noticed there is a warning when trying to clear out your Blue Tooth Devices under the Logitec Keyboard message: D/CachedBluetoothDevice(14368): Clearing all connection state for dev:Logitech MX5000 Keyboard W/ContextImpl(14368): Calling a method in the system process without a qualified user:

    Dont know if this is releated but restarting your phone, perform the on/off BT test to see if normal phone works, then connect your keyboard to see if it is your logitec not handling the disconnection.

    – Rushnosh Aug 11 '14 at 00:39
  • 1
    To answer a few questions, I have Android 4.4.4, build KTU84P. The Logitech keyboard is several kilometers away right now, so unless I've really underestimated the abilities of Bluetooth, that shouldn't be causing a problem. (The Nexus 5 has never seen the Logitech either). Also - thanks for your time so far... this is really appreciated! – andypaxo Aug 11 '14 at 03:39
  • Did you at least try restarting your phone and performing the test I requested but? – Rushnosh Aug 11 '14 at 03:59
  • 1
    Sorry about that, ran out of time last night. I restarted and now the problem has gone away! Which means we don't get an answer as to what was causing that. If / when the problem comes back, I will perform your test on the phone. Thanks for the guidance! – andypaxo Aug 11 '14 at 14:05
  • It process of elimination my friend :) ... at least the problem does not stick when you restart your phone, so now we got a baseline to work with. Now try an number of things such as ... reconnecting your keyboard and do some tests... if all works well try another thing.. from examining your logs you had a number of different BT peripherals to choose from. So give it ago, and when the problem persists, please list down the steps you have done to replicate the issue, and with this you can forward your findings to the correct group of Developers :) – Rushnosh Aug 12 '14 at 00:43
  • And dump your logcat logs as well ^_^ – Rushnosh Aug 12 '14 at 00:44

6 Answers6

4

It was the Firechat app for me. It'll be one of the most recent apps you installed if the Bluetooth started turning on out if nowhere.

3

I had the same symptom, and disabling "Bluetooth scanning" in location services resolved it:

https://stackoverflow.com/questions/34414216/using-bluetooth-scanning-for-location-accuracy-android-m

Tom Lianza
  • 131
  • 3
3

You can find out what is activating bluetooth by going to Settings -> Connections -> Bluetooth -> "..." -> Bluetooth control history.

In my case it was the bike rental app for Paris "Velib" and sadly, there seems to be no way to stop it activating bluetooth via permissions settings.

My phone is a Samsung GS7 with Android 7.0.

CMcClymont
  • 131
  • 1
1

I had the same problem. The app named Automatic that connects to a dongle that plugs into the OBD port of your car was to blame. I hate the app. I just use it occasionally to read check engine codes. Uninstalled Automatic and all is well. It's usually a misbehaving app that is the culprit.

Dennis Day
  • 111
  • 1
0

I had the same problem. This worked for me. Settings ~Application~All~Bluetooth. The disable button was not highlighted so I just cleared all data. I did the same for bluetooth share. Then I tried turn Bluetooth on an off several times to see if it would stay off and it did

Shan
  • 1
0

I had the same problem and it turned out to be an app containing incorrect codes that kept searching for Bluetooth devices in background even if the app was closed (it was a BT Messaging app).

RockSolid
  • 101
  • 2