Skip to content

Conversation

@amyZepp
Copy link
Contributor

@amyZepp amyZepp commented May 15, 2025

updating to alpha04 and minor ui changes for orbiters

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.

Hello @amyZepp, 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!

Summary of Changes

Hello team, Gemini here to provide a summary of this pull request. The primary goal of this PR, as indicated by the title and description, is to update the project's dependencies to the alpha04 versions of the AndroidX XR libraries. This update also includes some minor adjustments to the UI layout, specifically affecting the 'orbiters' or UI components, and involves increasing the minimum supported SDK version.

Highlights

  • Dependency Updates: The core AndroidX XR dependencies (arcore, compose, scenecore) have been updated from 1.0.0-alpha01 to 1.0.0-alpha04. The impress dependency has also been removed.
  • Minimum SDK Increase: The minimum SDK version required to run the application has been increased from 23 to 24 in the build.gradle.kts file.
  • XR API Changes: Updates to the alpha04 libraries necessitated changes in how the SpatialEnvironment is accessed (now via session.scene) and how GltfModel instances are created (GltfModel.create instead of session.createGltfResourceAsync). The Session.create method now returns a SessionCreateSuccess object which needs to be cast to access the session.
  • Manifest Updates: The AndroidManifest.xml file has been updated to remove a commented-out tools:overrideLibrary line and add a uses-feature declaration for android.software.xr.api.spatial with required="false".
  • UI Layout Adjustments: Minor UI changes were made, including adjusting spatial layout modifiers in HelloAndroidXRApp.kt (fillMaxSize, fillMaxWidth, fixed widths) and applying fixed sizes to buttons in EnvironmentControls.kt. The SearchBar layout was simplified by removing spatial-specific padding logic and adjusting its size.

Changelog

Click here to see the changelog
  • app/build.gradle.kts
    • Increased minSdk from 23 to 24.
    • Removed the implementation(libs.impress) dependency.
  • app/src/main/AndroidManifest.xml
    • Removed commented-out uses-sdk tools:overrideLibrary line.
    • Added uses-feature android:name="android.software.xr.api.spatial" android:required="false".
  • app/src/main/java/com/example/helloandroidxr/environment/EnvironmentController.kt
    • Updated import for Session from scenecore to runtime.
    • Added import for androidx.xr.scenecore.scene.
    • Updated calls to access SpatialEnvironment via xrSession.scene.spatialEnvironment.
    • Changed GltfModel creation from xrSession.createGltfResourceAsync to GltfModel.create.
  • app/src/main/java/com/example/helloandroidxr/ui/HelloAndroidXRApp.kt
    • Updated imports for spatial layout modifiers (fillMaxSize, fillMaxWidth added, fillMaxHeight removed).
    • Modified SpatialRow to use fillMaxWidth().
    • Added a fixed width modifier to SpatialColumn.
    • Adjusted modifiers for SpatialPanels, changing the main panel to use fillMaxSize() instead of fixed width and fillMaxHeight().
  • app/src/main/java/com/example/helloandroidxr/ui/components/EnvironmentControls.kt
    • Added import for androidx.compose.foundation.layout.size.
    • Updated import for Session from scenecore to runtime.
    • Added import for androidx.xr.runtime.SessionCreateSuccess.
    • Updated Session.create call to handle the SessionCreateSuccess result and use a lazy delegate.
    • Added .size(56.dp) modifier to the SetVirtualEnvironmentButton, SetPassthroughButton, and RequestHomeSpaceButton composables.
  • app/src/main/java/com/example/helloandroidxr/ui/components/SearchBar.kt
    • Updated imports (height added, Spacer and size removed).
    • Removed import for LocalSpatialCapabilities.
    • Removed spatial-specific layout logic (checking uiIsSpatialized and adding Spacers/conditional padding).
    • Adjusted the modifier for SearchTextBox to use fixed width and height instead of size.
  • gradle/libs.versions.toml
    • Updated versions for arcore, compose, and scenecore to 1.0.0-alpha04.
    • Removed the impress version definition.
    • Removed the impress library definition.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.


Alpha code is new,
Dependencies updated,
UI looks better.

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 primarily focuses on updating Android XR dependencies to alpha04 versions, which includes arcore, compose, and scenecore. Correspondingly, the impress library has been removed. The changes also involve migrating code to adapt to new APIs from these updated libraries, increasing the minSdk to 24, and making some minor UI refinements for orbiters and other components.

Overall, the dependency updates and API migrations seem to be handled correctly. However, there's a critical issue regarding an unsafe cast during XR session creation that needs to be addressed to prevent potential runtime crashes.

Summary of Findings

  • Unsafe Cast in Session Creation: An unsafe cast as SessionCreateSuccess is used when creating the XR session in EnvironmentControls.kt. If Session.create() returns a failure state, this will lead to a ClassCastException and crash the application. This should be handled safely. (Commented with critical severity)
  • Dependency Updates to alpha04: Core XR libraries (arcore, compose, scenecore) were updated to 1.0.0-alpha04, and the impress library was removed. This aligns with the PR's stated goal. (Not commented due to review settings)
  • API Migration for XR Libraries: The codebase was adapted to API changes introduced in the alpha04 versions of XR libraries, particularly concerning androidx.xr.runtime.Session usage and GltfModel creation. (Not commented due to review settings)
  • UI Adjustments and Refinements: Minor UI tweaks were implemented, such as standardizing button sizes in EnvironmentControls, adjusting the SearchBar height, and refining layout modifiers (e.g., fillMaxWidth, fillMaxSize) in HelloAndroidXRApp. (Not commented due to review settings)
  • Android Manifest Configuration: The minSdk was increased from 23 to 24. The tools:overrideLibrary directive for androidx.xr.scenecore and androidx.xr.compose was removed, likely because the underlying issue is resolved with the SDK update. The <uses-feature android:name="android.software.xr.api.spatial" android:required="false" /> was added, which is a good practice for XR applications. (Not commented due to review settings)
  • Code Simplification in SearchBar: The SearchBar component was simplified by removing conditional logic related to uiIsSpatialized for its padding and layout. (Not commented due to review settings)

Merge Readiness

This pull request makes necessary updates to XR dependencies and adapts the code accordingly. However, due to the critical issue identified with the unsafe cast during XR session creation in EnvironmentControls.kt, I recommend that this issue be addressed before merging to prevent potential runtime crashes. Once the unsafe cast is handled, the PR should be in a much better state for merging. As a reviewer, I am not authorized to approve the pull request; please ensure further review and approval from other maintainers after addressing the feedback.

@amyZepp amyZepp merged commit 3e9f98c into android:main May 15, 2025
2 checks passed
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