Add keepsBluetoothAlive hook to Activity base class
Introduces a virtual method allowing activities to indicate whether they need the BLE stack to remain active. This enables selective teardown of Bluetooth to free heap memory, with the Bluetooth settings screen being able to override this for pairing and scanning functionality.
This commit is contained in:
@@ -254,6 +254,17 @@ bool ActivityManager::isReaderActivity() const {
|
||||
(currentActivity && currentActivity->isReaderActivity());
|
||||
}
|
||||
|
||||
void ActivityManager::requestGhostCleanup() {
|
||||
if (currentActivity) currentActivity->requestGhostCleanup();
|
||||
}
|
||||
|
||||
bool ActivityManager::bluetoothShouldBeActive() const {
|
||||
const auto wants = [](const auto& activity) {
|
||||
return activity && (activity->isReaderActivity() || activity->keepsBluetoothAlive());
|
||||
};
|
||||
return std::any_of(stackActivities.begin(), stackActivities.end(), wants) || wants(currentActivity);
|
||||
}
|
||||
|
||||
bool ActivityManager::skipLoopDelay() const { return currentActivity && currentActivity->skipLoopDelay(); }
|
||||
|
||||
ScreenshotInfo ActivityManager::getScreenshotInfo() const {
|
||||
|
||||
Reference in New Issue
Block a user