This has led some developers to believe that we will be creating app widgets using Compose UI. I strongly doubt that this is the case. We will be able to create app widgets using Compose, but not Compose UI.
Compose UI requires a Canvas to draw on. In Compose for Android, that is Android’s Canvas. In Compose for Desktop, that is a canvas API supplied by Skia and
Skiko.
However, other Compose targets, such as Compose for Web or Jake Wharton’s Mosaic, do not support Canvas. And, as a result, they do not support Compose UI. Compose for Web supports a facsimile of some of Compose UI, where they could pull off the same basic look using the DOM and CSS. And Mosaic has an even more limited API, given that it is targeting a terminal window rather than any sort of GUI.
Compose supports managing trees of data using composable functions. Compose UI supports managing trees of UI elements to be drawn on a Canvas using composable functions.
App widgets do not have a Canvas. Even though app widgets are part of Android, they are very different than the activities and fragments that we traditionally build. App widgets are really an IPC protocol between an app and a launcher, where the data passed between the process just so happens to describe a UI. That is why app widgets are created using RemoteViews, as that RemoteViews structure describes the UI and is what gets passed between the processes. RemoteViews does not give us a Canvas.
The most likely case is that writing app widgets with composables will look a bit like Compose UI, but the composables will map to things that you can represent in a RemoteViews. So, in the code snippet shown above, the Column() will map to a LinearLayout, the Text() will map to a TextView, and CheckBox() will map to a CheckBox (newly supported in RemoteViews in Android 12). But, you will not find TextField() in the app widgets API, as RemoteViews does not support EditText.
It would be truly wonderful if app widgets could somehow use the full suite of composables offered by Compose UI. Alas, that is unrealistic.