Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Fix HomePod music Siri interruption

Guilherme Ramboff6fb9a2364d
diff --git a/Research/0_binary_patch_comparison.md b/Research/0_binary_patch_comparison.md
index 2ce28421..cec78b5f 100644
--- a/Research/0_binary_patch_comparison.md
+++ b/Research/0_binary_patch_comparison.md
@@ -19,7 +19,11 @@
> A scoped request adapter selects MediaRemote's local destination only for
> that own-device UID; native request/response and artwork processing remain
> intact. Remote requests and opt-out pass through. The routing correction,
-> artwork changes and animation synchronization still need live validation.
+> artwork processing succeed live in 24K120. Purple and yellow album artwork
+> produce distinct native animated colors; pause fades to idle and resume works.
+> A follow-up to the existing Siri speech patch uses a mixable, ducking auxiliary
+> session with notify-on-deactivation after the live interruption test made
+> Music abandon the receiver. Its AirPlay handoff still needs live verification.
> **HomePod Siri speech policy (2026-10-23, live speech verified).**
> New optional `system-homepod-exp-siri_speech` generates
diff --git a/Research/Firmware/homepod_sound_glow.md b/Research/Firmware/homepod_sound_glow.md
index 1a7bb489..42052b0d 100644
--- a/Research/Firmware/homepod_sound_glow.md
+++ b/Research/Firmware/homepod_sound_glow.md
@@ -156,8 +156,24 @@ to `MRDestination.localDestination`. Identifiers, dimensions, completion and
native artwork decoding/color extraction remain untouched. Other destinations
and policy opt-out retain the original call. All participating method ABIs
are checked before installation; the harness verifies local/remote/nil targets,
-completion preservation and opt-out. This routing change still needs live
-verification. No host artwork fetching or generated frames are involved.
+completion preservation and opt-out. The first routing build correctly refused
+the adapter because its guard looked for deviceUID on MRDeviceInfoRequest
+instead of the returned MRDeviceInfo; the guard and independent fixture now
+match the native class layout. Build `2.11.0-local.729f73aa` logs both adapters
+ready, completes its local artwork request in 0.0532 seconds, and emits native
+colored frames with no rejected reports. Supremacy produces purple tones and
+Dear Maria, Count Me In switches to yellow tones. Pause settles both banks to
+black and a fixed generation; resume restores animation. Screenshots verify
+those native frames reach the host window. No host artwork fetching or
+generated frames are involved.
+
+The Siri interruption test produced full speech and native Siri frames, but
+the owner observed Music switching output back to the Mac at speech start.
+The existing auxiliary Playback session used categoryOptions=0, interrupting
+tvairplayd. Its policy now uses the public AVFAudio MixWithOthers|DuckOthers
+options and NotifyOthersOnDeactivation, without touching the shared session.
+The native lifetime/error harness and complete bundle pass. Live verification
+of the AirPlay-preserving speech handoff remains pending that build's deploy.
Install the prepared bundle through Launchpad when authorization is available.
Use the returned installed version, preserving the default bundle and all other
diff --git a/Research/Firmware/homepod_welcome.md b/Research/Firmware/homepod_welcome.md
index f15b26d2..b773ac0a 100644
--- a/Research/Firmware/homepod_welcome.md
+++ b/Research/Firmware/homepod_welcome.md
@@ -1,5 +1,14 @@
# HomePod mini first-boot welcome
+The 2026-10-23 Sound Glow tests on 27.2 exposed an AirPlay interaction absent
+from the original speech-only tests: the nonmixing auxiliary Playback session
+made the Music sender switch back to the Mac. The adapter now uses AVFAudio's
+MixWithOthers|DuckOthers category options and NotifyOthersOnDeactivation. It
+retains the separate native session and synthesis completion lifetime; the
+shared session and microphone route remain untouched. Local lifetime/error
+tests and the bundle pass; live AirPlay/Siri handoff validation is recorded in
+[Sound Glow](homepod_sound_glow.md).
+
The guest policies, SoundBoard welcome coordinator, isolated Siri playback
adapter and durable once state are implemented. Local tests pass. Live tests on
27.0 (24J361) confirm audible native Siri speech, the exact automatic welcome
diff --git a/VPhoneGuestComponents/HomePodDisplay/VPHomePodSiriSpeech.m b/VPhoneGuestComponents/HomePodDisplay/VPHomePodSiriSpeech.m
index af6677e3..769dfc3a 100644
--- a/VPhoneGuestComponents/HomePodDisplay/VPHomePodSiriSpeech.m
+++ b/VPhoneGuestComponents/HomePodDisplay/VPHomePodSiriSpeech.m
@@ -1,6 +1,14 @@
#import "VPHomePodSiriSpeech.h"
#import <objc/runtime.h>
#include <mach/mach_time.h>
+#ifdef VP_HOMEPOD_SIRI_SPEECH_TESTING
+// Frozen public AVFAudio SDK values for the macOS-only native harness.
+enum { AVAudioSessionCategoryOptionMixWithOthers = 0x1,
+ AVAudioSessionCategoryOptionDuckOthers = 0x2,
+ AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation = 0x1 };
+#else
+#import <AVFAudio/AVAudioSession.h>
+#endif
@protocol VPHomePodSiriNative
@optional
@@ -96,7 +104,8 @@ static NSError *VPSiriSpeechError(NSString *message) {
}
if (self.active) {
NSError *cleanupError = nil;
- if (![self.audioManager deactivateWithOptions:0 deactivateImmediately:YES error:&cleanupError]) {
+ if (![self.audioManager deactivateWithOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation
+ deactivateImmediately:YES error:&cleanupError]) {
NSLog(@"vphone HomePod Siri speech: auxiliary session cleanup failed: %@", cleanupError);
}
self.active = NO;
@@ -118,7 +127,11 @@ static void VPSiriSpeechSay(id<VPHomePodSiriNative> manager, SEL selector, NSStr
lifetime.completion = completion;
@try {
id<VPHomePodSiriNative> configuration = [(id<VPHomePodSiriNative>)[VPSiriClass(@"SBAudioSessionConfiguration") alloc]
- initWithCategory:@"AVAudioSessionCategoryPlayback" categoryOptions:0];
+ initWithCategory:@"AVAudioSessionCategoryPlayback"
+ categoryOptions:AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionDuckOthers];
+ // A nonmixing playback session interrupts tvairplayd and makes the
+ // sender abandon this AirPlay receiver. Duck its existing session for
+ // speech, then notify it on deactivation so music and cap can continue.
if (!configuration) {
[lifetime finish:VPSiriSpeechError(@"Unable to create auxiliary playback configuration")];
return;
diff --git a/VPhoneGuestComponents/Tests/HomePodSiriSpeechTests.m b/VPhoneGuestComponents/Tests/HomePodSiriSpeechTests.m
index acf28130..34f2c575 100644
--- a/VPhoneGuestComponents/Tests/HomePodSiriSpeechTests.m
+++ b/VPhoneGuestComponents/Tests/HomePodSiriSpeechTests.m
@@ -53,7 +53,7 @@ static __weak SBAudioSessionManager *lastAuxiliary;
return YES;
}
- (BOOL)deactivateWithOptions:(NSUInteger)options deactivateImmediately:(BOOL)immediately error:(NSError **)error {
- assert(options == 0 && immediately);
+ assert(options == 1 && immediately);
(void)error;
self.deactivations++;
return YES;
@@ -141,7 +141,7 @@ int main(void) {
}
SBAudioSessionManager *aux = lastAuxiliary;
assert(aux && aux.activations == 1 && aux.deactivations == 0 && completions == 0);
- assert([aux.configuration.category isEqual:@"AVAudioSessionCategoryPlayback"] && aux.configuration.options == 0);
+ assert([aux.configuration.category isEqual:@"AVAudioSessionCategoryPlayback"] && aux.configuration.options == 3);
assert(service.event.type == 13 && service.event.timestamp && service.event.audioSessionID == 47);
assert(service.event.speechSynthesisRequest.priority == 2 && service.event.speechSynthesisRequest.options == 0);
assert([service.event.speechSynthesisRequest.speakableText isEqual:@"Native Siri phrase"]);