diff --git a/android/adapter.c b/android/adapter.c
index 38dec9d..81b61c1 100644
--- a/android/adapter.c
+++ b/android/adapter.c
DBG("0x%08x", changed_mask);
- if (changed_mask & MGMT_SETTING_POWERED) {
+ if (changed_mask & MGMT_SETTING_POWERED)
powered_changed();
- /*
- * Only when powered, the connectable and discoverable
- * state changes should be communicated.
- */
- scan_mode_mask = MGMT_SETTING_CONNECTABLE |
- MGMT_SETTING_DISCOVERABLE;
+ scan_mode_mask = MGMT_SETTING_CONNECTABLE |
+ MGMT_SETTING_DISCOVERABLE;
+
+ /*
+ * Only when powered, the connectable and discoverable
+ * state changes should be communicated.
+ */
+ if (adapter->current_settings & MGMT_SETTING_POWERED)
if (changed_mask & scan_mode_mask)
scan_mode_changed();
- }
}
static void new_settings_callback(uint16_t index, uint16_t length,