Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 706078c215107f5cde51b66233dd0158bca729dc
Author: Manuel Vivo <mvivo@google.com>
Date: Wed May 12 16:12:08 2021
Add lint checks to repeatOnLifecycle APIs
Fixes: b/187887400
Change-Id: I4e50eacdfecc392b0343b862f5d63fcf20e72e1c
M lifecycle/lifecycle-runtime-ktx-lint/src/main/java/androidx/lifecycle/lint/LifecycleRuntimeIssueRegistry.kt
M lifecycle/lifecycle-runtime-ktx-lint/src/main/java/androidx/lifecycle/lint/LifecycleWhenChecks.kt
A lifecycle/lifecycle-runtime-ktx-lint/src/main/java/androidx/lifecycle/lint/RepeatOnLifecycleDetector.kt
A lifecycle/lifecycle-runtime-ktx-lint/src/test/java/androidx/lifecycle/lint/RepeatOnLifecycleDetectorTest.kt
M lifecycle/lifecycle-runtime-ktx-lint/src/test/java/androidx/lifecycle/lint/stubs/Stubs.kt
https://android-review.googlesource.com/1705341
Branch: androidx-main
commit 706078c215107f5cde51b66233dd0158bca729dc
Author: Manuel Vivo <mvivo@google.com>
Date: Wed May 12 16:12:08 2021
Add lint checks to repeatOnLifecycle APIs
Fixes:
Change-Id: I4e50eacdfecc392b0343b862f5d63fcf20e72e1c
M lifecycle/lifecycle-runtime-ktx-lint/src/main/java/androidx/lifecycle/lint/LifecycleRuntimeIssueRegistry.kt
M lifecycle/lifecycle-runtime-ktx-lint/src/main/java/androidx/lifecycle/lint/LifecycleWhenChecks.kt
A lifecycle/lifecycle-runtime-ktx-lint/src/main/java/androidx/lifecycle/lint/RepeatOnLifecycleDetector.kt
A lifecycle/lifecycle-runtime-ktx-lint/src/test/java/androidx/lifecycle/lint/RepeatOnLifecycleDetectorTest.kt
M lifecycle/lifecycle-runtime-ktx-lint/src/test/java/androidx/lifecycle/lint/stubs/Stubs.kt
Description
Warn developers when
Lifecycle.repeatOnLifecycle
is not used properly.They should definitely NOT be used in the
onStart
,onResume
View callbacks. In Activities, this API should be used in theonCreate
.onViewCreated
in the case of Fragments.