Diff between 6807460f1b87ba2a63cc11d4ccc75b2c65a7f37d and 3c82cea914af5c33d93c2c3c83d09069bfb29066

Changed Files

File Additions Deletions Status
android/adapter.c +9 -8 modified

Full Patch

diff --git a/android/adapter.c b/android/adapter.c
index 38dec9d..81b61c1 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -174,19 +174,20 @@ static void settings_changed(uint32_t settings)
 
 	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,