Revert "Gemini live launching and font updates"#174
Conversation
This reverts commit e3ec4db.
There was a problem hiding this comment.
Code Review
This pull request integrates multiple new AI samples into the catalog, updates SDK and dependency versions (including upgrading AGP to 9.2.0 and Kotlin to 2.2.10), and cleans up redundant configurations and dependencies. However, critical issues were identified in the review: upgrading Kotlin to 2.2.10 without updating KSP will cause a build failure due to version mismatch. Additionally, removing the onStop lifecycle hook in GlassesActivity and the corresponding stopLiveSession() method in TodoScreenViewModel prevents the release of high-drain resources like the microphone, leading to potential background resource leaks, battery drain, and privacy concerns.
I am having trouble creating individual review comments. Click here to see my feedback.
gradle/libs.versions.toml (8)
Upgrading Kotlin to 2.2.10 while keeping KSP at 2.1.0-1.0.29 will cause a build failure because KSP versions are strictly tied to the Kotlin compiler version. Please either revert Kotlin to 2.1.0 or upgrade KSP to a version compatible with Kotlin 2.2.10 (e.g., 2.2.10-1.0.30 or similar).
kotlin = "2.1.0"
samples/gemini-live-todo/src/main/java/com/android/ai/samples/geminilivetodo/GlassesActivity.kt (133-138)
Reverting the onStop lifecycle hook that stops the live session is a critical issue. Without releasing high-drain resources like the microphone and the active audio connection in onStop, the live session will continue running in the background when the activity is no longer visible. This leads to severe battery drain and presents a significant privacy risk as the microphone remains active.
Please restore the onStop implementation:
override fun onStop() {
super.onStop()
viewModel.stopLiveSession()
}samples/gemini-live-todo/src/main/java/com/android/ai/samples/geminilivetodo/ui/TodoScreenViewModel.kt (321-331)
Removing stopLiveSession() prevents the UI layer (such as GlassesActivity) from safely releasing the active Gemini Live session and microphone resources when the activity is stopped or destroyed. This can lead to background resource leaks and battery drain.
Please retain this function so that the lifecycle owner can properly clean up high-drain resources:
fun stopLiveSession() {
viewModelScope.launch {
try {
session?.stopAudioConversation()
liveSessionState.update { LiveSessionState.Ready }
todoRepository.updateMicStatus(micIsOn = false)
} catch (e: Exception) {
Log.e(TAG, "Error stopping Live Session onStop: ${e.message}", e)
}
}
}
Reverts #171