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

Android service crashes when Kivy frontend app is stopped #2053

Open
goffi-contrib opened this issue Jan 21, 2020 · 9 comments
Open

Android service crashes when Kivy frontend app is stopped #2053

goffi-contrib opened this issue Jan 21, 2020 · 9 comments
Labels

Comments

@goffi-contrib
Copy link
Contributor

Versions

  • Python: v3.7.1
  • OS: Android 6.0
  • Kivy: v2.0.0rc1
  • Kivy installation method: via p4a requirements

Description

When a backend service is used on Android, exiting Kivy frontend app will kill it (it receives a SIGKILL by Android) while it should continue to run in the background.
The on_stop method is never called, the backend is killed before.

Code and Logs

To make testing easier, I've made a tarball containing a minimal frontend app and backend service, with the appropriate .p4a file (you need to adapt the --sdk-dir and --ndk-dir to your own installation before building the apk). The archive is available here: kivy_backend_bug.tar.gz

I've also uploaded the built .apk so it can be tested directly, I had to rename it to .zip otherwise github would not upload the file, so you need to rename it back to .apk once downloaded: test_kivy_bug_service_build__armeabi-v7a-debug-0.1-.zip

steps to reproduce

  1. install the APK on an Android device
  2. on a computer plugged to the device, get logs with adb logcat
  3. start the Test Kivy Bug Service application, observe that the backend is running (it prints every second a Backend is still running message)
  4. if you press the button, the app button, App.stop() is called, you can reopen the app by clicking on its screenshot while listing applications (the frontend is restarted but the backend continue as expected)
  5. list Android application, and slide out the Test Kivy Bug Service (which kills the frontend)

expected result: The frontend is killed, but the backend continues in the background
actual result: after a crash backtrace, the backend receives a SIGKILL.

logs

Here are the Android logs when the frontend app is killed by user, please note that:

  • there is crash just after SDL : onDestroy() is sent
  • frontend on_stop is never called (it should print ==> stopping)
  • a SIGKILL signal (number 9) is sent to the backend after the WindowManager: java.lang.IllegalArgumentException exception

Logs:

