Permanent fix for Bluetooth battery drain on stock 7.1 N108

Search This thread

boxes

Senior Member
Sep 10, 2009
280
96
I found a permanent fix for the Bluetooth battery drain bug on stock 7.1, the last n108 release.

Root is required for this fix.


First, go to developer settings and enable Bluetooth hci Snoop log. Reboot. Then disable the Bluetooth hci log. Reboot.

Next, using a root file explorer (I used ES file explorer), navigate to /system/etc/Bluetooth/
Open bt_stack.conf

Near the top is "BtSnoopConfigFromFile=false"
Change it to true, then make sure the following two lines are set to false.
BtSnoopLogOutput=false
BtSnoopExtDump=false

Save the file and reboot.

After some browsing on the nextbit forums, someone had identified that the Bluetooth Snoop hci log was being written to the root directory of /sdcard/, causing significant battery drain. Their solution was to toggle the Bluetooth log on in developer settings, reboot, turn it off, then reboot again. It would always turn itself back on though. This prevents that.
(Bluetooth hci log is a file where android literally records all Bluetooth traffic information, which as you might imagine is CPU and I/o intensive. Normally used by devs for troubleshooting).

I decided to go back to stock due to constant bugs and freezes with the lineage 14.1 builds. Battery life has even been a little better on stock, with rock solid stability.

This prevents the battery drain aspect, but the battery settings still has a reporting error that attributes much more drain to Bluetooth than it should. I'm still getting 3-4hrs screen on time with lots of Bluetooth use after this fix. Better battery stats will provide accurate drain stats.
 
Last edited:

Bleser

Member
Jun 21, 2018
5
2
This is excellent information - thanks for posting - however, I get stuck when trying to save the proposed changes to bt_stack.conf; the file is read-only and I cannot figure out how to change it to allow me to save the changes. How did you do that on the stock ROM?
 

boxes

Senior Member
Sep 10, 2009
280
96
This is excellent information - thanks for posting - however, I get stuck when trying to save the proposed changes to bt_stack.conf; the file is read-only and I cannot figure out how to change it to allow me to save the changes. How did you do that on the stock ROM?

Is your phone rooted? I used ES File explorer with "root mode" enabled. You can only make changes to the file with a root elevated program. There is also solid file explorer and root file explorer as other options that may work. I should have mentioned root is required.

I believe ES file explorer changes the permission automatically when in root mode, to allow changes. Other apps may require manually changing the permissions of the BT config file.

I did also run 'hide magisk manager" in the magisk settings.
 
Last edited:

Bleser

Member
Jun 21, 2018
5
2
Is your phone rooted? I used ES File explorer with "root mode" enabled. You can only make changes to the file with a root elevated program. There is also solid file explorer and root file explorer as other options that may work. I should have mentioned root is required.

I believe ES file explorer changes the permission automatically when in root mode, to allow changes. Other apps may require manually changing the permissions of the BT config file.

Hi @boxes,

No, it is not rooted. I will try ES File explorer. Thanks!
 

boxes

Senior Member
Sep 10, 2009
280
96
Hi @boxes,

No, it is not rooted. I will try ES File explorer. Thanks!

You will need to be rooted to do this. If you root with magisk, then you can still pass the safetynet check.

Rooting the robin is very easy luckily.

Follow these steps to unlock the bootloader and flash TWRP.
https://xdaforums.com/nextbit-robin/general/guide-install-twrp-root-robin-t3334171
(Use this TWRP rather than the one on that thread-)
https://xdaforums.com/nextbit-robin/orig-development/recovery-twrp-3-0-0-0-touch-recovery-t3334152

Then download magisk from here-
https://xdaforums.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445

Also download the magisk manager APK. Flash magisk from TWRP then install magisk manger in android.
 
Last edited:

Bleser

Member
Jun 21, 2018
5
2
Is your phone rooted? I used ES File explorer with "root mode" enabled. You can only make changes to the file with a root elevated program. There is also solid file explorer and root file explorer as other options that may work. I should have mentioned root is required.

I believe ES file explorer changes the permission automatically when in root mode, to allow changes. Other apps may require manually changing the permissions of the BT config file.

