Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long running tessts in sleep mode #604

Open
hannesa2 opened this issue Apr 11, 2024 · 2 comments · May be fixed by #631
Open

Long running tessts in sleep mode #604

hannesa2 opened this issue Apr 11, 2024 · 2 comments · May be fixed by #631

Comments

@hannesa2
Copy link
Owner

hannesa2 commented Apr 11, 2024

A test is missing for receive messages in sleep mode.
To archive this, the test needs to send device to sleep

manual task

Go to Settings
Go to Developer options
Un-check Stay awake (3rd option from the top)

The emulator will go to sleep after 1 min (default setting) if not changed.

Press the power button image to wake up the emulator.

command line

To put the device to sleep using command line, run: adb shell input keyevent 223

To wake the device from sleep using command line, run: adb shell input keyevent 224

For more info about key events you can send with ADB, check out the KEYCODE_... constants for KeyEvent,

@NinaTietje
Copy link

Hey Hannes, I tested 4.3.beta1 with the emulator like you described (with the extendedSample).
The AlarmPingSender with the WorkManager runs in the background until the ActivityManager stops the MqttService (in the middle of the log).

2024-04-16 18:05:01.072 10118-10141 (AlarmPingSender.kt:29) info.mqtt.android.extsample          D  .init(): Initialized sender.
2024-04-16 18:05:01.504 10118-10175 (AlarmPingSender.kt:34) info.mqtt.android.extsample          D  .start(): Start sender.
2024-04-16 18:05:01.507 10118-10175 (AlarmPingSender.kt:44) info.mqtt.android.extsample          D  .schedule(): Schedule next alarm at 2024-04-16 18:08:21Z.
 [...]
2024-04-16 18:07:42.686   575-2170  WindowManager           system_process                       I  sleepRelease() calling goToSleep(GO_TO_SLEEP_REASON_SLEEP_BUTTON)
2024-04-16 18:07:42.686   575-2170  PowerManagerService     system_process                       I  Powering off display group due to sleep_button (groupId= 0, uid= 1000)...
2024-04-16 18:07:42.686   575-2170  PowerManagerService     system_process                       I  Going to sleep due to sleep_button (uid 1000)...
2024-04-16 18:07:42.690   575-651   PowerManagerService     system_process                       I  Sleeping display group (groupId=0, uid=1000)...
2024-04-16 18:07:42.693   575-651   PowerManagerService     system_process                       I  Sleeping (uid 1000)...
 […]