01-21 19:43:35.236 30768 30782 I backend : Backend is still running (5)
01-21 19:43:36.275 30768 30782 I backend : Backend is still running (6)
01-21 19:43:37.316 30768 30782 I backend : Backend is still running (7)
01-21 19:43:38.142   459   633 E ThermalEngine: ==== Enter sched_bmhb_cs_gov -> vs_temp = 31 ===
01-21 19:43:38.340 30768 30782 I backend : Backend is still running (8)
01-21 19:43:39.009  1352  2900 D InputDispatcher: notifyMotion - action=ACTION_DOWN(0), id=0, tooltype=1, deviceId=4, source=0x1002, policyFlags=0x0, flags=0x0, metaState=0x0, buttonState=0x0, edgeFlags=0x0, eventTime=23173853933000, downTime=23173853933000, 
01-21 19:43:39.010  1352  2899 D InputTransport: channel 'c5d0a3e NavigationBar (server)' : action=ACTION_DOWN(0), id=0, tooltype=1, deviceId=4, source=0x1002, flags=0x0, edgeFlags=0x0, metaState=0x0, buttonState=0x0, downTime=23173853933000, eventTime=23173853933000, pointerCount=1
01-21 19:43:39.011 15131 15131 I ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
01-21 19:43:39.012  1352  3537 D PowerManagerServiceAO: updateWakeLockSummaryLocked: checkScreenWakelockList : mBaseService.mWakefulness=Awake, mBaseService.mWakeLockSummary=0x0
01-21 19:43:39.013  1352  3537 D PowerManagerServiceAO: updateUserActivitySummaryLocked: mBaseService.mWakefulness=Awake, mUserActivitySummary=0x1, nextTimeout=23464868 (in 291011 ms)
01-21 19:43:39.029 15131 15131 I [SystemUI]LGKeyButtonView: Navigation Key(187) sendEvent, action : 0, flags : 0, when : 23173859
01-21 19:43:39.030  1352  3474 D PhoneWindowManagerEx: interceptKeyTq keycode=187 down=true interactive=true policyFlags=2b000002 injected=true keyguardActive=false sDisplayState=2
01-21 19:43:39.030  1352  3474 V LGSettingsProvider: getSecureSetting(user_setup_complete, -2)
01-21 19:43:39.032  1352  3474 D WindowManager: interceptKeyTq keycode=187 interactive=true keyguardActive=false policyFlags=2b000002
01-21 19:43:39.034  1352  3474 V LGSettingsProvider: getSystemSetting(haptic_feedback_enabled, -2)
01-21 19:43:39.035  1352  2899 D PowerManagerServiceAO: updateWakeLockSummaryLocked: checkScreenWakelockList : mBaseService.mWakefulness=Awake, mBaseService.mWakeLockSummary=0x0
01-21 19:43:39.035  1352  2899 D PowerManagerServiceAO: updateUserActivitySummaryLocked: mBaseService.mWakefulness=Awake, mUserActivitySummary=0x1, nextTimeout=23464868 (in 290989 ms)
01-21 19:43:39.035  1352  2899 D PhoneWindowManagerEx: interceptKeyTi keyCode=187 down=true repeatCount=0 keyguardOn=false mHomePressed=false canceled=false
01-21 19:43:39.037  3536  8871 D Telephony: PhoneInterfaceManager: isOtaSpActive: isNorthAmericanCDMA = false
01-21 19:43:39.037  1352  2899 D WindowManager: interceptKeyTi keyCode=187 down=true repeatCount=0 keyguardOn=false mHomePressed=false canceled=false
01-21 19:43:39.069  1352  3412 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.088  1352  2900 D InputDispatcher: notifyMotion - action=ACTION_UP(0), id=0, tooltype=1, deviceId=4, source=0x1002, policyFlags=0x0, flags=0x0, metaState=0x0, buttonState=0x0, edgeFlags=0x0, eventTime=23173933163000, downTime=23173853933000, 
01-21 19:43:39.089  1352  2899 D InputTransport: channel 'c5d0a3e NavigationBar (server)' : action=ACTION_UP(0), id=0, tooltype=1, deviceId=4, source=0x1002, flags=0x0, edgeFlags=0x0, metaState=0x0, buttonState=0x0, downTime=23173853933000, eventTime=23173933163000, pointerCount=1
01-21 19:43:39.089 15131 15131 I ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
01-21 19:43:39.091  1352  1598 D PowerManagerServiceAO: updateWakeLockSummaryLocked: checkScreenWakelockList : mBaseService.mWakefulness=Awake, mBaseService.mWakeLockSummary=0x0
01-21 19:43:39.091  1352  1598 D PowerManagerServiceAO: updateUserActivitySummaryLocked: mBaseService.mWakefulness=Awake, mUserActivitySummary=0x1, nextTimeout=23464868 (in 290932 ms)
01-21 19:43:39.092 15131 15131 I [SystemUI]LGKeyButtonView: Navigation Key(187) sendEvent, action : 1, flags : 0, when : 23173937
01-21 19:43:39.093  1352  3461 D PhoneWindowManagerEx: interceptKeyTq keycode=187 down=false interactive=true policyFlags=2b000002 injected=true keyguardActive=false sDisplayState=2
01-21 19:43:39.095  1352  3461 D WindowManager: interceptKeyTq keycode=187 interactive=true keyguardActive=false policyFlags=2b000002
01-21 19:43:39.096  1352  2899 D PhoneWindowManagerEx: interceptKeyTi keyCode=187 down=false repeatCount=0 keyguardOn=false mHomePressed=false canceled=false
01-21 19:43:39.096  3536  6818 D Telephony: PhoneInterfaceManager: isOtaSpActive: isNorthAmericanCDMA = false
01-21 19:43:39.097  1352  2899 D WindowManager: interceptKeyTi keyCode=187 down=false repeatCount=0 keyguardOn=false mHomePressed=false canceled=false
01-21 19:43:39.103  1352  3410 I ActivityManager: START u0 {act=com.android.systemui.recents.SHOW_RECENTS flg=0x10804000 cmp=com.android.systemui/.recents.RecentsActivity} from uid 10023 on display 0
01-21 19:43:39.108  1352  3410 D ActivityManager: setTaskToReturnTo : TaskRecord{89f894e kivy/kivy#1689 A=com.lge.launcher2 U=0 sz=1} / mTaskToReturnTo = 1
01-21 19:43:39.109  1352  3410 V WindowManager: Set focused app to: AppWindowToken{b68dc30 token=Token{da69573 ActivityRecord{47c2de2 u0 com.android.systemui/.recents.RecentsActivity t1694}}} old focus=AppWindowToken{74ac805 token=Token{4003d4e ActivityRecord{a347049 u0 org.goffi.testkivybugservice/org.kivy.android.PythonActivity t1752}}} moveFocusNow=true
01-21 19:43:39.109  1352  3410 V WindowManager: Looking for focus: 11 = Window{ed601a8 u0 StatusBar}, flags=-2122055608, canReceive=false
01-21 19:43:39.109  1352  3410 V WindowManager: findFocusedWindow: Reached focused app=AppWindowToken{b68dc30 token=Token{da69573 ActivityRecord{47c2de2 u0 com.android.systemui/.recents.RecentsActivity t1694}}}
01-21 19:43:39.110  1352  3410 V WindowManager: Changing focus from Window{fc120b2 u0 org.goffi.testkivybugservice/org.kivy.android.PythonActivity} to null Callers=com.android.server.wm.WindowManagerService.setFocusedApp:4274 com.android.server.am.ActivityManagerService.setFocusedActivityLocked:2742 com.android.server.am.ActivityStack.moveTaskToFrontLocked:3909 com.android.server.am.ActivityStackSupervisor.startActivityUncheckedLocked:2217 
01-21 19:43:39.110  1352  3410 D WindowManager: Input focus has changed to null
01-21 19:43:39.111  1352  3410 D InputDispatcher: Focus left window: Window{fc120b2 u0 org.goffi.testkivybugservice/org.kivy.android.PythonActivity}
01-21 19:43:39.112  1352  1927 I WindowManager: Focus moving from Window{fc120b2 u0 org.goffi.testkivybugservice/org.kivy.android.PythonActivity} to null
01-21 19:43:39.112  1352  1927 I WindowManager: Losing focus: Window{fc120b2 u0 org.goffi.testkivybugservice/org.kivy.android.PythonActivity}
01-21 19:43:39.112 30745 30745 V SDL     : onWindowFocusChanged(): false
01-21 19:43:39.113 30745 30745 V SDL     : nativePause()
01-21 19:43:39.113 30745 30745 I python  : ==> pausing
01-21 19:43:39.114 30745 30745 I SensorManager: unregisterListenerImpl() [Sensor: LGE Accelerometer, SensorEventListener: org.libsdl.app.SDLSurface{b4bbd73 VFE...... .F...... 0,0-1440,2296}] by org.libsdl.app.SDLSurface.enableSensor():1872
01-21 19:43:39.114  1352  3194 D sensors_hal_SMGR: enable:sensor(android.sensor.accelerometer) Deactivating sensor handle=0
01-21 19:43:39.114  1352  3194 D sensors_hal_Util: waitForResponse: timeout=1000
01-21 19:43:39.118  1352  3194 D sensors_hal_SMGR: SMGRReportDelete: Rcvd success response from request
01-21 19:43:39.118 30745 30745 W SplitWindow: update focus... 
01-21 19:43:39.133 30745 30745 V PythonActivity: onPause()
01-21 19:43:39.133 30745 30745 V SDL     : onPause()
01-21 19:43:39.133  3384  8501 D SplitWindowPolicy: updateActivityStateChanged: resumed=false, screenId=5, isScreenFull=false
01-21 19:43:39.134  3384  8501 D SplitWindowPolicy: topRunningActivity=ActivityInfo{80556b7 or.....PythonActivity}, taskId=1752, activityType=0, bIsSplit=false
01-21 19:43:39.138  1352  3410 D ActivityManager: setTaskToReturnTo : TaskRecord{3e636ad kivy/kivy#1694 A=com.android.systemui U=0 sz=1} / mTaskToReturnTo = 1
01-21 19:43:39.142 15131 15131 D KeyguardSecurityModel: 0 Phone is READY
01-21 19:43:39.143 15131 15131 D KeyguardUpdateMonitor: ###### current user : 0
01-21 19:43:39.143 15131 15131 D KeyguardUpdateMonitor: ###### current user : 0
01-21 19:43:39.144 15131 15131 D KeyguardUpdateMonitor: ###### current user : 0
01-21 19:43:39.144  3384  3397 D SplitWindowPolicy: updateActivityStateChanged: resumed=true, screenId=0, isScreenFull=false
01-21 19:43:39.144  3384  3397 D SplitWindowPolicy: topRunningActivity=ActivityInfo{33bde24 co.....recents.RecentsActivity}, taskId=1694, activityType=2, bIsSplit=false
01-21 19:43:39.145 15131 15131 I [SystemUI]QuickSettingsHandler: Got action android.intent.action.CLOSE_SYSTEM_DIALOGS at 
01-21 19:43:39.145 15131 15131 I [SystemUI]DataHandler: onReceive = android.intent.action.CLOSE_SYSTEM_DIALOGS
01-21 19:43:39.145 15131 15131 I [SystemUI]QuickSettingsHandler: Got action android.intent.action.CLOSE_SYSTEM_DIALOGS at 
01-21 19:43:39.145 15131 15131 I [SystemUI]QuickSettingsHandler: Got action android.intent.action.CLOSE_SYSTEM_DIALOGS at 
01-21 19:43:39.146 15131 15131 I [SystemUI]QuickSettingsHandler: Got action android.intent.action.CLOSE_SYSTEM_DIALOGS at 
01-21 19:43:39.146 15131 15131 I [SystemUI]QuickSettingsHandler: Got action android.intent.action.CLOSE_SYSTEM_DIALOGS at 
01-21 19:43:39.156  1352  3441 V WindowManager: Looking for focus: 11 = Window{ed601a8 u0 StatusBar}, flags=-2122055608, canReceive=false
01-21 19:43:39.156  1352  3441 V WindowManager: findFocusedWindow: No focusable windows.
01-21 19:43:39.157 30745 30745 V SDL     : surfaceDestroyed()
01-21 19:43:39.160  1352  3508 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.161  1352  3474 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.162  1352  3507 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.163  1352  3412 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.163  1352  3239 V WindowManager: Looking for focus: 11 = Window{ed601a8 u0 StatusBar}, flags=-2122055608, canReceive=false
01-21 19:43:39.163  1352  3239 V WindowManager: findFocusedWindow: No focusable windows.
01-21 19:43:39.163  1352  3517 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.164  1352  3459 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.164  1352  1598 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.168  7616  7627 I EodDetector[v21]: org.goffi.testkivybugservice is not target app
01-21 19:43:39.171  1352  3461 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.171 15131 15131 D View    : [View][setSystemUiVisibilityLG] visibility=0x 60000
01-21 19:43:39.172  1352  3537 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.173   459   635 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1689600
01-21 19:43:39.176 29583 29583 D OtherNotiReceiver: [LGE]com.lge.intent.action.FLOATING_WINDOW_ENTER_LOWPROFILE
01-21 19:43:39.179  1352  3410 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.180  1352  3537 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.181 29583 29583 D OtherNotiReceiver: [LGE]com.lge.intent.action.FLOATING_WINDOW_EXIT_LOWPROFILE
01-21 19:43:39.181  1352  3508 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.183  1352  3507 V WindowManager: Looking for focus: 11 = Window{ed601a8 u0 StatusBar}, flags=-2122055608, canReceive=false
01-21 19:43:39.183  1352  3507 V WindowManager: findFocusedWindow: Found new focus @ 1 = Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:39.183  1352  3507 V WindowManager: Changing focus from null to Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity} Callers=com.android.server.wm.WindowManagerService.relayoutWindow:3450 com.android.server.wm.WindowManagerServiceEx.relayoutWindow:722 com.android.server.wm.Session.relayout:199 android.view.IWindowSession$Stub.onTransact:284 
01-21 19:43:39.183  1352  3507 D WindowManager: Input focus has changed to Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:39.183  1352  1785 I SystemUI[Framework]: PhoneWindowManager.updateSystemUiVisibilityLw() :visibility=0x700, pkg=com.android.systemui
01-21 19:43:39.184  1352  1785 W WindowManager: Call!!!getLGSystemUiVisibility. =0x60000
01-21 19:43:39.184  1352  1785 D StatusBarManagerServiceEx: setLGSystemUiVisibility(0x60000)
01-21 19:43:39.184  1352  1785 D StatusBarManagerServiceEx: manageNaviBtnDisableList userId=0 what=0x60000 pkg=Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:39.184  1352  1785 I SystemUI[Framework]: ==>disabledNaviBtn() what=0x60000, token=android.os.Binder@56ac1c9,  pkg=Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:39.184  1352  1785 I SystemUI[Framework]: disableNaviBtn: mDisabledNaviBtn=0x60000,  mDisableRecords.size=1
01-21 19:43:39.184  1352  1785 I SystemUI[Framework]:   [0] userId=0, what=0x60000, pkg=Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}, token=android.os.Binder@56ac1c9
01-21 19:43:39.184  1352  3507 D InputDispatcher: Focus entered window: Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:39.184 29583 29583 D OtherNotiReceiver: [LGE]com.lge.intent.action.FLOATING_WINDOW_ENTER_LOWPROFILE
01-21 19:43:39.185  1352  1927 I WindowManager: Focus moving from null to Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:39.185  1352  1927 I WindowManager: Gaining focus: Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:39.190   459   635 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1824000
01-21 19:43:39.190   459   635 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1689600
01-21 19:43:39.203 15131 15131 I [SystemUI]QSlideListController: setLowProfile : true from com.android.systemui
01-21 19:43:39.203 15131 15131 I [SystemUI]QSlideListController: setLowProfile : false from com.android.systemui
01-21 19:43:39.203 15131 15131 I [SystemUI]QSlideListController: setLowProfile : true from com.android.systemui
01-21 19:43:39.205 15131 15131 D PhoneStatusBar: setSystemUiVisibility vis=700 mask=ffffffff oldVal=4100 newVal=700 diff=4600
01-21 19:43:39.205 15131 15131 D PhoneStatusBar: disableNaviBtn: < menu sim_switch notification qmemo QSLIDE* DUAL_WINDOW* >
01-21 19:43:39.206  1352  3445 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.206  1352  3474 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:39.207 15131 15131 W SplitWindow: update focus... 
01-21 19:43:39.221   459   635 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1632000
01-21 19:43:39.233  1352  1927 V WindowManager: Looking for focus: 11 = Window{ed601a8 u0 StatusBar}, flags=-2122055608, canReceive=false
01-21 19:43:39.233  1352  1927 V WindowManager: findFocusedWindow: Found new focus @ 5 = Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:39.233  1352  1927 D WindowManager: notifyActivityDrawnForKeyguard: waiting=false Callers=com.android.server.wm.WindowManagerService.handleAppTransitionReadyLocked:9873 com.android.server.wm.WindowManagerService.performLayoutAndPlaceSurfacesLockedInner:10485 com.android.server.wm.WindowManagerService.performLayoutAndPlaceSurfacesLockedLoop:9261 com.android.server.wm.WindowManagerService.performLayoutAndPlaceSurfacesLocked:9208 com.android.server.wm.WindowManagerService.access$400:203 
01-21 19:43:39.234  1352  1785 I SystemUI[Framework]: PhoneWindowManager.updateSystemUiVisibilityLw() :visibility=0x8700, pkg=com.android.systemui
01-21 19:43:39.245  1352  1785 W WindowManager: Call!!!getLGSystemUiVisibility. =0x60000
01-21 19:43:39.245  1352  1785 D StatusBarManagerServiceEx: setLGSystemUiVisibility(0x60000)
01-21 19:43:39.245  1352  1785 D StatusBarManagerServiceEx: manageNaviBtnDisableList userId=0 what=0x60000 pkg=Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:39.245  1352  1785 I SystemUI[Framework]: ==>disabledNaviBtn() what=0x60000, token=android.os.Binder@56ac1c9,  pkg=Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:39.245  1352  1785 I SystemUI[Framework]: disableNaviBtn: mDisabledNaviBtn=0x60000,  mDisableRecords.size=1
01-21 19:43:39.245  1352  1785 I SystemUI[Framework]:   [0] userId=0, what=0x60000, pkg=Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}, token=android.os.Binder@56ac1c9
01-21 19:43:39.246 15131 15131 D PhoneStatusBar: setSystemUiVisibility vis=8700 mask=ffffffff oldVal=4700 newVal=8700 diff=c000
01-21 19:43:39.247 15131 15131 I [SystemUI]NavigationThemeResource: NavigationKey Color is changed(WHITE -> WHITE_WITH_SHADOW)
01-21 19:43:39.247 15131 15131 I [SystemUI]NavigationThemeResource:  BarMode=4, Theme=BLACK, LightBackground=false (Transparent)
01-21 19:43:39.247 15131 15131 I [SystemUI]NavigationThemeResource: , Keyguard show=false, IME shown=false, Panel expanded=false
01-21 19:43:39.247 15131 15131 D BarTransitions: draw background and invalidate : color = fd000000
01-21 19:43:39.248 15131 15131 D BarTransitions: draw background and invalidate : color = fc000000
01-21 19:43:39.248  1352  1927 I ActivityManager: Displayed com.android.systemui/.recents.RecentsActivity: +113ms
01-21 19:43:39.248  1352  3507 V WindowManager: Looking for focus: 11 = Window{ed601a8 u0 StatusBar}, flags=-2122055608, canReceive=false
01-21 19:43:39.248  1352  3507 V WindowManager: findFocusedWindow: Found new focus @ 5 = Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:39.251   459   635 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1536000
01-21 19:43:39.260  1352  1375 I art     : Background partial concurrent mark sweep GC freed 116593(5MB) AllocSpace objects, 31(668KB) LOS objects, 33% free, 49MB/74MB, paused 9.888ms total 130.158ms
01-21 19:43:39.273  1352  1927 V WindowManager: Looking for focus: 11 = Window{ed601a8 u0 StatusBar}, flags=-2122055608, canReceive=false
01-21 19:43:39.274  1352  1927 V WindowManager: findFocusedWindow: Found new focus @ 5 = Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:39.282   459   635 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1632000
01-21 19:43:39.294   459   635 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1824000
01-21 19:43:39.380 30768 30782 I backend : Backend is still running (9)
01-21 19:43:39.454 15131 15131 I Timeline: Timeline: Activity_idle id: android.os.BinderProxy@5fb60c3 time:23174299
01-21 19:43:39.455  1352  3461 D PowerManagerServiceAO: updateWakeLockSummaryLocked: checkScreenWakelockList : mBaseService.mWakefulness=Awake, mBaseService.mWakeLockSummary=0x0
01-21 19:43:40.267  1352  2900 D InputDispatcher: notifyMotion - action=ACTION_DOWN(0), id=0, tooltype=1, deviceId=4, source=0x1002, policyFlags=0x0, flags=0x0, metaState=0x0, buttonState=0x0, edgeFlags=0x0, eventTime=23175111440000, downTime=23175111440000, 
01-21 19:43:40.267  1352  2899 D InputTransport: channel '6d6cbd3 com.android.systemui/com.android.systemui.recents.RecentsActivity (server)' : action=ACTION_DOWN(0), id=0, tooltype=1, deviceId=4, source=0x1002, flags=0x0, edgeFlags=0x0, metaState=0x0, buttonState=0x0, downTime=23175111440000, eventTime=23175111440000, pointerCount=1
01-21 19:43:40.267  1352  2899 D InputTransport: channel '4e0e5b8 com.android.systemui.ImageWallpaper (server)' : action=ACTION_DOWN(0), id=0, tooltype=1, deviceId=4, source=0x1002, flags=0x3, edgeFlags=0x0, metaState=0x0, buttonState=0x0, downTime=23175111440000, eventTime=23175111440000, pointerCount=1
01-21 19:43:40.267  1352  2899 D PowerManagerServiceAO: updateWakeLockSummaryLocked: checkScreenWakelockList : mBaseService.mWakefulness=Awake, mBaseService.mWakeLockSummary=0x0
01-21 19:43:40.268  1352  2899 D PowerManagerServiceAO: updateUserActivitySummaryLocked: mBaseService.mWakefulness=Awake, mUserActivitySummary=0x1, nextTimeout=23464868 (in 289756 ms)
01-21 19:43:40.268 15131 15131 I ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
01-21 19:43:40.415 30768 30782 I backend : Backend is still running (10)
01-21 19:43:40.490   459   635 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1689600
01-21 19:43:40.504   459   635 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1824000
01-21 19:43:40.536  1352  2900 D InputDispatcher: notifyMotion - action=ACTION_UP(0), id=0, tooltype=1, deviceId=4, source=0x1002, policyFlags=0x0, flags=0x0, metaState=0x0, buttonState=0x0, edgeFlags=0x0, eventTime=23175381349000, downTime=23175111440000, 
01-21 19:43:40.537  1352  2899 D InputTransport: channel '6d6cbd3 com.android.systemui/com.android.systemui.recents.RecentsActivity (server)' : action=ACTION_UP(0), id=0, tooltype=1, deviceId=4, source=0x1002, flags=0x0, edgeFlags=0x0, metaState=0x0, buttonState=0x0, downTime=23175111440000, eventTime=23175381349000, pointerCount=1
01-21 19:43:40.537  1352  2899 D InputTransport: channel '4e0e5b8 com.android.systemui.ImageWallpaper (server)' : action=ACTION_UP(0), id=0, tooltype=1, deviceId=4, source=0x1002, flags=0x3, edgeFlags=0x0, metaState=0x0, buttonState=0x0, downTime=23175111440000, eventTime=23175381349000, pointerCount=1
01-21 19:43:40.537 15131 15131 I ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
01-21 19:43:41.455 30768 30782 I backend : Backend is still running (11)
01-21 19:43:41.716  1352  2900 D InputDispatcher: notifyMotion - action=ACTION_DOWN(0), id=0, tooltype=1, deviceId=4, source=0x1002, policyFlags=0x0, flags=0x0, metaState=0x0, buttonState=0x0, edgeFlags=0x0, eventTime=23176559910000, downTime=23176559910000, 
01-21 19:43:41.717  1352  2899 D InputTransport: channel '6d6cbd3 com.android.systemui/com.android.systemui.recents.RecentsActivity (server)' : action=ACTION_DOWN(0), id=0, tooltype=1, deviceId=4, source=0x1002, flags=0x0, edgeFlags=0x0, metaState=0x0, buttonState=0x0, downTime=23176559910000, eventTime=23176559910000, pointerCount=1
01-21 19:43:41.717  1352  2899 D InputTransport: channel '4e0e5b8 com.android.systemui.ImageWallpaper (server)' : action=ACTION_DOWN(0), id=0, tooltype=1, deviceId=4, source=0x1002, flags=0x3, edgeFlags=0x0, metaState=0x0, buttonState=0x0, downTime=23176559910000, eventTime=23176559910000, pointerCount=1
01-21 19:43:41.719  1352  2899 D PowerManagerServiceAO: updateWakeLockSummaryLocked: checkScreenWakelockList : mBaseService.mWakefulness=Awake, mBaseService.mWakeLockSummary=0x0
01-21 19:43:41.718 15131 15131 I ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN
01-21 19:43:41.719  1352  2899 D PowerManagerServiceAO: updateUserActivitySummaryLocked: mBaseService.mWakefulness=Awake, mUserActivitySummary=0x1, nextTimeout=23464868 (in 288304 ms)
01-21 19:43:41.819  1352  2900 D InputDispatcher: notifyMotion - action=ACTION_UP(0), id=0, tooltype=1, deviceId=4, source=0x1002, policyFlags=0x0, flags=0x0, metaState=0x0, buttonState=0x0, edgeFlags=0x0, eventTime=23176664248000, downTime=23176559910000, 
01-21 19:43:41.820  1352  2899 D InputTransport: channel '6d6cbd3 com.android.systemui/com.android.systemui.recents.RecentsActivity (server)' : action=ACTION_UP(0), id=0, tooltype=1, deviceId=4, source=0x1002, flags=0x0, edgeFlags=0x0, metaState=0x0, buttonState=0x0, downTime=23176559910000, eventTime=23176664248000, pointerCount=1
01-21 19:43:41.820  1352  2899 D InputTransport: channel '4e0e5b8 com.android.systemui.ImageWallpaper (server)' : action=ACTION_UP(0), id=0, tooltype=1, deviceId=4, source=0x1002, flags=0x3, edgeFlags=0x0, metaState=0x0, buttonState=0x0, downTime=23176559910000, eventTime=23176664248000, pointerCount=1
01-21 19:43:41.821 15131 15131 I ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
01-21 19:43:42.217  1352  1599 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:42.218  1352  3194 V LGSettingsProvider: getSystemSetting(dual_window, -2)
01-21 19:43:42.224  1352  3441 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.lge.launcher2/.Launcher} from uid 10023 on display 0
01-21 19:43:42.230  1352  3441 D ActivityManager: setTaskToReturnTo : TaskRecord{3e636ad kivy/kivy#1694 A=com.android.systemui U=0 sz=1} / mTaskToReturnTo = 1
01-21 19:43:42.230  1352  3441 V WindowManager: Set focused app to: AppWindowToken{534ee6c token=Token{542db1f ActivityRecord{a648ebe u0 com.lge.launcher2/.Launcher t1689}}} old focus=AppWindowToken{b68dc30 token=Token{da69573 ActivityRecord{47c2de2 u0 com.android.systemui/.recents.RecentsActivity t1694}}} moveFocusNow=true
01-21 19:43:42.233  1352  3441 V WindowManager: Looking for focus: 11 = Window{ed601a8 u0 StatusBar}, flags=-2122055608, canReceive=false
01-21 19:43:42.233  1352  3441 V WindowManager: findFocusedWindow: Reached focused app=AppWindowToken{534ee6c token=Token{542db1f ActivityRecord{a648ebe u0 com.lge.launcher2/.Launcher t1689}}}
01-21 19:43:42.234  1352  3441 V WindowManager: Changing focus from Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity} to null Callers=com.android.server.wm.WindowManagerService.setFocusedApp:4274 com.android.server.am.ActivityManagerService.setFocusedActivityLocked:2742 com.android.server.am.ActivityStack.moveTaskToFrontLocked:3909 com.android.server.am.ActivityStackSupervisor.startActivityUncheckedLocked:2217 
01-21 19:43:42.234  1352  3441 D WindowManager: Input focus has changed to null
01-21 19:43:42.235  1352  3441 D InputDispatcher: Focus left window: Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:42.236  1352  1927 I WindowManager: Focus moving from Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity} to null
01-21 19:43:42.236  1352  1927 I WindowManager: Losing focus: Window{6d6cbd3 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
01-21 19:43:42.237  3384  8501 D SplitWindowPolicy: updateActivityStateChanged: resumed=false, screenId=0, isScreenFull=false
01-21 19:43:42.238  3384  8501 D SplitWindowPolicy: topRunningActivity=ActivityInfo{5d3db42 co.....recents.RecentsActivity}, taskId=1694, activityType=2, bIsSplit=false
01-21 19:43:42.246 30745 30745 V SDL     : onDestroy()
01-21 19:43:42.250  1352  3461 I ActivityManager: Killing 30745:org.goffi.testkivybugservice/u0a167 (adj 9): remove task
01-21 19:43:42.299  1352  1599 D GraphicsStats: Buffer count: 8
01-21 19:43:42.299  1352  3412 I WindowState: WIN DEATH: Window{fc120b2 u0 org.goffi.testkivybugservice/org.kivy.android.PythonActivity}
01-21 19:43:42.299  1352  3412 W WindowManager: Force-removing child win Window{60c67ac u0 SurfaceView} from container Window{fc120b2 u0 org.goffi.testkivybugservice/org.kivy.android.PythonActivity}
01-21 19:43:42.301  1352  3412 D InputDispatcher: Window went away: Window{fc120b2 u0 org.goffi.testkivybugservice/org.kivy.android.PythonActivity}
01-21 19:43:42.306  1352  3412 V WindowManager: Looking for focus: 9 = Window{ed601a8 u0 StatusBar}, flags=-2122055608, canReceive=false
01-21 19:43:42.307  1352  3412 V WindowManager: findFocusedWindow: Reached focused app=AppWindowToken{534ee6c token=Token{542db1f ActivityRecord{a648ebe u0 com.lge.launcher2/.Launcher t1689}}}
01-21 19:43:42.307  1352  1599 W WindowManager: Failed looking up window
01-21 19:43:42.307  1352  1599 W WindowManager: java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@5d3715f does not exist
01-21 19:43:42.307  1352  1599 W WindowManager:         at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9001)
01-21 19:43:42.307  1352  1599 W WindowManager:         at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8992)
01-21 19:43:42.307  1352  1599 W WindowManager:         at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1264)
01-21 19:43:42.307  1352  1599 W WindowManager:         at android.os.BinderProxy.sendDeathNotice(Binder.java:558)
01-21 19:43:42.307  1352  1599 I WindowState: WIN DEATH: null
01-21 19:43:42.310 30768 30768 I Process : Sending signal. PID: 30768 SIG: 9
01-21 19:43:42.314 15131 15131 W SplitWindow: update focus... 
01-21 19:43:42.319 29583 29583 D OtherNotiReceiver: [LGE]com.lge.intent.action.FLOATING_WINDOW_EXIT_LOWPROFILE
01-21 19:43:42.329  1352  3459 D SplitWindowManager: Need to update ActivityRecord{c8619f1 u0 com.android.incallui/.InCallActivity t1705} to ActivityStack{684284c stackId=5, 1 tasks}
01-21 19:43:42.332  1352  3461 V WindowManager: Looking for focus: 9 = Window{ed601a8 u0 StatusBar}, flags=-2122055608, canReceive=false
01-21 19:43:42.332  1352  3461 V WindowManager: findFocusedWindow: No focusable windows.
01-21 19:43:42.335  1352  3507 I ActivityManager: Process org.goffi.testkivybugservice:service_backend (pid 30768) has died

@goffi-contrib
Copy link
Contributor Author

note: after a look at the code, I actually think that this is an issue with SDL2 bootstrap with Python for Android. If it is actually the case, is it possible to move this issue to P4A issues?

@inclement inclement transferred this issue from kivy/kivy Jan 21, 2020
@Fak3
Copy link

Fak3 commented Feb 3, 2020

I believe that this relates to the discussion at #1784

@Fak3
Copy link

Fak3 commented Feb 3, 2020

See also this: #2021

@goffi-contrib
Copy link
Contributor Author

goffi-contrib commented Feb 4, 2020

@Fak3 I don't this this is related to those 2 tickets, the issue described here is a crash with a backtrace, while #1784 mention on explicit close, and #2021 talks about Android 10 (I'm testing on Android 6.0).

This issue smells more like a method called when it shouldn't, or with wrong arguments.

@quitegreensky
Copy link

@goffi-contrib This is how you can restart your service. in my case this solved my problem. add these codes within your service codes .

@goffi-contrib
Copy link
Contributor Author

hi @quitegreensky thanks for the tips, I'm actually already doing that. But this is not a good option, that means that my backend has to restart each time the frontend is closed. It's a chat app so that means reconnecting and re-downloading necessary bootstrap data, etc. It is time and resource consuming.

So this is a workaround, but not a good option for the long term, this bug needs to be fixed.

@quitegreensky
Copy link

@gbm001 Indeed. This needs to be fixed. Even with using setAutoRestartService(True) , the service will stop after a while anyway. I'm really interested to have a strong background connection too.

@sfcaracciolo
Copy link

sfcaracciolo commented Apr 2, 2020

Hi, I have same problem. There is any solution? at least something temporarily?

When I close the app, notifications are stopped. I need that notifications always remaining.

My service code is very simple:

from time import sleep
from datetime import datetime
import plyer
import os
argument = os.environ.get('PYTHON_SERVICE_ARGUMENT','')

from jnius import autoclass
service = autoclass('org.kivy.android.PythonService').mService
service.setAutoRestartService(True)

if __name__=='__main__':
    while True:
        sleep(2.)
        dt = datetime.now().strftime('%H:%M:%S')
        plyer.notification.notify('Hora actual', dt)

Any suggeration?
Thanks a lot

@loan-mgt
Copy link

Hi, I have same problem. There is any solution? at least something temporarily?

When I close the app, notifications are stopped. I need that notifications always remaining.

My service code is very simple:

from time import sleep
from datetime import datetime
import plyer
import os
argument = os.environ.get('PYTHON_SERVICE_ARGUMENT','')

from jnius import autoclass
service = autoclass('org.kivy.android.PythonService').mService
service.setAutoRestartService(True)

if __name__=='__main__':
    while True:
        sleep(2.)
        dt = datetime.now().strftime('%H:%M:%S')
        plyer.notification.notify('Hora actual', dt)

Any suggeration?
Thanks a lot

@sfcaracciolo Did you find a solution?

@Julian-O Julian-O added the bug label Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants