2

Bluetooth discoverability is meant to be active only when in the Bluetooth settings. But somehow Xiaomi MIUI changed that so it is always active. Is there some tool that will turn off the Bluetooth discoverability automatically? So whenever Bluetooth is activated, phone restarts or similar it will turn off discoverability?

There are tools like Bluetooth Settings but whenever the phone is rebooted or Bluetooth is restarted the discoverability is activated again.

Maybe there is something like Macrodroid (did not find an option in there) that could do this?

//edit: as comments cannot hold only few characters I am adding my unfiltered log output here that is written when I change the settings via the above tool (only lines that are not clearly from something else/repeating).

[ 11-01 23:41:57.281 23646:23646 D/BluetoothAdapter ]
enable(): BT already enabled!

[ 11-01 23:41:57.288   666:  666 D/[email protected]_handler ]
SerialClockVote: vote for UART CLK ON

[ 11-01 23:41:57.289  1925: 2052 D/AdapterProperties ]
Discoverable Timeout:120

[ 11-01 23:41:57.289   666:  666 D/[email protected]_lock ]
Acquire wakelock is acquired 

[ 11-01 23:41:57.289   666:  666 I/[email protected]_handler ]
DeviceWakeUp: Writing IBS_WAKE_IND

[ 11-01 23:41:57.290  1925: 2052 D/AdapterProperties ]
Scan Mode:20

[ 11-01 23:41:57.293   666: 2642 I/[email protected]_handler ]
ProcessIbsCmd: Received IBS_WAKE_ACK: 0xFC

[ 11-01 23:41:57.294   666: 2642 I/[email protected]_handler ]
ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD

[ 11-01 23:41:57.294   666: 2642 I/[email protected]_handler ]
ProcessIbsCmd: Writing IBS_WAKE_ACK