2024-04-16 18:08:21.606 10118-10143 (PingWorker.kt:18)      info.mqtt.android.extsample          D  .doWork(): Sending Ping at: 2024-04-16 18:08:21Z
2024-04-16 18:08:21.607 10118-10143 (AlarmPingSender.kt:44) info.mqtt.android.extsample          D  .schedule(): Schedule next alarm at 2024-04-16 18:10:17Z.
2024-04-16 18:08:22.669   575-623   CompanionD...gerService system_process                       D  onPackageModified(packageName = info.mqtt.android.extsample)
2024-04-16 18:08:22.677   942-942   MediaPlayerList         com.android.bluetooth                D  Name of package changed: info.mqtt.android.extsample
2024-04-16 18:08:22.727  1171-1171  ImsResolver             com.android.phone                    D  maybeAddedImsService, packageName: info.mqtt.android.extsample
2024-04-16 18:08:22.738  7521-10279 Fitness                 com.google.android.gms               I  OnPackageChangedOperation got intent: Intent { act=android.intent.action.PACKAGE_CHANGED dat=package:info.mqtt.android.extsample flg=0x45000010 pkg=com.google.android.gms cmp=com.google.android.gms/.chimera.PersistentIntentOperationService (has extras) } [CONTEXT service_id=17 ]
2024-04-16 18:08:43.227   575-636   ActivityManager         system_process                       W  Stopping service due to app idle: u0a147 -3m42s435ms info.mqtt.android.extsample/info.mqtt.android.service.MqttService
2024-04-16 18:08:51.325 10118-10179 (MqttAndro...nt.kt:881) info.mqtt.android.extsample          V  .onReceive(): Bundle[{destinationName=pahoTest4, messageId=75e91416-fe4c-47b9-b964-1e3ccb8840cb, .PARCEL=m20, .callbackAction=messageArrived, .clientHandle=tcp://broker.hivemq.com:1883:ExtendedSampleClient:info.mqtt.android.extsample, .callbackStatus=OK}]
2024-04-16 18:08:51.327 10118-10179 (MqttCallb...ler.kt:38) info.mqtt.android.extsample          I  .messageArrived(): [B@a337f6a pahoTest4 qos=2 retained:false
04-16 18:08:51.364   948-948   Interrupti...teProvider com.android.systemui                 D  No bubble up: not allowed to bubble: 0|info.mqtt.android.extsample|125|null|10147
2024-04-16 18:08:51.366   948-948   Interrupti...teProvider com.android.systemui                 D  No heads up: unimportant notification: 0|info.mqtt.android.extsample|125|null|10147
2024-04-16 18:08:51.367   948-1025  PeopleSpaceWidgetMgr    com.android.systemui                 D  Sbn doesn't contain valid PeopleTileKey: null/0/info.mqtt.android.extsample
2024-04-16 18:08:51.377   948-948   Interrupti...teProvider com.android.systemui                 D  No bubble up: not allowed to bubble: 0|info.mqtt.android.extsample|125|null|10147
2024-04-16 18:08:51.377   948-948   Interrupti...teProvider com.android.systemui                 D  No bubble up: not allowed to bubble: 0|info.mqtt.android.extsample|124|null|10147
2024-04-16 18:08:51.378   948-948   Interrupti...teProvider com.android.systemui                 D  No bubble up: not allowed to bubble: 0|info.mqtt.android.extsample|123|null|10147
2024-04-16 18:08:51.378   948-948   Interrupti...teProvider com.android.systemui                 D  No bubble up: not allowed to bubble: 0|info.mqtt.android.extsample|122|null|10147
2024-04-16 18:08:51.378   948-948   Interrupti...teProvider com.android.systemui                 D  No bubble up: not allowed to bubble: 0|info.mqtt.android.extsample|121|null|10147
2024-04-16 18:08:51.379   948-948   Interrupti...teProvider com.android.systemui                 D  No bubble up: not allowed to bubble: 0|info.mqtt.android.extsample|120|null|10147
2024-04-16 18:09:43.376 10118-10175 (AlarmPingSender.kt:39) info.mqtt.android.extsample          D  .stop(): Stop sender.
2024-04-16 18:09:43.402 10118-10233 (MqttAndro...nt.kt:881) info.mqtt.android.extsample          V  .onReceive(): Bundle[{.exceptionStack=Connection lost (32109) - java.net.SocketException: Software caused connection abort
                                                                                                    	at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:197)
                                                                                                    	at java.lang.Thread.run(Thread.java:920)
                                                                                                    Caused by: java.net.SocketException: Software caused connection abort
                                                                                                    	at java.net.SocketInputStream.socketRead0(Native Method)
                                                                                                    	at java.net.SocketInputStream.socketRead(SocketInputStream.java:119)
                                                                                                    	at java.net.SocketInputStream.read(SocketInputStream.java:176)
                                                                                                    	at java.net.SocketInputStream.read(SocketInputStream.java:144)
                                                                                                    	at java.net.SocketInputStream.read(SocketInputStream.java:229)
                                                                                                    	at java.io.DataInputStream.readByte(DataInputStream.java:268)
                                                                                                    	at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:92)
                                                                                                    	at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:137)
                                                                                                    	at java.lang.Thread.run(Thread.java:920) 
                                                                                                    , .errorMessage=Connection lost, .exception=Connection lost (32109) - java.net.SocketException: Software caused connection abort, .callbackAction=onConnectionLost, .clientHandle=tcp://broker.hivemq.com:1883:ExtendedSampleClient:info.mqtt.android.extsample, .callbackStatus=OK}]
2024-04-16 18:09:43.403 10118-10233 (MqttCallb...ler.kt:18) info.mqtt.android.extsample          W  .connectionLost(): Connection Lost: Connection lost

@hannesa2
Copy link
Owner Author

hannesa2 commented Apr 27, 2024

@hannesa2 hannesa2 linked a pull request May 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants