Unable to getPixels(), pixel access is not supported on Config#HARDWARE bitmaps

I am looking at the demo android app. https://github.com/pytorch/android-demo-app

When I run the app in android version 10. There’s an error produce when this code below run.

Code
inputTensor = TensorImageUtils.bitmapToFloat32Tensor(
bitmap,
TensorImageUtils.TORCHVISION_NORM_MEAN_RGB,
TensorImageUtils.TORCHVISION_NORM_STD_RGB
)

Error
2020-02-22 11:24:29.690 19276-19594/com.say.dogbreedfinder E/TAG: Error during image analysis
java.lang.IllegalStateException: unable to getPixels(), pixel access is not supported on Config#HARDWARE bitmaps
at android.graphics.Bitmap.checkHardware(Bitmap.java:423)
at android.graphics.Bitmap.getPixels(Bitmap.java:1935)
at org.pytorch.torchvision.TensorImageUtils.bitmapToFloatBuffer(TensorImageUtils.java:67)
at org.pytorch.torchvision.TensorImageUtils.bitmapToFloat32Tensor(TensorImageUtils.java:108)
at org.pytorch.torchvision.TensorImageUtils.bitmapToFloat32Tensor(TensorImageUtils.java:34)

Note: if I run on android 9, it’s working fine.

Anyone know what could be the issue and how we can resolve this ?

I found a work around is by config Bitmap to not use the HARDWARE.

        val mutableBitmap = bitmap.copy(Bitmap.Config.RGBA_F16, true)

        inputTensor = TensorImageUtils.bitmapToFloat32Tensor(
            mutableBitmap,
            TensorImageUtils.TORCHVISION_NORM_MEAN_RGB,
            TensorImageUtils.TORCHVISION_NORM_STD_RGB
        )

Even though, this work around work, I would like to know if we can preserve the HARDWARE config since it’s provide more benefits with later Android version.