AirGuard icon indicating copy to clipboard operation
AirGuard copied to clipboard

Question regarding the low power scan option

Open aforemendude opened this issue 3 years ago • 9 comments

Hi,

I have a question regarding the low power scan option if you don't mind me asking.

Recently, the label text for the option was changed from If enabled bluetooth low power scan will be used to discover nearby AirTags!<b>WARNING</b>: This could cause that some devices won\'t be discovered! to If enabled, Bluetooth Low Energy scanning will be used to discover nearby AirTags!<b>WARNING</b>: Without this option, some devices might not be discovered!.

However, according to the code, Bluetooth Low Energy is used regardless of this option, and the low power scanning mode is used when this option is enabled. https://github.com/seemoo-lab/AirGuard/blob/4a29baeb9623e5e7ed5a49b65be3b9008191e305/app/src/main/java/de/seemoo/at_tracking_detection/detection/ScanBluetoothWorker.kt#L7 https://github.com/seemoo-lab/AirGuard/blob/4a29baeb9623e5e7ed5a49b65be3b9008191e305/app/src/main/java/de/seemoo/at_tracking_detection/detection/ScanBluetoothWorker.kt#L154-L161

So, it seems to me that the label should say If enabled, low power scanning mode will be used to discover nearby AirTags! <b>WARNING</b>: When this option is enabled, some devices might not be discovered!. Can someone please confirm if this is correct? Also, please let me know if you want me to open a PR to make the change.

aforemendude avatar Dec 23 '21 06:12 aforemendude

The wording is certainly confusing on what the option does. Looking for documentation lead me to this issue. Interested in hearing feedback on it.

musm avatar Jan 26 '22 06:01 musm

The Android docs only say that SCAN_MODE_LOW_POWER "consumes the least power", not that useful. But I found this in the docs of NordicSemiconductor/Android-Scanner-Compat-Library: "A Bluetooth LE device should advertise very often (at least once per 100 ms) in order to be found with this mode, otherwise the scanning interval may miss some or even all advertising events."

So it seems like when using SCAN_MODE_LOW_POWER you will find less devices..

DrMaxNix avatar Jan 30 '22 19:01 DrMaxNix

We did some measurements using the different scan modes and different scan durations. The low power scan mode clearly misses some devices, even though it will scan for a longer time. The reason is that the scanning cycles will occur less often in Android. Nevertheless, if you have a tracker on you and only every 3rd scan will find it, the app will still be able to notify you after about 2 hours.

Sn0wfreezeDev avatar Jan 31 '22 07:01 Sn0wfreezeDev

Alright, but then the descriptive text of the settings option is very missleading and should probably be changed..

DrMaxNix avatar Jan 31 '22 09:01 DrMaxNix

Hi, I was confused by this option as well (I was about to open an issue that this option was not enabled by default because i read it in a way that scanning won't function at all otherwise).

update: my suggestion to add/modify the thread openers suggestion would be: Warning: With this option, some devices might be detected later _(up to approx. 2 hours)_ or not at all. This option will reduce energy consumption." @Sn0wfreezeDev is the ~2 hours something that should be included as information in the description? (or rather: did you measure that or is this more of a gut feeling?)

Cheers!

lenhart avatar Feb 21 '22 10:02 lenhart

In both cases Bluetooth LowEnergy is used.. It just changes the poll interval for devices to be discovered. Also I have a PR open (PR #39) for fixing typos for 23 days which hasn't been merged yet..

DrMaxNix avatar Feb 21 '22 11:02 DrMaxNix

Hi @DrMaxNix: oh, too much skipping between open browser tabs, sorry about that confusion, should have read the opening post again. I will edit my previous post and propose that if the 2 hour mark can be something of a guidance, that it could be included in the fix @aforemendude proposed initially :-) Cheers!

lenhart avatar Feb 21 '22 11:02 lenhart

@DrMaxNix we try to align pull-requests with our feature releases. So we are currently working on an enhanced device detection and we will add the pull requests in this release 😊

Sn0wfreezeDev avatar Feb 21 '22 11:02 Sn0wfreezeDev

To bring some progress into this issue I will sum up the ideas we had so far. Please tell me if you think my suggestion should be changed in some way or if it's ready for a PR!

Current text (as of v1.2)

If enabled, Bluetooth Low Energy scanning will be used to discover nearby AirTags! WARNING: Without this option, some devices might not be discovered!

@aforemendude

If enabled, low power scanning mode will be used to discover nearby AirTags! WARNING: When this option is enabled, some devices might not be discovered!

@lenhart

Warning: With this option, some devices might be detected later (up to approx. 2 hours) or not at all. This option will reduce energy consumption."

My suggestion to combine all of those ideas

If enabled, low power scanning mode will be used to discover nearby AirTags. This will reduce energy consumption. WARNING: When this option is enabled, some devices might be detected late or not at all!

DrMaxNix avatar Mar 10 '22 19:03 DrMaxNix