theheraldproject/herald-for-android

Bug: Android analysis API doesn't remove old samples

Closed this issue · 0 comments

As per the C++ Analysis API implementation, the list (VariantSet on Android) should have a maximum fixed size, like a circular array, to limit data kept ready for the next analysis run.

As a result, the recent betas with the Histogram functionality show progressively slower response times due to analysisRunner.run() being called for every single RSSI received! This list just keeps getting bigger!

This also therefore contributes (but is not a sole cause of) stability and reliability issues like #238 on Android.

Temporarily I've moved the analysisRunner.run() call to updateTemporalHistogram and guarded that function's work with a check to only do analysis and histogram updating if in the foreground. Longer term though we need to ensure the analysis runner only runs every so many seconds (IIRC 30 seconds in C++, or even up to 5 minutes), and we need to change VariantSet so it has a maximum number of readings like the C++ API to prevent very large memory use over time.