You will need to be rooted to do this. If you root with magisk, then you can still pass the safetynet check.

Rooting the robin is very easy luckily.

Follow these steps to unlock the bootloader and flash TWRP.
https://xdaforums.com/nextbit-robin/general/guide-install-twrp-root-robin-t3334171
(Use this TWRP rather than the one on that thread-)
https://xdaforums.com/nextbit-robin/orig-development/recovery-twrp-3-0-0-0-touch-recovery-t3334152

Then download magisk from here-
https://xdaforums.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445

Also download the magisk manager APK. Flash magisk from TWRP then install magisk manger in android.

Thanks again for your help!
 

iscaela

Senior Member
Aug 31, 2010
65
14
I found a permanent fix for the Bluetooth battery drain bug on stock 7.1, the last n108 release.

Root is required for this fix.


First, go to developer settings and enable Bluetooth hci Snoop log. Reboot. Then disable the Bluetooth hci log. Reboot.

Next, using a root file explorer (I used ES file explorer), navigate to /system/etc/Bluetooth/
Open bt_stack.conf

Near the top is "BtSnoopConfigFromFile=false"
Change it to true, then make sure the following two lines are set to false.
BtSnoopLogOutput=false
BtSnoopExtDump=false

Save the file and reboot.

After some browsing on the nextbit forums, someone had identified that the Bluetooth Snoop hci log was being written to the root directory of /sdcard/, causing significant battery drain. Their solution was to toggle the Bluetooth log on in developer settings, reboot, turn it off, then reboot again. It would always turn itself back on though. This prevents that.
(Bluetooth hci log is a file where android literally records all Bluetooth traffic information, which as you might imagine is CPU and I/o intensive. Normally used by devs for troubleshooting).

I decided to go back to stock due to constant bugs and freezes with the lineage 14.1 builds. Battery life has even been a little better on stock, with rock solid stability.

This prevents the battery drain aspect, but the battery settings still has a reporting error that attributes much more drain to Bluetooth than it should. I'm still getting 3-4hrs screen on time with lots of Bluetooth use after this fix. Better battery stats will provide accurate drain stats.

For extra security you can change the permissions of the .conf file to read only for all groups.

Bless you! I should have looked into this earlier but never got around to it, having just left Bluetooth off except when charging. Will see if I can do a bind mount over the file with Magisk so I can leave the system image read-only.

---------- Post added 3rd July 2018 at 12:00 AM ---------- Previous post was 2nd July 2018 at 11:57 PM ----------

In the process of looking this up, I discovered a Magisk module to fix the Bluetooth config problem already exists:
https://xdaforums.com/apps/magisk/module-disable-bluetooth-hci-snoop-log-t3680223
You do not need to edit your system image, just install Magisk and then use Magisk Manager to install this module.
 
Last edited:

boxes

Senior Member
Sep 10, 2009
280
96
Bless you! I should have looked into this earlier but never got around to it, having just left Bluetooth off except when charging. Will see if I can do a bind mount over the file with Magisk so I can leave the system image read-only.

---------- Post added 3rd July 2018 at 12:00 AM ---------- Previous post was 2nd July 2018 at 11:57 PM ----------

In the process of looking this up, I discovered a Magisk module to fix the Bluetooth config problem already exists:
https://xdaforums.com/apps/magisk/module-disable-bluetooth-hci-snoop-log-t3680223
You do not need to edit your system image, just install Magisk and then use Magisk Manager to install this module.

I tried that and it didn't work for me, I replied to the thread a while back. At least with magisk v16.

Are you concerned about passing the safetynet check? I ran the check in magisk manager and passed, both ctsProfile:true and basicIntegrity:true

I'm still able to download apps from the play store that block rooted/modified devices. Magisk is masking the changes perhaps.

edit: I tinkered with magisk, enabling "hide magisk manager" and now it wont pass safetynet check. So I reinstalled magisk manager. This time I didnt "hide magisk manager", but I enabled "magisk core only mode" and checked the box for "Magisk Hide" and "Systemless Hosts" (I use adaway), now it passes the safetynet check again.
 
Last edited:

iscaela

Senior Member
Aug 31, 2010
65
14
I tried that and it didn't work for me, I replied to the thread a while back. At least with magisk v16.

Are you concerned about passing the safetynet check? I ran the check in magisk manager and passed, both ctsProfile:true and basicIntegrity:true

I'm still able to download apps from the play store that block rooted/modified devices. Magisk is masking the changes perhaps.
After installing the module, I had to turn "Enable Bluetooth HCI snoop log" on in "Developer options", reboot, and turn it back off again, but it seems to have worked and /sdcard/btsnoop_hci.log stopped growing in size.
The file was also not recreated after I deleted it and rebooted one more time. So I think the extra steps are necessary whether using the module or editing the original file in the system image (there's lingering config data which could in theory be handled in the module as well if ).

edit: I tinkered with magisk, enabling "hide magisk manager" and now it wont pass safetynet check. So I reinstalled magisk manager. This time I didnt "hide magisk manager", but I enabled "magisk core only mode" and checked the box for "Magisk Hide" and "Systemless Hosts" (I use adaway), now it passes the safetynet check again.
I've had Magisk installed since I first got the phone and except for a brief period in mid 2017, SafetyNet checks have been passing with "Magisk Hide" alone, without selecting "core only mode" (which disables modules). I'm also using "Systemless hosts" for AdAway.
 
Last edited:

boxes

Senior Member
Sep 10, 2009
280
96
@iscaela
How long has it been since you did that? Just the process of enabling/disabling in dev options would fix it for a day or two in my experience.
 

iscaela

Senior Member
Aug 31, 2010
65
14
@iscaela
How long has it been since you did that? Just the process of enabling/disabling in dev options would fix it for a day or two in my experience.
Just over 12 hours today. I've rebooted twice recently and it's stayed the same. I doubt there's a time component to it reverting, the config loading is pretty simple.

Interestingly, bluedroid is still listening on port 8872 as documented at https://android.googlesource.com/platform/external/bluetooth/bluedroid/+/master/doc/btsnoop_net.md but isn't producing any traces.
 

iscaela

Senior Member
Aug 31, 2010
65
14
Just over 12 hours today. I've rebooted twice recently and it's stayed the same. I doubt there's a time component to it reverting, the config loading is pretty simple.

Interestingly, bluedroid is still listening on port 8872 as documented at https://android.googlesource.com/platform/external/bluetooth/bluedroid/+/master/doc/btsnoop_net.md but isn't producing any traces.

So the most recent reboot did enable the setting and created /sdcard/btsnoop_hci.log again. The reason appears to be the module leaves BtSnoopConfigFromFile=false.

I'm going to update the module to edit this and report back.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    I found a permanent fix for the Bluetooth battery drain bug on stock 7.1, the last n108 release.

    Root is required for this fix.


    First, go to developer settings and enable Bluetooth hci Snoop log. Reboot. Then disable the Bluetooth hci log. Reboot.

    Next, using a root file explorer (I used ES file explorer), navigate to /system/etc/Bluetooth/
    Open bt_stack.conf

    Near the top is "BtSnoopConfigFromFile=false"
    Change it to true, then make sure the following two lines are set to false.
    BtSnoopLogOutput=false
    BtSnoopExtDump=false

    Save the file and reboot.

    After some browsing on the nextbit forums, someone had identified that the Bluetooth Snoop hci log was being written to the root directory of /sdcard/, causing significant battery drain. Their solution was to toggle the Bluetooth log on in developer settings, reboot, turn it off, then reboot again. It would always turn itself back on though. This prevents that.
    (Bluetooth hci log is a file where android literally records all Bluetooth traffic information, which as you might imagine is CPU and I/o intensive. Normally used by devs for troubleshooting).

    I decided to go back to stock due to constant bugs and freezes with the lineage 14.1 builds. Battery life has even been a little better on stock, with rock solid stability.

    This prevents the battery drain aspect, but the battery settings still has a reporting error that attributes much more drain to Bluetooth than it should. I'm still getting 3-4hrs screen on time with lots of Bluetooth use after this fix. Better battery stats will provide accurate drain stats.