Goal and prerequisites
Read the companion lesson and use the pinned PocketCook checkout. Work in your own learning branch. This exercise combines source reading with observable behavior; do not edit production credentials or upload conversations.
Source to inspect
LiveConnection.kt, AndroidPcmAudio.kt and LiveSessionTest.kt. Kotlin files live under app/src/main/java/com/androidengineers/pocketcook/; unit tests under app/src/test/java/com/androidengineers/pocketcook/, device tests under app/src/androidTest/java/com/androidengineers/pocketcook/.
Predict, run, explain
Before running tests, write the expected outcome when a microphone chunk is handed to a suspended consumer, the user mutes, and then unmutes before the consumer resumes. Explain why draining only the channel is insufficient. Next, trace server interruption through the parser into the audio epoch and track flush.
./gradlew :app:testDebugUnitTest --tests '*LiveSessionTest.mutedQueuedSpeechIsDiscardedAndNetworkFailureAllowsRestart'
./gradlew :app:testDebugUnitTest --tests '*LiveSessionTest.interruptionFlushesPlaybackAndMuteReachesAudioAdapter'
Run commands from gemini-live/. Record the source revision, prediction, result and explanation. A test failing to compile is a setup problem, not the expected behavioral failure. If the device or provider is unavailable, state which checks remain unverified.
Reference reasoning and submission
Expected reasoning: the in-flight chunk has left the queue, so only an identity check can reject it when the consumer resumes. Capture epoch, playback epoch and connection generation solve different races. Deliver the event order, assertions and, if you have API access, separate notes from two live interruptions. Do not claim the fake verifies echo cancellation.
Self-check
Can another learner reproduce your result from your branch and notes? Can you name the responsible source method without reading the lesson? Have you separated local tests from actual device/provider evidence? Revisit the corresponding concept if any answer is no.
Course study guide · Hands-on codelab · Pinned Android source