'OnReceiveContentListener showing "AppName doesn't support image insertion here"

When using the OnReceiveContentListener I followed along with the guide here. I also looked at the example project they reference. From my understanding the way it works is that if I enter the code

val editTextOnReceiveContentListener =
    androidx.core.view.OnReceiveContentListener { editText, contentInfoCompat ->
        val split = contentInfoCompat.partition { it.uri != null }
        val uriContent = split.first
        val remaining = split.second

        /** Process uriContent here... **/

        //return remaining
        remaining
    }

ViewCompat.setOnReceiveContentListener(
    myEditText,
    arrayOf("image/gif", "image/png"),
    editTextOnReceiveContentListener
)

Then when 'remaining' is null the app will NOT show the user "AppName doesn't support image insertion here". And most of the time it seems to be work just as I expect.

However if I use the 'Cold Boot Now' option for starting the emulator (and other times occasionally) then the first gif that is entered will still display that image insertion is not supported here. Everything else seems to work fine except it shows the error. This happens even though the log shows that 'remaining' is null. I tested it on emulator devices Nexus 5 and Pixel 2 for API 29 and 31.

My question is, is this something that I should be concerned about and/or can fix in some way?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source