Status Update
Comments
al...@google.com <al...@google.com> #2
Can you attach / share a project that reproduces the issue?
lo...@gmail.com <lo...@gmail.com> #3
because just occur recyclerview inside viewpager2 with constraintlayout, if paging3 use Independently with viewpage2 it's not problem.
lo...@gmail.com <lo...@gmail.com> #5
al...@google.com <al...@google.com> #6
lo...@gmail.com <lo...@gmail.com> #7
ga...@google.com <ga...@google.com> #8
Hi Louis - an example app to help replicate would be useful. I have been trying to replicate this myself with a toy Launcher app and seeing the effect on any watch face, but seeing what you're doing would be of use.
Thanks
al...@google.com <al...@google.com> #9
If the watchfaces are not automatically going into ambient mode there could be a bug. Would you mind capturing a
NOTE unless you have selected always on display generally watchfaces won't go ambient, instead typically the display turns off.
lo...@gmail.com <lo...@gmail.com> #10
Hello!
I'm not familiar with capturing bug reports on Wear OS devices, but I now have a complete minimized reproducing project, as requested in
Please, find it attached.
You should be able to easily try it by just launching the wear app on a Wear OS device or emulator, comparing between Wear OS 2 and Wear OS 3.
The most important code is in the HomeScreenActivity.kt
file.
lo...@gmail.com <lo...@gmail.com> #11
BTW, in the WatchFaceService.kt
file (from androidx.wear.watchface
), I found a part of the culprit, which is located at the beginning of the onCommand
function. I added ⚠️ emojis to prefix my comments relevant to this issue in the snippet below:
override fun onCommand(
action: String?,
x: Int,
y: Int,
z: Int,
extras: Bundle?,
resultRequested: Boolean
): Bundle? {
// From android R onwards the integration changes and no wallpaper commands are allowed
// or expected and can/should be ignored. ⚠️ Well, not all, actually, unless an alternative is provided.
if (!expectPreRInitFlow()) {
TraceEvent("onCommand Ignored").close()
return null
}
when (action) {
Constants.COMMAND_AMBIENT_UPDATE -> // ⚠️Launcher/home screen apps care about this.
uiThreadHandler.runOnHandlerWithTracing("onCommand COMMAND_AMBIENT_UPDATE") {
ambientTickUpdate()
}
Constants.COMMAND_BACKGROUND_ACTION -> // ⚠️Launcher/ home screen apps care about this.
uiThreadHandler.runOnHandlerWithTracing("onCommand COMMAND_BACKGROUND_ACTION") {
wslFlow.onBackgroundAction(extras!!)
}
}
// Other actions launcher apps don't care about, ⚠️ except for TAP, TOUCH, and TOUCH_CANCEL
}
return null
}
lo...@gmail.com <lo...@gmail.com> #13
Hi, I'm blocked by this for my app. What is the progress on this issue, if there's any?
la...@gmail.com <la...@gmail.com> #14
Has there really been no progress on this? Seems like this would be a bigger deal since in Wear OS 3 there is an option to set a different home app. Seems half thought through.
ga...@google.com <ga...@google.com> #15
I get a fatal error when trying to run the repro:
2023-04-11 11:15:25.707 6157-6157 AndroidRuntime com.example.homescreen.repro E FATAL EXCEPTION: main
Process: com.example.homescreen.repro, PID: 6157
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:603)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
Caused by: android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{com.example.homescreen.repro/com.example.homescreen.repro.presentation.HomeScreenActivity}
at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:493)
at com.example.homescreen.repro.presentation.extensions.ComponentNameKt.getInfo(ComponentName.kt:56)
at com.example.homescreen.repro.presentation.extensions.ComponentNameKt.isEnabled(ComponentName.kt:28)
at com.example.homescreen.repro.presentation.MainActivity.rememberHomeScreenEnabledState(MainActivity.kt:40)
at com.example.homescreen.repro.presentation.MainActivity.access$rememberHomeScreenEnabledState(MainActivity.kt:21)
at com.example.homescreen.repro.presentation.MainActivity$onCreate$1.invoke(MainActivity.kt:28)
at com.example.homescreen.repro.presentation.MainActivity$onCreate$1.invoke(MainActivity.kt:27)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.ui.platform.ComposeView.Content(ComposeView.android.kt:404)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:250)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:249)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:177)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:123)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:122)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:114)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:157)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:156)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:156)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:140)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:78)
Description
Hello,
I am building a launcher for Wear OS (because I can't bear the notifications layout on my Samsung Galaxy Watch 4, and I can't be the only one), and I'm hitting a new Wear OS 3 wall where something broke:
My launcher supports ambient mode, and to turn the underlying watch face into ambient mode, it calls the
sendWallpaperCommand
method onWallpaperManager
as below:Reproducing requirements
AmbientModeSupport.attach(…)
)AndroidManifest.xml
file) to inherit from@android:style/Theme.DeviceDefault.Wallpaper.NoTitleBar
Expected
Works perfectly on all Wear OS versions: the watch face switches to ambient mode when the Activity enters ambient mode.
Actual
Works perfectly on Wear OS 2, but on Wear OS 3, the wallpaper command is ignored, which drains the battery as the watch face never switches to ambient mode and keeps updating.
Reproduced on
If a reproducing project can help you, please let me know, I'll take the time to make a small one.
Have a great day!
Louis CAD