Merge "SCS: Don't convert source and dst IP addresses for adding scs policies" into udc-dev
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 943897d..89a0389 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -37,6 +37,16 @@
 	}
 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
 
+#ifdef CONFIG_AIDL
+	// Initialize AIDL here if daemonize is disabled.
+	// Otherwise initialize it later.
+	if (!global->params.daemonize) {
+		global->aidl = wpas_aidl_init(global);
+		if (!global->aidl)
+			return -1;
+	}
+#endif /* CONFIG_AIDL */
+
 	return 0;
 }
 
@@ -63,13 +73,14 @@
 	}
 
 #ifdef CONFIG_AIDL
-	/* AIDL initialization may not be complete at this point.
+	/*
+	 * AIDL initialization may not be complete here if daemonize is enabled.
 	 * Initialization is done after daemonizing in order to avoid
 	 * issues with the file descriptor.
 	 */
-	if (!wpa_s || !wpa_s->global->aidl)
+	if (!wpa_s->global->aidl)
 		return 0;
-	/* HIDL interface wants to keep track of the P2P mgmt iface. */
+	/* AIDL interface wants to keep track of the P2P mgmt iface. */
 	if (wpas_aidl_register_interface(wpa_s))
 		return -1;
 #endif
@@ -85,7 +96,7 @@
 		wpas_dbus_unregister_interface(wpa_s);
 	}
 
-	/* HIDL interface wants to keep track of the P2P mgmt iface. */
+	/* AIDL interface wants to keep track of the P2P mgmt iface. */
 	wpas_aidl_unregister_interface(wpa_s);
 }
 
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 99ecef8..287bc9e 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -7920,9 +7920,12 @@
 	}
 
 #ifdef CONFIG_AIDL
-	global->aidl = wpas_aidl_init(global);
-	if (!global->aidl)
-		return -1;
+	// If daemonize is enabled, initialize AIDL here.
+	if (global->params.daemonize) {
+		global->aidl = wpas_aidl_init(global);
+		if (!global->aidl)
+			return -1;
+	}
 #endif /* CONFIG_AIDL */
 
 	eloop_register_signal_terminate(wpa_supplicant_terminate, global);