[image_picker_android] Improved Bitmap resize on Android
Improves Bitmap load and resize on Android.
Original PR on flutter/plugins: https://github.com/flutter/plugins/pull/6947
Issue: https://github.com/flutter/flutter/issues/118383
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 [relevant style guides] and ran [the auto-formatter]. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
- [x] I signed the [CLA].
- [x] The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
- [x] I listed at least one issue that this PR fixes in the description above.
- [x] I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].
- [x] I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style].
- [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] All existing and new tests are passing.
Re-requesting review from @tarrinneal and @stuartmorgan as you were both requested on the previous version of this PR.
Have you run any benchmarks to see if/how much this is better than the old behaviour?
Sorry, guys. I clicked on "request review" button on @stuartmorgan requested changes, and accidentally removed @gmackall and @tarrinneal from review. It wasn't on purpose.
Have you run any benchmarks to see if/how much this is better than the old behaviour?
@tarrinneal , I just ran manual tests. I didn't do any benchmark test to compare the performance.
Before I tried to pick an 12000 x 9000 px, ~10MB image using the example app and it crashed due to an OutOfMemory error (even when the resize was not necessary).
This patch skips Bitmap decoding when resize or quality changes are not needed. Plus it can improve the resize process by subsampling image decoding depending on the maximum requested dimension.
Do you have any tips on how to benchmark it?
@beroso is this something you still plan on working on?
Thank you all for the support!
By the way, the release job is running for about 4 hours. Is it normal?
No, release was completely broken by the 3.10 release, it turns out. I manually released it for now.