Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workaround for AOSP bug with decoding single channel hardware gai…
…nmaps using BitmapFactory. Android U devices that use skiagl for hwui renderering (currently the vast majority) have a bug where uplading single channel bitmaps to hardware bitmaps fails. This bug essentially breaks single channel gainmap rendering using hardware bitmaps, which is a common use case on devices that have Ultra HDR as the default capture format. See #5357 for more details. The workaround is as follows: 1. Detect the presence of the bug by attempting to copy a 1x1 single channel bitmap to hardware. 2. Memoize the result 3. For BitmapFactory.decode* calls, if the input bitmap has a gainmap, copy it to a three-channel gainmap. This step seems wasteful, but in practice, the Android OS already does some copying when creating hardware bitmaps. Also, more importantly, there is an AOSP fix for this bug, and as devices are updated with this fix, this flow will no longer be exercised.
- Loading branch information