FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Migrate JankStatsSample from Views to Jetpack Compose and Navigation3 by AjeshRPai · Pull Request #362 · android/performance-samples · GitHub

Migrate JankStatsSample from Views to Jetpack Compose and Navigation3 - #362

Merged
AjeshRPai merged 3 commits into
mainfrom
compose-migration
Aug 13, 2026
Merged

Migrate JankStatsSample from Views to Jetpack Compose and Navigation3#362
AjeshRPai merged 3 commits into
mainfrom
compose-migration

Conversation

AjeshRPai commented Aug 5, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

This pull request modernizes the JankStats sample app by migrating from the legacy View-based and Fragment-based UI architecture to a fully Jetpack Compose-based navigation and UI structure. It also updates the project to use newer Android SDK versions, upgrades dependencies, and removes obsolete code. These changes improve maintainability, leverage the latest Android features, and simplify the codebase.

Migration to Jetpack Compose and Navigation3:

  • Refactored JankAggregatorActivity and JankLoggingActivity from AppCompatActivity with Fragments/ViewBinding to ComponentActivity using Compose UI, Compose navigation, and state management. All navigation is now handled via Compose and Navigation3, eliminating the need for Fragments and ViewBinding. [1] [2] [3] [4] [5]
  • Removed legacy Fragments and custom Views (MessageContentFragment, JankyView) that are no longer needed with the Compose architecture. [1] [2]

Dependency and Build System Updates:

  • Updated compileSdk and targetSdk to 36, and minSdk to 23 for improved API support and security.
  • Upgraded Java compatibility to version 21 and enabled resource shrinking and code minification for release builds.
  • Updated dependencies to use Compose Material3, Navigation3, and removed legacy libraries (e.g., constraintlayout, navigation.fragment, navigation.ui). Added kotlinx.serialization for future extensibility. [1] [2]

Manifest and Theming Adjustments:

  • Set android:windowSoftInputMode="adjustResize" for main activities to improve keyboard handling with Compose layouts.

These changes collectively modernize the sample app, reduce technical debt, and provide a better foundation for Compose-based development.

…ion3

* Replace Fragment-based UI and Navigation Component with Jetpack Compose and Jetpack Navigation3.
* Remove `MessageListFragment`, `MessageContentFragment`, `ComposeListFragment`, `MessageListAdapter`, and associated XML layout files and navigation graphs.
* Add Jetpack Compose UI components (`MessageList`, `MessageContentScreen`, `JankStatsScaffold`) and Navigation3 components (`NavKeys`, `NavigationState`, `Navigator`).
* Refactor `JankLoggingActivity` and `JankAggregatorActivity` to `ComponentActivity` using `setContent` with Compose UI and Lifecycle effects.
* Bump `compileSdk` and `targetSdk` to 36, and `minSdk` to 23.
* Add `navigation3` and `kotlinx-serialization` dependencies to Gradle configuration.
AjeshRPai marked this pull request as ready for review August 5, 2026 03:37
AjeshRPai requested a review from a team as a code owner August 5, 2026 03:37
AjeshRPai removed the request for review from a team August 5, 2026 03:38
* Migrate UI components, scaffold, and theme from Compose Material to Material 3.
* Update project dependencies including Kotlin, AGP, Compose BOM, JankStats, and Navigation3.
* Upgrade Java target and source compatibility to Java 21.
* Enable code minification (`isMinifyEnabled`) and resource shrinking (`isShrinkResources`) for release builds.
* Move `android.intent.action.MAIN` intent filter to `JankAggregatorActivity`.
* Remove unused dependencies and unused imports across the sample app.
AjeshRPai requested review from a team and keyboardsurfer August 5, 2026 04:20
}
}

// [START aggregator_tracking_enabled]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

we used these with includecode on DAC. pls make sure they either aren't needed anymore, or they should be reworked on DAC (this is the same as the android/snippets repo uses)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yup, this is in line with DAC updates


setContent {
jankStats = remember {
JankStats.createAndTrack(window, jankFrameListener)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think the window, jankFrameListener should be part of remember as keys ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes, you are right. Updated

AjeshRPai merged commit 43d879e into main Aug 13, 2026
11 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL