Skip to content

Conversation

@trambui09
Copy link
Contributor

Include:

  • Create glasses activity
  • Launching a glasses activity in a phone main activity
  • Gate launch of glasses activity via ProjectedContext.isProjectedDeviceConnected() method

@trambui09 trambui09 requested review from a team, kkuan2011 and yrezgui as code owners December 22, 2025 23:30
@snippet-bot
Copy link

snippet-bot bot commented Dec 22, 2025

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@gemini-code-assist
Copy link

Summary of Changes

Hello @trambui09, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request lays the groundwork for AI glasses integration by incorporating essential Extended Reality (XR) libraries. It establishes a dedicated activity for the glasses display and a companion phone application that intelligently manages the connection to the glasses, enabling the launch of the glasses experience only when a device is actively connected. This ensures a seamless and context-aware user experience for projected content.

Highlights

  • New XR Dependencies: Added glimmer and projected libraries (version 1.0.0-alpha03) to the project's libs.versions.toml and build.gradle.kts files, enabling Extended Reality (XR) functionalities.
  • AI Glasses Activity: Introduced GlassesMainActivity.kt, a new ComponentActivity designed for AI glasses. This activity uses GlimmerTheme and displays a simple 'Hello, AI Glasses!' message with a close button.
  • Phone Launcher Activity: Created PhoneMainActivity.kt (named MainActivity within the file) which serves as a phone-side launcher. It detects the connection status of a projected device (AI glasses) using ProjectedContext.isProjectedDeviceConnected() and allows launching the GlassesMainActivity only when a device is connected.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a projected activity for AI glasses, along with a phone-side activity to launch it. It adds the necessary glimmer and projected dependencies. The implementation correctly uses ProjectedContext to check for device connection and to launch the glasses activity. My review includes critical feedback on declaring the new activities in the Android Manifest, which is currently missing and would cause the app to crash. I've also suggested a class rename for consistency and a minor formatting improvement for better code readability.

import androidx.xr.glimmer.surface

// [START androidxr_projected_ai_glasses_activity]
class GlassesMainActivity : ComponentActivity() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

GlassesMainActivity is not declared in xr/src/main/AndroidManifest.xml. All activities must be declared in the manifest file. For a projected activity, it should be declared with android:theme="@android:style/Theme.NoDisplay" and an intent filter for androidx.xr.projected.ACTION_BIND_PROJECTED_SERVICE. For example:

<activity
    android:name=".projected.GlassesMainActivity"
    android:exported="true"
    android:theme="@android:style/Theme.NoDisplay">
    <intent-filter>
        <action android:name="androidx.xr.projected.ACTION_BIND_PROJECTED_SERVICE" />
    </intent-filter>
</activity>

fun HomeScreen(modifier: Modifier = Modifier, onClose: () -> Unit) {
Box(
modifier = modifier
.surface(focusable = false).fillMaxSize(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability, it's a common convention in Jetpack Compose to chain modifiers on separate lines.

Suggested change
.surface(focusable = false).fillMaxSize(),
.surface(focusable = false)
.fillMaxSize(),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

import androidx.xr.glimmer.surface

// [START androidxr_projected_ai_glasses_activity]
class GlassesMainActivity : ComponentActivity() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you already have the code for an activity, do you want to add these activities to the manifest file for the xr module? If not, that's okay too, not a blocking comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes. This is important! And will be part of the snippets too. Added

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to add the region tags in the manifest file?

Would it be?


[END androidxr_projected_ai_glasses_activity_manifest] -->```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah per our snippets criteria, you can actually omit the region tags from the manifest and leave that hardcoded in the documentation pages. It would get more complicated as more docs need to reference parts of the manifest file and there's no way to have overlapping region tags.

wearPhoneInteractions = "1.1.0"
wearRemoteInteractions = "1.1.0"
xrGlimmer = "1.0.0-alpha03"
projected = "1.0.0-alpha03"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: also change to xrProjected

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeah, I had it changed and forgot to push it up! done!

import androidx.xr.glimmer.surface

// [START androidxr_projected_ai_glasses_activity]
class GlassesMainActivity : ComponentActivity() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah per our snippets criteria, you can actually omit the region tags from the manifest and leave that hardcoded in the documentation pages. It would get more complicated as more docs need to reference parts of the manifest file and there's no way to have overlapping region tags.

Copy link
Contributor

@kkuan2011 kkuan2011 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from snippets repo perspective. Defer to XR/Compose DRE for the XR-related and lifecycle handling parts.

android:name="com.example.xr.projected.PhoneMainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you have two activities with the Main intent filter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants