15

Android 5 introduces BLE MAC address rotating for increased privacy. Every time when calling BluetoothLeAdvertiser.startAdvertising(), the MAC-address is changed.

Is it possible to disable address rotating, and just use the same MAC address during the entire lifetime of BluetoothLeAdvertiser?

MStone
  • 545
  • 2
  • 5
  • 11

2 Answers2

19

The MAC Address is a physical address and does not change. In BLE terminology, it is the Public Device Address or BD_ADDR for BR/EDR. I haven't tried it, but reading it with readAddress() should return the same value each time.

What the Android's BLE framework does is NOT use that address when advertising. It rather enables privacy by using Private Resolvable Addresses which may change every few minutes or so but still allow bonded devices to recognize it using the IRK exchanged at bonding.

For obvious privacy reasons, Android's BLE framework does not allow you to set the Controller to use the public address when advertising. So you cannot disable the "address rotating".

Bogdan Alexandru
  • 5,394
  • 6
  • 34
  • 54
  • Could you add some sort of source? – DagW Oct 22 '15 at 11:20
  • 2
    Bluetooth 4.2 Core Spec: https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=286439 – Bogdan Alexandru Oct 22 '15 at 20:47
  • @BogdanAlexandru if the advertisement packets only has the Private Resolvable Addresses, then, how does a [ScanFilter](http://developer.android.com/reference/android/bluetooth/le/ScanFilter.html) based on MAC addresses work? any idea? – Khaled Alanezi Jan 28 '16 at 19:38
  • @KhaledAlanezi It doesn't. The only way to filter for the resolvable addresses it by using 4.2's Enhanced Privacy feature, where you set the IRK into the controller and the latter resolves automatically during scanning. However, like many other things, I don't think these options are available in Android's public API. – Bogdan Alexandru Feb 09 '16 at 12:17
3

You can disable the BLE Privacy Feature to avoid the MAC address rotating, and change the bluedroid source code as follows:

http://androidxref.com/5.1.1_r6/xref/external/bluetooth/bluedroid/include/bt_target.h#1326

    * Toggles support for general LE privacy features such as remote address
    * resolution, local address rotation etc.
    */

    #ifndef BLE_PRIVACY_SPT 
    -#define BLE_PRIVACY_SPT         TRUE
    +#define BLE_PRIVACY_SPT         FLASE
    #endif
dinasind
  • 31
  • 2