androidengineers.Book a session

Session ownership and the AI boundary

Practice: Trace the first connection

exercise30–60 min

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 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

Draw a sequence from Talk to PocketCook to setupComplete. Label the socket owner, audio owner and the first point at which capture may begin. Run the duplicate-start and setup-timeout tests with the commands below. Then describe what changes when the key is missing versus when setup never arrives.

./gradlew :app:testDebugUnitTest --tests '*LiveSessionTest.duplicateStartCreatesOneSocketAndNoMicrophoneBeforeSetup'
./gradlew :app:testDebugUnitTest --tests '*LiveSessionTest.setupTimeoutIsRecoverableAndNeverStartsCapture'

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: missing configuration is handled before a connection is requested; setup timeout happens after connecting starts but before capture. Two starts while connecting produce one socket. The fake only proves ownership calls, not that a real server accepts the setup. Deliver your diagram, test output and a five-sentence explanation of the distinction.

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.

Return to the lesson.

Course study guide · Hands-on codelab · Pinned Android source

YOUR LEARNING JOURNEY

0 of 16 available lessons completed

Progress saved in this browser. No account needed.
Practice: Trace the first connection | Gemini Live for Android with PocketCook | Android Engineers