Fixed
Status Update
Comments
ap...@google.com <ap...@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.
ap...@google.com <ap...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 996da0dc46ce7ee4199b56b21c024ce2dc5c1411
Author: Sanura N'Jaka <sanura@google.com>
Date: Tue May 25 22:42:20 2021
Add detailed error messages to the RetainInstanceUsageViolation classes
Added more detailed error messages to the
RetainInstanceUsageViolation classes to
include the fragment causing the violation.
RelNote: "The classes extending `RetainInstanceUsageViolation`
now have more detailed error messages that include the fragment
causing the violation."
Bug: 187871638
Test: ./gradlew checkApi
Change-Id: I6bd559d35f8b4f9aa340efa3f36cb4aab782bc22
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/GetRetainInstanceUsageViolation.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/SetRetainInstanceUsageViolation.java
https://android-review.googlesource.com/1718631
Branch: androidx-main
commit 996da0dc46ce7ee4199b56b21c024ce2dc5c1411
Author: Sanura N'Jaka <sanura@google.com>
Date: Tue May 25 22:42:20 2021
Add detailed error messages to the RetainInstanceUsageViolation classes
Added more detailed error messages to the
RetainInstanceUsageViolation classes to
include the fragment causing the violation.
RelNote: "The classes extending `RetainInstanceUsageViolation`
now have more detailed error messages that include the fragment
causing the violation."
Bug: 187871638
Test: ./gradlew checkApi
Change-Id: I6bd559d35f8b4f9aa340efa3f36cb4aab782bc22
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/GetRetainInstanceUsageViolation.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/SetRetainInstanceUsageViolation.java
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit d2d0bb6647a1331c02b95e7fe27abd19963435bb
Author: Sanura N'Jaka <sanura@google.com>
Date: Mon May 24 21:40:10 2021
Add detailed error message to FragmentTagUsageViolation
Added more detailed error message to FragmentTagUsageViolation
that includes the parent container that the fragment would
have been added to.
RelNote: "`FragmentTagUsageViolation` now contains more
detailed error message that container the parent container
that the fragment would have been added to."
Bug: 187871638
Test: ./gradlew checkApi
Change-Id: Ic33a7bfc836a8640b04af915268f5bc9e027bde3
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/androidTest/res/layout/activity_inflated_fragment.xml
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentTagUsageViolation.java
https://android-review.googlesource.com/1717074
Branch: androidx-main
commit d2d0bb6647a1331c02b95e7fe27abd19963435bb
Author: Sanura N'Jaka <sanura@google.com>
Date: Mon May 24 21:40:10 2021
Add detailed error message to FragmentTagUsageViolation
Added more detailed error message to FragmentTagUsageViolation
that includes the parent container that the fragment would
have been added to.
RelNote: "`FragmentTagUsageViolation` now contains more
detailed error message that container the parent container
that the fragment would have been added to."
Bug: 187871638
Test: ./gradlew checkApi
Change-Id: Ic33a7bfc836a8640b04af915268f5bc9e027bde3
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/androidTest/res/layout/activity_inflated_fragment.xml
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentTagUsageViolation.java
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit aebee10e6c24c82a5701a56caf483cbebf39e24f
Author: Sanura N'Jaka <sanura@google.com>
Date: Tue May 25 22:56:47 2021
Add detailed error messages to the TargetFragmentUsageViolation classes
Added more detailed error messages to the classes
extending TargetFragmentUsageViolation to include
the fragment causing the violation and any other
contained information.
RelNote: "The use case classes for `TargetFragmentUsageViolation`
now have more detailed error messages to include the fragment
causing the violation and any other contained information."
Bug: 187871638
Test: ./gradlew checkApi
Change-Id: Icc6aceb7a1fd79894fea1837be43a3090c2af4a6
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/GetTargetFragmentRequestCodeUsageViolation.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/GetTargetFragmentUsageViolation.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/SetTargetFragmentUsageViolation.java
https://android-review.googlesource.com/1718632
Branch: androidx-main
commit aebee10e6c24c82a5701a56caf483cbebf39e24f
Author: Sanura N'Jaka <sanura@google.com>
Date: Tue May 25 22:56:47 2021
Add detailed error messages to the TargetFragmentUsageViolation classes
Added more detailed error messages to the classes
extending TargetFragmentUsageViolation to include
the fragment causing the violation and any other
contained information.
RelNote: "The use case classes for `TargetFragmentUsageViolation`
now have more detailed error messages to include the fragment
causing the violation and any other contained information."
Bug: 187871638
Test: ./gradlew checkApi
Change-Id: Icc6aceb7a1fd79894fea1837be43a3090c2af4a6
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/GetTargetFragmentRequestCodeUsageViolation.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/GetTargetFragmentUsageViolation.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/SetTargetFragmentUsageViolation.java
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-main
commit 41e606d14226682f62777d89ebdaf17a1e97ed26
Author: Sanura N'Jaka <sanura@google.com>
Date: Tue May 25 23:14:49 2021
Add detailed error message to WrongFragmentContainerViolation
Added more detailed error message to WrongFragmentContainerViolation
that includes the fragment causing the violation and the container
that the fragment was being added to.
RelNote: "`WrongFragmentContainerViolation` now has more
detailed error message that includes the container that
the fragment was being added to."
Bug: 187871638
Test: ./gradlew checkApi
Change-Id: Ib55f8e4c05e8e2ff6c25916df0749d820ade30d3
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/WrongFragmentContainerViolation.java
https://android-review.googlesource.com/1717941
Branch: androidx-main
commit 41e606d14226682f62777d89ebdaf17a1e97ed26
Author: Sanura N'Jaka <sanura@google.com>
Date: Tue May 25 23:14:49 2021
Add detailed error message to WrongFragmentContainerViolation
Added more detailed error message to WrongFragmentContainerViolation
that includes the fragment causing the violation and the container
that the fragment was being added to.
RelNote: "`WrongFragmentContainerViolation` now has more
detailed error message that includes the container that
the fragment was being added to."
Bug: 187871638
Test: ./gradlew checkApi
Change-Id: Ib55f8e4c05e8e2ff6c25916df0749d820ade30d3
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/WrongFragmentContainerViolation.java
il...@google.com <il...@google.com> #8
We've improved the error messages of all of the Violations. This will be available in Fragment 1.4.0-alpha03.
Description
Component used: Fragment Version used: 1.4.0-alpha01
The Fragment StrictMode outputs to the log when you use
penaltyLog()
orpenaltyDeath()
. While these print the Violation class name and the stack trace, they don't provide useful structured information that would help developers figure out the cause of the exception from only the log message.Building on top of b/187871150 , each
Violation
should use what structured information it has access to in order to override the exception message with a more useful, pre-formatted log message.We should still keep the currently used 'Policy violation in $fragmentName' message (as the exception message will be included in the output of the violation as the
Exception
parameter to theLog
call.