Status Update
Comments
al...@google.com <al...@google.com> #2
Maybe also something aline the lines of:
inline fun <reified T> Bundle.parcelable(key: String): T? = when {
SDK_INT >= 33 -> getParcelable(key, T::class.java)
else -> @Suppress("DEPRECATION") getParcelable(key) as? T
}
ap...@google.com <ap...@google.com> #3
Over to platform owner for consideration.
pe...@google.com <pe...@google.com> #4
Yeah, we want this, but with
pe...@google.com <pe...@google.com> #5
also bugs me about Parcel.readParcelable
. if ya gonna nag me in a gazilion places through my code at least give me a nice way to resolve it. these 'blah is deprecated' msgs for code that works on my minSdkVersion just kill me. sticking an if or a supress on every second line of my code is just ...
a little comment about the above kotlin inline fun, I need both kotlin and java solution.
el...@google.com <el...@google.com> #6
Re #4, I think Google should offer this even if it's only going to work on U+ because right now the original APIs are deprecated and the replacements are not safe to use.
al...@google.com <al...@google.com> #7
pe...@google.com <pe...@google.com> #8
To add to #5, I went half an hour through the app, thinking the new method is backwards-compatible. Android Studio reported no issues, having the compileSdkVersion to 33 and minSdkVersion at 23.
Run the app on the device and boom, crash. Time to revert everything or replace every method with a backwards-compatbile function that I have to integrate on my own :(.
Description
See API council conversation here:https://chat.google.com/room/AAAATnZMo34/VJnRMh_50Z8
For Java APIs in AndroidX, there isn't a standard way to deliver an async result that could fail. For Kotlin you'd use a OutcomeReceiver , which was added in API 31.
suspend fun
(which can throw) and for Java APIs in the platform you'd use anFor context, we (
androidx.webkit
) are designing an API that would benefit from being able to useOutcomeReceiver
and we'd prefer to use a standard approach rather than writing our own.I assume that
androidx.core.os
would be the right place for this to live.