Merge tag 'v0.1.12' into git-sync

Test: TreeHugger
Change-Id: I4df450f617f4a032b3ab842d5ec69997fb874dd0
diff --git a/Cargo.lock b/Cargo.lock
index 2afdffa..ba629f1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -565,7 +565,7 @@
 
 [[package]]
 name = "pica"
-version = "0.1.11"
+version = "0.1.12"
 dependencies = [
  "anyhow",
  "bytes",
diff --git a/Cargo.toml b/Cargo.toml
index 24feebe..d9666be 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "pica"
-version = "0.1.11"
+version = "0.1.12"
 edition = "2021"
 description = "Pica is a virtual UWB Controller implementing the FiRa UCI specification."
 repository = "https://github.com/google/pica"
diff --git a/METADATA b/METADATA
index b94f89c..c066764 100644
--- a/METADATA
+++ b/METADATA
@@ -12,7 +12,7 @@
     type: GIT
     value: "https://github.com/google/pica.git"
   }
-  version: "v0.1.11"
+  version: "v0.1.12"
   license_type: NOTICE
-  last_upgrade_date { year: 2024 month: 6 day: 3 }
+  last_upgrade_date { year: 2024 month: 6 day: 11 }
 }
diff --git a/src/device.rs b/src/device.rs
index 62f3ffc..0558dbc 100644
--- a/src/device.rs
+++ b/src/device.rs
@@ -739,6 +739,31 @@
                         status: update_status,
                     });
                 });
+                // Following requirements are applicable when the action is set to Delete (Action field set to 0x01):
+                // When the command is received while the Session State is SESSION_STATE_ACTIVE,
+                // For requested Controlees present in the multicast list,
+                // UWBS shall send the SESSION_UPDATE_CONTROLLER_MULTICAST_LIST_NTF and the
+                // corresponding Controlee status shall be set to STATUS_OK_MULTICAST_LIST_UPDATE
+                // in the Status List of SESSION_UPDATE_CONTROLLER_MULTICAST_LIST_NTF.
+                if session.state == SessionState::SessionStateActive {
+                    let tx = self.tx.clone();
+                    tokio::spawn(async move {
+                        // Sleep for 5ms to make sure the notification is not being
+                        // sent before the response.
+                        // TODO(#84) remove the sleep.
+                        time::sleep(Duration::from_millis(5)).await;
+                        tx.send(
+                            SessionUpdateControllerMulticastListNtfBuilder {
+                                controlee_status,
+                                session_token: session_handle,
+                            }
+                            .build()
+                            .encode_to_vec()
+                            .unwrap(),
+                        )
+                        .unwrap()
+                    });
+                }
             }
         }
         session.app_config.number_of_controlees = dst_addresses.len() as u8;
@@ -752,23 +777,6 @@
                 ReasonCode::ErrorInvalidNumOfControlees,
             )
         }
-        let tx = self.tx.clone();
-        tokio::spawn(async move {
-            // Sleep for 5ms to make sure the notification is not being
-            // sent before the response.
-            // TODO(#84) remove the sleep.
-            time::sleep(Duration::from_millis(5)).await;
-            tx.send(
-                SessionUpdateControllerMulticastListNtfBuilder {
-                    controlee_status,
-                    session_token: session_handle,
-                }
-                .build()
-                .encode_to_vec()
-                .unwrap(),
-            )
-            .unwrap()
-        });
         SessionUpdateControllerMulticastListRspBuilder { status }.build()
     }