Bluetooth Pairing after Reboot with Magisk Rooted Android 10

atlantix1

Senior Member
Sep 27, 2011
106
27
0
Hi all,

for Android 9, I used Magisk module "libsecure_storage companion" that allowed my device to restore bluetooth pairings (e.g. with a watch) after reboot. Without that module, any pairings are lost. Unfortunately, the module does not seem to work with Android 10. When enabled, I cannot enable WiFi anymore. Is there any workaround for that?

Thanks for any suggestion.
 
  • Like
Reactions: 3arthur6

3arthur6

Senior Member
Sep 15, 2011
413
857
123
I can confirm same issue on Note9 Q beta.
Even when putting the libsecure_storage.so directly in system library folders and disabling the secure storage props.

At data/log/bluedroiddump, log gives things like that :

Code:
11-30 11:33:00.432--BluetoothManagerService -- ===== BOOT_COMPLETED (N960FXXU4ZSK7) ===== false false false false
11-30 11:33:00.433--HFBMS-bind PSC
11-30 11:33:00.440--HFBMS-bind fail by mEnableExternal(false) from android
11-30 11:33:02.355--HFBMS-bind fail by mEnableExternal(false) from com.android.server.telecom
11-30 11:33:02.442--HFBMS-bind fail by mEnableExternal(false) from com.android.server.telecom
11-30 11:33:02.445--HFBMS-bind fail by mEnableExternal(false) from com.android.systemui
11-30 11:33:02.491--HFBMS-bind fail by mEnableExternal(false) from com.android.systemui
11-30 11:33:03.652--HFBMS-bind fail by mEnableExternal(false) from com.android.phone
11-30 11:33:08.876--BluetoothManagerService -- User unlocked. userHandle : 0
11-30 11:33:40.398--BluetoothAdapter -- semSetStandAloneBleMode(true) called by PID : 16479 @ null
11-30 11:33:40.399--BluetoothAdapter -- enableRadio() called by PID : 16479 @ null
11-30 11:33:40.400--BluetoothManagerService -- enableBle(null) BT ManagerService enableBle called 
11-30 11:33:40.661--AdapterState Entering BT OFF
11-30 11:33:40.872--BluetoothManagerService BLUETOOTH_SERVICE_CONNECTED: 1
11-30 11:33:40.876--AdapterState Current state: BT OFF, message: BLE_TURN_ON
11-30 11:33:40.878--AdapterState Entering Turning BLE ON
11-30 11:33:40.935--btsnoop.cc -- Config HCI log for external : enable=0
11-30 11:33:48.002--btif_storage.cc -- before ssSupport
11-30 11:33:48.002--btif_storage.cc -- after ssSupport = 1 vkSupport = 0
11-30 11:33:48.004--btif_storage.cc -- Failed to get getKeyIVLen = -19
11-30 11:33:48.005--btif_storage.cc -- Failed to get getKeyIVLen = 0
11-30 11:33:48.005--btif_storage.cc -- Failed to get getKeyIVLen = 0
11-30 11:33:48.005--btif_storage.cc -- Failed to get getKeyIVLen = 0
11-30 11:33:48.137--[5008]{0029})(04::0)
11-30 11:33:48.138--[5008]{002A}(20::80)(04::0)
11-30 11:33:48.138--PFQU-connect : empty
11-30 11:33:48.138--AdapterState Current state: Turning BLE ON, message: BLE_STARTED
11-30 11:33:48.147--AdapterState Entering BLE ON
11-30 11:33:48.154--BluetoothManagerService BLUETOOTH_SERVICE_CONNECTED: 2
11-30 11:33:48.166--BtGatt.GattService registerServer(android.uid.system)
The "after ssSupport = 1" seems to confirm that secure storage is detected as active. Which cause our issue.
 

3arthur6

Senior Member
Sep 15, 2011
413
857
123
Hey
Just fixed it on my Note9 :highfive:
Could you provide me libbluetooth.so file from your /system/lib64 folder?
I have to compare with the Note9 one, it should be very similar.
 
  • Like
Reactions: Lebrun213

3arthur6

Senior Member
Sep 15, 2011
413
857
123
After placing libary in /system/lib64 is there anything else to do? I mean changing something in build.prop? Thanks for help so far.
I recommend to not modify anything else if it works.

If you want, not sure yet but maybe add/replace "ro.securestorage.knox=false" and "ro.securestorage.support=false" in build.prop and replace "start" by "stop" in /system/vendor/etc/init/secure_storage_daemon_kinibi.rc or similar file. To avoid secure storage service to start without need.
But you could loose and have to add again your stored wifi passwords with this!
 
  • Like
Reactions: Olli2k

Olli2k

Senior Member
Dec 30, 2010
93
14
0
Düsseldorf
I recommend to not modify anything else if it works.

If you want, not sure yet but maybe add/replace "ro.securestorage.knox=false" and "ro.securestorage.support=false" in build.prop and replace "start" by "stop" in /system/vendor/etc/init/secure_storage_daemon_kinibi.rc or similar file. To avoid secure storage service to start without need.
But you could loose and have to add again your stored wifi passwords with this!
Thx, so after placing this file, headset pairings is still there after reboot, so yes it works, but I was hoping to find a solution for my not to be able to pair with a galaxy watch in this as well. This problem is still up, but I will try your suggestions.
 

Lebrun213

Senior Member
Jun 27, 2018
73
25
0
No problem! :)
As expected the library is very similar to the N9.
Try this, it should work.
Tested and works too on s10e, I'm glad you did it because most people (including me) are not good enough to use disassembler and reverse Samsung modules. Thanks you very much!

Btw it works perfectly with my galaxy watch, answering to the post above.
 
  • Like
Reactions: 3arthur6