deprecate Android announcement events and add deprecation warning.#165195
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
| if (Build.VERSION.SDK_INT >= API_LEVELS.API_36) { | ||
| Log.w( | ||
| TAG, | ||
| "Using AnnounceSemanticsEvent for accessibility is deprecated on Android. " | ||
| + "Migrate to using semantic properties for a more robust and accessible " | ||
| + "user experience"); | ||
| } |
There was a problem hiding this comment.
I tried adding a test for this log, but the problem is that robolectric does not support API 36 yet so there's no way of testing this if statement.
There was a problem hiding this comment.
File an issue and link that issue here. It is fine that we cant test something with roboletric that isn't supported.
There was a problem hiding this comment.
Just created it: robolectric/robolectric#10103
Adding it to my PR description now too.
There was a problem hiding this comment.
Please close that. We dont need to bother the robolectric team they know they need to add support for api 36. I meant file a bug against us to add the test once there is a version we can support.
There was a problem hiding this comment.
Ah gotcha, sorry that makes much more sense! Just added that issue:
#165220
There was a problem hiding this comment.
Also if there is android owned public documentation can you link to that?
Maybe https://developer.android.com/reference/android/view/View#announceForAccessibility(java.lang.CharSequence)
There was a problem hiding this comment.
Sounds good, added this.
|
test-exempt: Not supported by platform infrastructure. |
reidbaker
left a comment
There was a problem hiding this comment.
approve % removal of flutter_min or re-add of @VisibleForTesting annotation.
| if (Build.VERSION.SDK_INT >= API_LEVELS.API_36) { | ||
| Log.w( | ||
| TAG, | ||
| "Using AnnounceSemanticsEvent for accessibility is deprecated on Android. " | ||
| + "Migrate to using semantic properties for a more robust and accessible " | ||
| + "user experience"); | ||
| } |
There was a problem hiding this comment.
Also if there is android owned public documentation can you link to that?
Maybe https://developer.android.com/reference/android/view/View#announceForAccessibility(java.lang.CharSequence)
|
autosubmit label was removed for flutter/flutter/165195, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
autosubmit label was removed for flutter/flutter/165195, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request) Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request. ### Issue Link: What is the link to the issue this cherry-pick is addressing? This was a follow-up to #165195 and part of issue #165510 ### Changelog Description: Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples Developer warning message in `SemanticService.announce` is not clear when using internal flutter widgets. ### Impact Description: What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch) Developers see non-actionable warning messages when Accessibility Services are on and developers are using widgets like TimePicker, DatePicker, ExpansionTile, and Form. ### Workaround: Is there a workaround for this issue? No workaround. ### Risk: What is the risk level of this cherry-pick? ### Test Coverage: Are you confident that your fix is well-tested by automated tests? ### Validation Steps: What are the steps to validate that this fix works? Run the example below: https://github.com/flutter/flutter/blob/5491c8c146441d3126aff91beaa3fb5df6d710d0/examples/api/lib/material/time_picker/show_time_picker.0.dart#L10 When opening the time picker, the corrected warning message should show.
…lutter#165195) Due to this [Android deprecation](https://developer.android.com/reference/android/view/View#announceForAccessibility(java.lang.CharSequence)) Flutter needs to show deprecation warnings to developers when using announce on Android. Unfortunately testing this log statement is impossible since robolectric currently does not support API >=36. flutter#165220 will add the test code in once robolectric supports 36. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…lutter#165195) Due to this [Android deprecation](https://developer.android.com/reference/android/view/View#announceForAccessibility(java.lang.CharSequence)) Flutter needs to show deprecation warnings to developers when using announce on Android. Unfortunately testing this log statement is impossible since robolectric currently does not support API >=36. flutter#165220 will add the test code in once robolectric supports 36. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Due to this Android deprecation Flutter needs to show deprecation warnings to developers when using announce on Android.
Unfortunately testing this log statement is impossible since robolectric currently does not support API >=36.
#165220 will add the test code in once robolectric supports 36.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.