[ 11-01 23:41:57.298 25175:25175 V//vendor/bin/chre ]
vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1006: remote_handle_open: Successfully opened handle 0xffffffff for '":;./\createstaticpd:sensorspd on domain 0

[ 11-01 23:41:57.337   666: 2642 I/[email protected]_handler ]
ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE

[ 11-01 23:41:57.339 25175:25175 D//vendor/bin/chre ]
vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:989: Error 0xfffffffb: remote_handle_open_domain: dynamic loading failed for chre_slpi on domain 0 (dlerror unknown error)


[ 11-01 23:41:57.339 25175:25175 D//vendor/bin/chre ]
vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:925: Error 0x2c: remote_handle_invoke failed for handle 0xffffffff, method 5 on domain 0 (sc 0x5020000)


[ 11-01 23:41:57.339 25175:25175 E/CHRE     ]
Failed to deliver timestamp message from host to CHRE: 44

[ 11-01 23:41:57.379 25175:25176 D//vendor/bin/chre ]
vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:989: Error 0xfffffffb: remote_handle_open_domain: dynamic loading failed for chre_slpi on domain 0 (dlerror unknown error)


[ 11-01 23:41:57.379 25175:25176 D//vendor/bin/chre ]
vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:925: Error 0x2c: remote_handle_invoke failed for handle 0xffffffff, method 2 on domain 0 (sc 0x2000000)


[ 11-01 23:41:57.379 25175:25176 E/CHRE     ]
Failed to initialize reverse monitor on SLPI: 44

[ 11-01 23:41:57.379 25175:25176 D//vendor/bin/chre ]
vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1925: Error 4b: adsp current process handle failed. domain 0


[ 11-01 23:41:57.381 25175:25176 V//vendor/bin/chre ]
vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1006: remote_handle_open: Successfully opened handle 0xfbc6d8c0 for adsp_current_process on domain 0

[ 11-01 23:41:57.383 25175:25176 D//vendor/bin/chre ]
vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1925: Error 4b: adsp current process handle failed. domain 0


[ 11-01 23:41:57.386 25175:25176 I/chatty   ]
uid=1000(system) chre identical 1 line

[ 11-01 23:41:57.389 25175:25176 D//vendor/bin/chre ]
vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1925: Error 4b: adsp current process handle failed. domain 0


[ 11-01 23:41:57.416 25175:25175 D//vendor/bin/chre ]
vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:989: Error 0xfffffffb: remote_handle_open_domain: dynamic loading failed for chre_slpi on domain 0 (dlerror segment 0 failed hash verification(0x0 B))


[ 11-01 23:41:57.416 25175:25175 D//vendor/bin/chre ]
vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:925: Error 0x2c: remote_handle_invoke failed for handle 0xffffffff, method 0 on domain 0 (sc 0x0)


[ 11-01 23:41:57.416 25175:25175 E/CHRE     ]
Failed to start CHRE on SLPI: 44

[ 11-01 23:41:58.297   666: 2648 I/[email protected]_handler ]
DeviceSleep: TX Awake, Sending SLEEP_IND

[ 11-01 23:41:58.297   666: 2648 D/[email protected]_handler ]
SerialClockVote: vote for UART CLK OFF

[ 11-01 23:41:58.300 23646:23646 E/bcr      ]
run

[ 11-01 23:41:58.302 23646:23646 D/BluetoothAdapter ]
enable(): BT already enabled!

[ 11-01 23:41:58.332 23646:23646 W/IInputConnectionWrapper ]
getTextBeforeCursor on inactive InputConnection

[ 11-01 23:41:58.343 23646:23646 W/IInputConnectionWrapper ]
getSelectedText on inactive InputConnection

[ 11-01 23:41:58.345 23646:23646 W/IInputConnectionWrapper ]
getTextAfterCursor on inactive InputConnection

[ 11-01 23:41:58.356 23646:23646 W/IInputConnectionWrapper ]
getCursorCapsMode on inactive InputConnection

[ 11-01 23:41:58.367 23646:23646 W/IInputConnectionWrapper ]
beginBatchEdit on inactive InputConnection

[ 11-01 23:41:58.367 23646:23646 W/IInputConnectionWrapper ]
endBatchEdit on inactive InputConnection

[ 11-01 23:41:58.380  1941: 1941 I/KeyboardViewUtil ]
systemKeyboardHeightRatio:1.000000; userKeyboardHeightRatio:1.000000.


[ 11-01 23:41:58.382  1941: 1941 I/AndroidIME ]
LatinIme.onDeactivate()


[ 11-01 23:41:58.383  1941: 1941 I/AndroidIME ]
LatinIme.onActivate() : EditorInfo = Package = by4a.bluetoothsettings : Type = Text : Learning = Disable : Suggestion = Show : AutoCorrection = Enable : Microphone = Show : NoPersonalizedLearning = Disable


[ 11-01 23:41:58.383  1941: 1941 I/Delight5Facilitator ]
initializeForIme() : Locale = [de], layout = qwertz


[ 11-01 23:41:58.400  1941: 1941 W/KeyboardModeManager ]
setInputView() : inputView = com.google.android.apps.inputmethod.libs.framework.core.InputView{9975614 V.E...... ......ID 0,0-1080,2135}


[ 11-01 23:41:58.400  1941: 1941 I/ConversationToQueryExtension ]
Conv2Query not enabled due to current app [by4a.bluetoothsettings] not in whitelist


[ 11-01 23:41:58.400  1941: 1941 I/ConversationToQueryExtension ]
onActivate() : Disabled by unsupported host app


[ 11-01 23:41:58.407  1941:24909 I/FederatedC2QExtension ]
Already registered manifest.


[ 11-01 23:41:58.407  1941:24909 I/FederatedC2QExtension ]
model for de/glowg_click_20190522 is not yet available


[ 11-01 23:41:58.407  1941:24909 I/FederatedC2QExtension ]
requesting model 'federated_conv2query_triggering_de_glowg_click_20190522'


[ 11-01 23:41:58.408  1941:24909 I/FederatedC2QExtension ]
no valid model for inferencing found, switching to baseline.


[ 11-01 23:41:58.411  1941: 3426 I/SP       ]
Syncing federatedc2q (20190522) with slices: [], metadata: false


[ 11-01 23:41:58.413  1941: 3426 I/SP       ]
Sync for federatedc2q succeeded in 4 ms: no changes


[ 11-01 23:41:58.413  1941: 3426 W/SP       ]
isDirectory returned false while listing files for /data/user/0/com.google.android.inputmethod.latin/files/superpacks/federatedc2q


[ 11-01 23:41:58.413  1941: 3426 I/SP       ]
GC for 'federatedc2q' (10) with ttl of 0 ms took 0 ms (0/0/0)


[ 11-01 23:41:58.414  1941: 3426 I/FederatedC2QExtension ]
Got no packs for locale: de


[ 11-01 23:41:58.447  1459: 4999 D/CompatibilityInfo ]
mCompatibilityFlags - 0

[ 11-01 23:41:58.447  1459: 4999 D/CompatibilityInfo ]
applicationDensity - 440

[ 11-01 23:41:58.447  1459: 4999 D/CompatibilityInfo ]
applicationScale - 1.0

[ 11-01 23:41:58.447   666: 2440 D/[email protected]_lock ]
Release wakelock is released 

[ 11-01 23:41:58.460  1459: 4999 D/CompatibilityInfo ]
mCompatibilityFlags - 0

[ 11-01 23:41:58.460  1459: 4999 D/CompatibilityInfo ]
applicationDensity - 440

[ 11-01 23:41:58.460  1459: 4999 D/CompatibilityInfo ]
applicationScale - 1.0

[ 11-01 23:41:58.708   666: 2642 I/[email protected]_handler ]
ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD

[ 11-01 23:41:58.709   666: 2642 D/[email protected]_handler ]
SerialClockVote: vote for UART CLK ON

[ 11-01 23:41:58.713   666: 2642 D/[email protected]_lock ]
Acquire wakelock is acquired 

[ 11-01 23:41:58.713   666: 2642 I/[email protected]_handler ]
ProcessIbsCmd: Writing IBS_WAKE_ACK

[ 11-01 23:41:58.734  1459: 1543 D/CompatibilityInfo ]
mCompatibilityFlags - 0

[ 11-01 23:41:58.734  1459: 1543 D/CompatibilityInfo ]
applicationDensity - 440

[ 11-01 23:41:58.734  1459: 1543 D/CompatibilityInfo ]
applicationScale - 1.0

[ 11-01 23:41:58.755   666: 2642 I/[email protected]_handler ]
ProcessIbsCmd: Received IBS_SLEEP_IND: 0xFE

[ 11-01 23:41:58.755   666: 2642 D/[email protected]_handler ]
SerialClockVote: vote for UART CLK OFF

[ 11-01 23:41:58.797  1459: 2397 D/CompatibilityInfo ]
mCompatibilityFlags - 0

[ 11-01 23:41:58.797  1459: 2397 D/CompatibilityInfo ]
applicationDensity - 440

[ 11-01 23:41:58.797  1459: 2397 D/CompatibilityInfo ]
applicationScale - 1.0

[ 11-01 23:41:58.905   666: 2440 D/[email protected]_lock ]
Release wakelock is released 

[ 11-01 23:41:58.980  1459: 1469 I/system_server ]
NativeAlloc concurrent copying GC freed 160321(7MB) AllocSpace objects, 30(1272KB) LOS objects, 36% free, 41MB/65MB, paused 276us total 182.281ms

[ 11-01 23:41:59.527  5981: 5981 I/PowerKeeperBackgroundService ]
onStartCommand()

1 Answer 1

2

In my OnePlus 6 running Android 9.0, changing the value for the system key (for Settings) bluetooth_default_scan_mode toggles the discoverability of bluetooth. Value 21 to disable, 23 to enable.

MacroDroid has a trigger named System Settings under Device Settings category, and after selecting System in the list there, you can set the key-value. Unfortunately, for some reason I didn't investigate into, MacroDroid failed to work in this case. In turn, I resorted to Tasker which also allows changing custom settings.

In Tasker, the action under a task should be: Settings → Custom Setting:

  • Type: System
  • Name: bluetooth_default_scan_mode or pick a related one using lens icon and test it out
  • Value: 21 or 23 or whatever you found

Save the task and assign it to a profile of your liking. A profile is a trigger in MacroDroid terms.


I used to find out the key-value corresponding to the discoverability of bluetooth. You can use it if you fail to find the key-value for your device. Here's what I did:

adb logcat  SettingsProvider:V *:S -v long   # to find the key
adb settings get system KEY                  # to obtain the value of the key. You would have to get the value for both cases
5
  • Wow - thank you for this detailed explanation and steps to find out more details! Will give it a try - and maybe I can find even more nice things to setup.
    – Eleasar
    Commented Oct 31, 2019 at 10:01
  • Ok, finally managed to test this. But I had no luck with Tasker (nor MacroDroid or some settings finders). [ 11-01 23:30:20.173 1459: 1459 V/SettingsProvider ] Notifying for 0: content://settings/global/bluetooth_on
    – Eleasar
    Commented Nov 1, 2019 at 22:31
  • 1
    @Eleasar I tested with a Redmi Note 5 Pro device running Android 9 (MIUI 10) and noticed that there is no toggleable option for bluetooth discoverability in Bluetooth Settings. If a user cannot control discoverability from Settings, it is highly unlikely my answer would be of any use to them. Sorry!
    – Firelord
    Commented Nov 2, 2019 at 14:03
  • ok thanks! Guess for now I need to use the app whenever I restart my phone or turn the bluetooth on or off.
    – Eleasar
    Commented Nov 2, 2019 at 18:32
  • This is only a thing on [some?] oneplus devices (it's literally a class named OPBluetoothDiscoverablePreferenceController inside of their settings app). That may be related or incidental to the ble_scan_background_mode property that AOSP has (it's global and not system though) but the only passive setting there should be -1.
    – mirh
    Commented Jul 4, 2023 at 22:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .