Monday, August 3, 2020

[Update 2: Fixed] This wallpaper triggers a rare bug causing Android devices to bootloop

Update 2 (08/03/2020 @ 3:03 PM ET): With the August 2020 Android Security Patches, Google has updated Android to fix this bug. More details can be found at the bottom.

Update 1 (06/04/2020 @ 03:12 AM ET): Newer explanations have emerged on what causes the “cursed wallpaper” to crash phones, alongside a response from Google. Scroll to the bottom for more information. The article as published on June 1, 2020, is preserved below.

Imagine you’re scouring the internet for cool wallpapers and you come across a picturesque landscape. It has everything; a lush green forest, a pristine lake with a tiny island, snow-capped mountains in the background, and a thick cloud cover with sunlight seeping in through the gaps. You immediately download the image, set it as your phone’s wallpaper, and boom! Your Android phone gets stuck in a bootloop. Sounds unlikely, doesn’t it? Well, it’s true for this particular wallpaper.

The wallpaper was recently shared on Twitter by renowned Samsung leakster Ice Universe, who claimed that the wallpaper “will cause your phone to crash!” Despite their warning, several users downloaded the wallpaper to check if it actually did do anything on their phone and they were met with the following results:

According to Davide Bianco, lead developer of the AOSP-based custom ROM “POSP”, this particular wallpaper causes some Android devices to crash as it makes use of the RGB color space, instead of the sRGB color space that is supported natively on Android. Bianco has submitted a patch to AOSP that reportedly fixes the issue and the description of the patch states that “The issue occurs when the user tries to set as wallpaper an image that is not sRGB. What happens is that variable y value is higher than the histogram bounds, making SysUI crash. One possible fix is to limit y value to be always less than 256.” Along with Bianco, two developers, XDA Senior Member BadDaemon and XDA Recognized Developer luca020400, from the popular LineageOS custom ROM team have also come up with a unique solution to the problem. You can check out the patch descriptions over on the LineageOS Gerrit by following this link and this link.

We strongly recommend against using this image as your wallpaper under any circumstances. In case you have already used it and your device is stuck in a bootloop, please check the instructions below on how you may be able to recover your device.

A report from 9to5Google on the matter further reveals that the issue is limited to devices running Android 10 or older and it doesn’t affect devices running the Android 11 Developer Preview. This is due to the fact that on Android 11, the system converts the color space if it’s not supported, but on Android 10 it does not. Which means that this isn’t an issue with this particular image and could be caused by other images using the RGB color space.

Do note that while the issue doesn’t affect all Android devices, we strongly recommend against trying the wallpaper on your phone. In case you try it anyway, you might be able to recover your device by either resetting it completely or by entering safe mode and changing the wallpaper. But since some users over on Twitter weren’t able to recover their devices using the aforementioned methods, it would be best if you don’t use the exact image as your wallpaper. If you really like the wallpaper, just take a screenshot of the image and use that as your wallpaper instead.


Update 1: New Explanation, Response from Google

Expanding on the causes of the bug as explained by XDA Senior Member BadDaemon and XDA Recognized Developer luca020400, the “cursed” wallpaper is encoded in a special color space which is called “Google/Skia/E3CADAB7BD3DE5E3436874D2A9DEE126” (this is the full name of the color space, and Skia refers to the 2D graphics library made by Google.) In contrast, most other wallpaper images are encoded in a color space called “sRGB”.

In Android versions 10 and older, all images are converted to sRGB unless otherwise specified by the developers. There’s a rare bug that can occur when converting the image to sRGB, wherein the code that calculates the “luminance” value of each pixel manages to exceed the maximum limit of 255.

Luminance is calculated using the following formula:

Luminance = .2126f * r + .7152f * g + .0722f * b

Here “r”, “g”, and “b” are red, green, and blue color values represented in an 8-bit value from 0 to 255.

The problem with this calculation is that each part is always rounded up before the final summation. One of the pixels in the “cursed” wallpaper, when in the process of converting the image from sRGB and then to greyscale, has the following RGB values: 255, 255, 243, which when plugged into the above equation looks like:

r: .2126 * 255 = 54.213 => 55

g: .7152 * 255 = 182.376 => 183

b: .0722 * 255 = 18.411 => 19

Luminance = r+ g + b = 257

This value causes SystemUI, and basically the whole OS, to crash because it exceeds the maximum value. It’s a bug that’s so incredibly specific because it involves a combination of a rounding error and color space conversion error.

This bug does not affect Android 11 because the image’s “Skia” color space is not converted to sRGB by default. Thus, this color space conversion error and the rounding error does not occur on Android 11.

However, Romain Guy from the Android Toolkit team at Google believes that the root cause of this issue is only in the way that luminance is calculated and not in any color space conversion issues. Google is conducting its own internal testing, so we will likely see what they come up with soon.

This explanation was updated to clarify that one of the pixels in the “cursed” wallpaper is the cause of this specific luminance rounding calculation error. We also clarified that the rounding occurs during each step of the luminance calculation and not at the end.


Update 2: Fixed in August 2020 patches

The Android security patches for the month of August just went live, and XDA Recognized Developer luca020400 spotted a commit in AOSP that merges a fix for this wallpaper bug.

The post [Update 2: Fixed] This wallpaper triggers a rare bug causing Android devices to bootloop appeared first on xda-developers.

HostGator Web Hosting

0 comments:

Post a Comment