{"id":28855361,"url":"https://github.com/firebaseextended/codelab-measure-android-view-performance","last_synced_at":"2025-10-05T12:29:41.777Z","repository":{"id":44558932,"uuid":"355268335","full_name":"FirebaseExtended/codelab-measure-android-view-performance","owner":"FirebaseExtended","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-04T14:53:55.000Z","size":118,"stargazers_count":11,"open_issues_count":2,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-19T23:05:01.450Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FirebaseExtended.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-06T17:04:34.000Z","updated_at":"2024-09-24T07:15:46.000Z","dependencies_parsed_at":"2022-09-13T15:31:35.797Z","dependency_job_id":null,"html_url":"https://github.com/FirebaseExtended/codelab-measure-android-view-performance","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FirebaseExtended/codelab-measure-android-view-performance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FirebaseExtended%2Fcodelab-measure-android-view-performance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FirebaseExtended%2Fcodelab-measure-android-view-performance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FirebaseExtended%2Fcodelab-measure-android-view-performance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FirebaseExtended%2Fcodelab-measure-android-view-performance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FirebaseExtended","download_url":"https://codeload.github.com/FirebaseExtended/codelab-measure-android-view-performance/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FirebaseExtended%2Fcodelab-measure-android-view-performance/sbom","scorecard":{"id":50425,"data":{"date":"2025-08-11","repo":{"name":"github.com/FirebaseExtended/codelab-measure-android-view-performance","commit":"490cbe4ccc860546d614bd69702408a305049c75"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/10 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-14T23:36:58.333Z","repository_id":44558932,"created_at":"2025-08-14T23:36:58.337Z","updated_at":"2025-08-14T23:36:58.337Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278456634,"owners_count":25989948,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-19T23:04:28.504Z","updated_at":"2025-10-05T12:29:41.772Z","avatar_url":"https://github.com/FirebaseExtended.png","language":"Java","readme":"# Measuring Load time and Screen Rendering with Firebase Performance\n\nThis repo contains the source code to be used for the Codelab for Google I/O 2021 and Firebase Summit 2021.\n\nSupported Features\n------------------\n\n## Activity/Fragment load time\n\nThis is measured in 2 phases. \n\nIn the first phase we measure the time when the view tree is about to be drawn. This is done by \nregistering a callback to [ViewTreeObserver.OnDrawListener](https://developer.android.com/reference/android/view/ViewTreeObserver.OnDrawListener). \nGetting this callback for the very first time (**first frame**) means that the complete UI \n(_including all views in the view hierarchy_) have been measured, laid out and given a frame. \nThe drawing operation happens immediately after this callback.\n\nIn the second phase we measure the time when that **first frame** view is completely drawn. This is \ndone by posting a message to the front of [MessageQueue](https://developer.android.com/reference/android/os/MessageQueue) \nof the [Looper](https://developer.android.com/reference/android/os/Looper#getMainLooper()) \nassociated with the Main/UI thread ([reference](https://dev.to/pyricau/android-vitals-first-draw-time-m1d)).\n\n**Note:** This is how Android framework measures the app startup time i.e by measuring the time from \ncreating the app object until when the first frame completely loads and drawn on the screen \n([reference](https://developer.android.com/topic/performance/vitals/launch-time#cold)).\n\n## Fragment Screen Rendering (Slow/Frozen frames)\n\nFirebasePerformance automatically records Screen Rendering data for Activities \n([reference](https://firebase.google.com/docs/perf-mon/screen-traces?platform=android)) however, it \ndoes not record this information for Fragments. This is because the \n[FrameMetricsAggregator](https://developer.android.com/reference/androidx/core/app/FrameMetricsAggregator) \nAPI records the duration of rendering for an entire window and not a part of window.\n\nWe can however record those metrics for the duration when the Fragment is active. This is done by \nstart recording the frames as soon as the Fragment is attached to the screen and stop recording as \nsoon as the Fragment is detached. \n\nThe core logic for Slow/Frozen frames is copied from \n[Fireperf Source Code](https://github.com/firebase/firebase-android-sdk/blob/d18cc40d39c7c3a0b7df107d16b1c686b51d195f/firebase-perf/src/main/java/com/google/firebase/perf/application/AppStateMonitor.java). \nThis also means we create the trace name with [SCREEN_TRACE_PREFIX](https://github.com/firebase/firebase-android-sdk/blob/d18cc40d39c7c3a0b7df107d16b1c686b51d195f/firebase-perf/src/main/java/com/google/firebase/perf/util/Constants.java#L53) \nand attach [frame metrics](https://github.com/firebase/firebase-android-sdk/blob/d18cc40d39c7c3a0b7df107d16b1c686b51d195f/firebase-perf/src/main/java/com/google/firebase/perf/application/AppStateMonitor.java#L334-L343) \nso as to show the screen rendering information for the Fragment on the Firebase Console.\n\n**Note:** If Fragment is covering only a part of the Screen than the reported metric will be skewed \nas it's impossible to know (from that API) what part of the screen contributes to those results.\n\n## Credits\n * [John Reck](https://github.com/jreck) (Google) for providing useful feedback on the various \n approaches on how we can measure the load time of Activity.\n \n * [Pierre-Yves Ricau](https://twitter.com/Piwai) for the below 2 blog posts that we referenced:\n    * [Android Vitals - First draw time 👩‍🎨](https://dev.to/pyricau/android-vitals-first-draw-time-m1d)\n    * [Android Vitals - Rising to the first drawn surface 🤽‍♂️](https://dev.to/pyricau/android-vitals-rising-to-the-first-drawn-surface-1j9e)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirebaseextended%2Fcodelab-measure-android-view-performance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirebaseextended%2Fcodelab-measure-android-view-performance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirebaseextended%2Fcodelab-measure-android-view-performance/lists"}