Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
my...@gmail.com <my...@gmail.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit e3ae9332249aad7636d3050afb3278ada0199fad
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Jul 30 15:49:25 2020
Ensure ActivityResult lint works with newer lint versions
Previously the lint rule only worked for version 26.3.0 of lint since it
used API that had been deleted in later versions. We have a problem
where we need to be able to on older versions, but should also support
newer versions.
This changes use reflection to access the APIs from version 26.3.0 and
27.1.0, which means the rule should now work no matter what version of
lint.
Test: added tests for 27.1.0, tested in app for 26.3.0
Bug: 162155191
Change-Id: I732ca50aa629fc8a0c2df4c183f363e4a286c490
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
https://android-review.googlesource.com/1380294
Branch: androidx-master-dev
commit e3ae9332249aad7636d3050afb3278ada0199fad
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Jul 30 15:49:25 2020
Ensure ActivityResult lint works with newer lint versions
Previously the lint rule only worked for version 26.3.0 of lint since it
used API that had been deleted in later versions. We have a problem
where we need to be able to on older versions, but should also support
newer versions.
This changes use reflection to access the APIs from version 26.3.0 and
27.1.0, which means the rule should now work no matter what version of
lint.
Test: added tests for 27.1.0, tested in app for 26.3.0
Bug: 162155191
Change-Id: I732ca50aa629fc8a0c2df4c183f363e4a286c490
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 09a87685c459896deb8f152376b2460c5d759891
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Jul 31 13:47:02 2020
Ensure check fails on all calls to regsiterForActivityResult
Although fixing one of the errors will fix them all, we should still
make sure we show the errors on all of the calls to
registerForActivityResult, not just the last one.
Test: added test
Bug: 162155191
Change-Id: I28c694547c71ebd97576cf2786e7154cccdf3d22
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
https://android-review.googlesource.com/1384201
Branch: androidx-master-dev
commit 09a87685c459896deb8f152376b2460c5d759891
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Jul 31 13:47:02 2020
Ensure check fails on all calls to regsiterForActivityResult
Although fixing one of the errors will fix them all, we should still
make sure we show the errors on all of the calls to
registerForActivityResult, not just the last one.
Test: added test
Bug: 162155191
Change-Id: I28c694547c71ebd97576cf2786e7154cccdf3d22
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 09a87685c459896deb8f152376b2460c5d759891
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Jul 31 13:47:02 2020
Ensure check fails on all calls to regsiterForActivityResult
Although fixing one of the errors will fix them all, we should still
make sure we show the errors on all of the calls to
registerForActivityResult, not just the last one.
Test: added test
Bug: 162155191
Change-Id: I28c694547c71ebd97576cf2786e7154cccdf3d22
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
https://android-review.googlesource.com/1384201
Branch: androidx-master-dev
commit 09a87685c459896deb8f152376b2460c5d759891
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Jul 31 13:47:02 2020
Ensure check fails on all calls to regsiterForActivityResult
Although fixing one of the errors will fix them all, we should still
make sure we show the errors on all of the calls to
registerForActivityResult, not just the last one.
Test: added test
Bug: 162155191
Change-Id: I28c694547c71ebd97576cf2786e7154cccdf3d22
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
jb...@google.com <jb...@google.com> #7
This has been fixed internally and will be available in the Activity-alpha08 release.
ap...@google.com <ap...@google.com> #8
Project: platform/frameworks/support
Branch: androidx-main
commit 3a770fd029c9c0c62b745c55b240b8f3f07e4b94
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Dec 20 21:51:17 2023
Remove code path for older lint versions and reflection
When the ActivityResultFragmentVersionDetector was written there had
been recent changes in the lint API that required it to be supported in
2 incompatiable lint versions (see b/162155191 ). That was over 3 years
and 4 lint versions ago, but it required the use of some unsafe
reflection.
Enough time has passed that it is reasonable to expect that most people
using the latest version of the Activity library are also using some
more recent version of lint.
We can clean up this rule by removing the old lint path and relying
directly on lint API instead of reflection.
This also reenables some tests that were failing due to bugs in previous
lint versions.
RelNote: "The `InvalidFragmentVersionForActivityResult` lint check will
now only work on AndroidStudio versions 4.1.0+."
Test: reenabled tests
Bug: 317158163
Fixes: 293517205
Change-Id: I84933f5cd66e5f4e699ccc6663a4d25cd4138049
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
https://android-review.googlesource.com/2886313
Branch: androidx-main
commit 3a770fd029c9c0c62b745c55b240b8f3f07e4b94
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Dec 20 21:51:17 2023
Remove code path for older lint versions and reflection
When the ActivityResultFragmentVersionDetector was written there had
been recent changes in the lint API that required it to be supported in
2 incompatiable lint versions (see
and 4 lint versions ago, but it required the use of some unsafe
reflection.
Enough time has passed that it is reasonable to expect that most people
using the latest version of the Activity library are also using some
more recent version of lint.
We can clean up this rule by removing the old lint path and relying
directly on lint API instead of reflection.
This also reenables some tests that were failing due to bugs in previous
lint versions.
RelNote: "The `InvalidFragmentVersionForActivityResult` lint check will
now only work on AndroidStudio versions 4.1.0+."
Test: reenabled tests
Bug: 317158163
Fixes: 293517205
Change-Id: I84933f5cd66e5f4e699ccc6663a4d25cd4138049
M activity/activity-lint/src/main/java/androidx/activity/lint/ActivityResultFragmentVersionDetector.kt
M activity/activity-lint/src/test/java/androidx/activity/lint/ActivityResultFragmentVersionDetectorTest.kt
Description
This code snippet will no longer work with lint tools
27.1.0+
(which is what's used in AGP 4.1.0+).It looks like it should be changed to
buildVariant
, and then there are changed APIs for accessing library info (the.libraries
call at the end will also need fixing).This results in the following failure when I build with newer lint tools and AGP 4.1.0-beta05 in our project