You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using PySDL2 + python-for-android without kivy. In my test app, the first orientation change seems to cause an SDL_QUIT and an SDL_APP_TERMINATING event, and I don't know why - it looks like a bug to me.
This is the test code (feel free to build & test for yourself, needs --requirements=sdl2,pysdl2,python3crystax, --orientation user of course, and possibly --window to reproduce):
#!/usr/bin/env python3defapply_hack():
importctypes.utilorig_func=ctypes.util.find_librarydefandroid_find_library_hack(*args):
importosname=args[0]
# Truncate ending for easier comparison:ifname.find(".so.") >=0:
name=name.partition(".so.")[0]
ifname.endswith(".so"):
name=name[:-len(".so")]
ifnotname.endswith("."):
name+="."# Helper function to check lib name:defcheck_name(lib_name, search_name):
iffilename.endswith('.so') and (
filename.startswith("lib"+search_name) orfilename.startswith(search_name)):
returnTrueifsearch_name.endswith("-2.0."): # PySDL2 hacksearch_name=search_name[:-len("-2.0.")] +"."returncheck_name(lib_name, search_name)
returnFalse# Check the user app lib dir and system dir:app_root=os.path.normpath(os.path.abspath(os.path.join(
os.path.dirname(__file__), '..', '..', 'lib')))
sys_dir="/system/lib"forlib_searchin [app_root, sys_dir]:
ifnotos.path.exists(lib_search):
continueforfilenameinos.listdir(lib_search):
ifcheck_name(filename, name):
returnos.path.join(lib_search, filename)
returnorig_func(*args)
importctypes.utilctypes.util.find_library=android_find_library_hackapply_hack()
importctypesimportsdl2assdlimportsysimporttimeimporttracebackwindow=Nonerenderer=Nonedeftest_app():
globalwindow, rendererprint("Creating window (app launch)...")
sdl.SDL_Init(sdl.SDL_INIT_EVERYTHING)
window=sdl.SDL_CreateWindow(
"This is a test.".encode("utf-8", "replace"),
sdl.SDL_WINDOWPOS_CENTERED, sdl.SDL_WINDOWPOS_CENTERED,
640, 480, sdl.SDL_WINDOW_SHOWN|sdl.SDL_WINDOW_RESIZABLE)
renderer=sdl.SDL_CreateRenderer(window, -1, 0)
# Main event loop:whileTrue:
time.sleep(0.01)
# Fetch events:events= []
whileTrue:
ev=sdl.SDL_Event()
result=sdl.SDL_PollEvent(ctypes.byref(ev))
ifresult==1:
events.append(ev)
continuebreakforeventinevents:
handle_event(event)
defhandle_event(event):
globalwindow, rendererifevent.type==sdl.SDL_QUITor \
event.type==sdl.SDL_APP_TERMINATING:
event_name="SDL_QUIT"ifevent.type==sdl.SDL_APP_TERMINATING:
event_name="SDL_APP_TERMINATING"print("Terminating (app termination event: "+event_name+").")
print("Actually, ignoring this")
#if renderer != None:# sdl.SDL_DestroyRenderer(renderer)# renderer = None#if window != None:# sdl.SDL_DestroyWindow(window)# window = None#sys.exit(0)elifevent.type==sdl.SDL_WINDOWEVENT:
ifevent.window.event== \
sdl.SDL_WINDOWEVENT_CLOSE:
# Throw away renderer:ifrenderer!=None:
sdl.SDL_DestroyRenderer(renderer)
renderer=Noneprint("Renderer destroyed (window closed).")
# Close window:ifwindow!=None:
sdl.SDL_DestroyWindow(window)
window=Noneprint("Window destroyed (window closed).")
# Terminate if not on android:ifsdl.SDL_GetPlatform().decode("utf-8").\
lower() !="android":
print("Terminating app since on desktop OS, "+"and last window was closed.")
sys.exit(0)
if (event.window.event==sdl.SDL_WINDOWEVENT_RESTOREDorevent.window.event==sdl.SDL_WINDOWEVENT_EXPOSEDorevent.window.event==sdl.SDL_WINDOWEVENT_MAXIMIZED):
# Re-create renderer if necessary:ifrenderer==None:
print("Renderer re-created (got window focus).")
renderer=sdl.SDL_CreateRenderer(window, -1, 0)
elif (event.type==sdl.SDL_APP_DIDENTERBACKGROUND):
print("Entered background.")
# Wipe renderer:ifrenderer!=None:
sdl.SDL_DestroyRenderer(renderer)
renderer=Noneprint("Renderer destroyed (entered background).")
elif (event.type==sdl.SDL_APP_WILLENTERFOREGROUND):
print("Entering foreground.")
# Re-create window if necessary:ifwindow==None:
window=sdl.SDL_CreateWindow(
"This is a test.".encode("utf-8", "replace"),
sdl.SDL_WINDOWPOS_CENTERED, sdl.SDL_WINDOWPOS_CENTERED,
640, 480, sdl.SDL_WINDOW_SHOWN|sdl.SDL_WINDOW_RESIZABLE)
ifrenderer!=None:
sdl.SDL_DestroyRenderer(renderer)
renderer=Noneprint("Renderer destroyed (new window).")
# Re-create renderer if necessary:ifrenderer==None:
renderer=sdl.SDL_CreateRenderer(window, -1, 0)
print("Renderer re-created (entering foreground).")
test_app()
This is the output:
08-24 21:18:36.216 4475 4475 V SDL : onResume()
08-24 21:18:36.218 4475 4491 V SDL : asked to get string private_version
08-24 21:18:36.218 4475 4491 V SDL : getting identifier
08-24 21:18:36.219 4475 4491 V SDL : kind is string and name private_version
08-24 21:18:36.220 4475 4491 V SDL : result is 2130968578
08-24 21:18:36.223 4475 4491 V PythonActivity: Data version is 1535137152.1970532
08-24 21:18:36.280 4475 4475 V pythonutil: Checking pattern libcrystax\.so against libSDL2_mixer.so
08-24 21:18:36.280 4475 4475 V pythonutil: Checking pattern libcrystax\.so against libSDL2_ttf.so
08-24 21:18:36.281 4475 4475 V pythonutil: Checking pattern libcrystax\.so against libmain.so
08-24 21:18:36.281 4475 4475 V pythonutil: Checking pattern libcrystax\.so against libSDL2.so
08-24 21:18:36.281 4475 4475 V pythonutil: Checking pattern libcrystax\.so against libcrystax.so
08-24 21:18:36.281 4475 4475 V pythonutil: Pattern libcrystax\.so matched file libcrystax.so
08-24 21:18:36.281 4475 4475 V pythonutil: Checking pattern libcrystax\.so against libSDL2_image.so
08-24 21:18:36.282 4475 4475 V pythonutil: Checking pattern libcrystax\.so against libpython3.5m.so
08-24 21:18:36.282 4475 4475 V pythonutil: Checking pattern libsqlite3\.so against libSDL2_mixer.so
08-24 21:18:36.283 4475 4475 V pythonutil: Checking pattern libsqlite3\.so against libSDL2_ttf.so
08-24 21:18:36.283 4475 4475 V pythonutil: Checking pattern libsqlite3\.so against libmain.so
08-24 21:18:36.283 4475 4475 V pythonutil: Checking pattern libsqlite3\.so against libSDL2.so
08-24 21:18:36.283 4475 4475 V pythonutil: Checking pattern libsqlite3\.so against libcrystax.so
08-24 21:18:36.283 4475 4475 V pythonutil: Checking pattern libsqlite3\.so against libSDL2_image.so
08-24 21:18:36.284 4475 4475 V pythonutil: Checking pattern libsqlite3\.so against libpython3.5m.so
08-24 21:18:36.284 4475 4475 V pythonutil: Checking pattern libssl.*\.so against libSDL2_mixer.so
08-24 21:18:36.285 4475 4475 V pythonutil: Checking pattern libssl.*\.so against libSDL2_ttf.so
08-24 21:18:36.285 4475 4475 V pythonutil: Checking pattern libssl.*\.so against libmain.so
08-24 21:18:36.285 4475 4475 V pythonutil: Checking pattern libssl.*\.so against libSDL2.so
08-24 21:18:36.285 4475 4475 V pythonutil: Checking pattern libssl.*\.so against libcrystax.so
08-24 21:18:36.285 4475 4475 V pythonutil: Checking pattern libssl.*\.so against libSDL2_image.so
08-24 21:18:36.286 4475 4475 V pythonutil: Checking pattern libssl.*\.so against libpython3.5m.so
08-24 21:18:36.286 4475 4475 V pythonutil: Checking pattern libcrypto.*\.so against libSDL2_mixer.so
08-24 21:18:36.287 4475 4475 V pythonutil: Checking pattern libcrypto.*\.so against libSDL2_ttf.so
08-24 21:18:36.287 4475 4475 V pythonutil: Checking pattern libcrypto.*\.so against libmain.so
08-24 21:18:36.287 4475 4475 V pythonutil: Checking pattern libcrypto.*\.so against libSDL2.so
08-24 21:18:36.287 4475 4475 V pythonutil: Checking pattern libcrypto.*\.so against libcrystax.so
08-24 21:18:36.287 4475 4475 V pythonutil: Checking pattern libcrypto.*\.so against libSDL2_image.so
08-24 21:18:36.288 4475 4475 V pythonutil: Checking pattern libcrypto.*\.so against libpython3.5m.so
08-24 21:18:36.288 4475 4475 V pythonutil: Loading library: crystax
08-24 21:18:36.293 4475 4475 V pythonutil: Loading library: SDL2
08-24 21:18:36.297 4475 4475 V pythonutil: Loading library: SDL2_image
08-24 21:18:36.299 4475 4475 V pythonutil: Loading library: SDL2_mixer
08-24 21:18:36.302 4475 4475 V pythonutil: Loading library: SDL2_ttf
08-24 21:18:36.303 4475 4475 V pythonutil: Loading library: python2.7
08-24 21:18:36.311 4475 4475 V pythonutil: Library loading error: dalvik.system.PathClassLoader[DexPathList[[zip file "/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/base.apk"],nativeLibraryDirectories=[/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/lib/arm, /system/fake-libs, /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/app/org.example.myapp-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]] couldn't find "libpython2.7.so"
08-24 21:18:36.312 4475 4475 V pythonutil: Loading library: python3.5m
08-24 21:18:36.317 4475 4475 V pythonutil: Loading library: main
08-24 21:18:36.319 4475 4475 V pythonutil: Failed to load _io.so or unicodedata.so...but that's okay.
08-24 21:18:36.320 4475 4475 V pythonutil: Unsatisfied linker when loading ctypes
08-24 21:18:36.320 4475 4475 V pythonutil: Loaded everything!
08-24 21:18:36.351 4475 4475 V PythonActivity: Setting env vars for start.c and Python to use
08-24 21:18:36.351 4475 4475 V PythonActivity: Access to our meta-data...
08-24 21:18:36.353 4475 4475 I PythonActivity: Surface will NOT be transparent
08-24 21:18:36.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:36.366 4475 4492 I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
08-24 21:18:36.373 4475 4492 I OpenGLRenderer: Initialized EGL, version 1.4
08-24 21:18:36.373 4475 4492 D OpenGLRenderer: Swap behavior 1
08-24 21:18:36.398 4475 4475 V SDL : surfaceCreated()
08-24 21:18:36.398 4475 4475 V SDL : surfaceChanged()
08-24 21:18:36.398 4475 4475 V SDL : pixel format RGB_565
08-24 21:18:36.400 4475 4475 V SDL : Window size:540x924
08-24 21:18:36.420 1845 5302 D Sensors : setDelay: acc_delay=20000000, mag_delay=200000000
08-24 21:18:36.420 1845 5302 D Sensors : setDelay: handle=0, delay=20000000
08-24 21:18:36.451 4475 4494 I SDL : SDL_Android_Init()
08-24 21:18:36.452 4475 4494 I SDL : SDL_Android_Init() finished!
08-24 21:18:36.452 4475 4494 I python : Initialize Python for Android
08-24 21:18:36.452 4475 4494 I python : Changing directory to the one provided by ANDROID_ARGUMENT
08-24 21:18:36.452 4475 4494 I python : /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app
08-24 21:18:36.452 4475 4494 I python : Preparing to initialize python
08-24 21:18:36.471 4475 4494 I python : crystax_python exists
08-24 21:18:36.471 4475 4494 I python : calculated paths to be...
08-24 21:18:36.471 4475 4494 I python : /mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app/crystax_python/stdlib.zip:/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app/crystax_python/modules
08-24 21:18:36.472 4475 4494 I python : set wchar paths...
08-24 21:18:36.527 4475 4475 V SDL : onWindowFocusChanged(): true
08-24 21:18:36.535 1845 1866 I ActivityManager: Displayed org.example.myapp/org.kivy.android.PythonActivity: +563ms
08-24 21:18:36.849 1480 1518 I ThermalDaemon: Sensor 'tsens_tz_sensor0' - alarm raised 1 at 50.0 degC
08-24 21:18:37.361 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:37.547 4475 4494 I python : Initialized python
08-24 21:18:37.547 4475 4494 I python : AND: Init threads
08-24 21:18:37.549 4475 4494 I python : testing python print redirection
08-24 21:18:37.554 4475 4494 I python : Android path ['.', '/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app/crystax_python/stdlib.zip', '/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app/crystax_python/modules', '/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app/crystax_python/site-packages']
08-24 21:18:37.556 4475 4494 I python : os.environ is environ({'ASEC_MOUNTPOINT': '/mnt/asec', 'ANDROID_SOCKET_zygote': '9', 'LD_PRELOAD': 'libsigchain.so', 'ANDROID_STORAGE': '/storage', 'ANDROID_ASSETS': '/system/app', 'BOOTCLASSPATH': '/system/framework/core-oj.jar:/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/apache-xml.jar:/system/framework/org.apache.http.legacy.boot.jar:/system/framework/telephony-ext.jar', 'ANDROID_BOOTLOGO': '1', 'PYTHONHOME': '/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app', 'PYTHONPATH': '/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app:/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app/lib', 'ANDROID_UNPACK': '/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app', 'LD_SHIM_LIBS': '/system/lib/libril.so|libshim_ril.so:/system/bin/mm-qcamera-daemon|libshim_camera.so', 'ANDROID_CACHE': '/cache', 'ANDROID_ROOT': '/system', 'SYSTEMSERVERCLASSPATH': '/system/framework/org.cyanogenmod.platform.jar:/system/framework/org.cyanogenmod.hardware.jar:/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar', 'TERMINFO': '/system/etc/terminfo', 'PYTHON_NAME': 'python', 'ANDROID_PRIVATE': '/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files', 'ANDROID_ARGUMENT': '/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app', 'EXTERNAL_STORAGE': '/sdcard', 'DOWNLOAD_CACHE': '/cache', 'PATH': '/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin', 'PYTHONOPTIMIZE': '2', 'ANDROID_APP_PATH': '/mnt/expand/ccbe4e94-5878-4053-8382-d825486cc844/user/0/org.example.myapp/files/app', 'ANDROID_ENTRYPOINT': 'main.pyo', 'ANDROID_DATA': '/data'})
08-24 21:18:37.558 4475 4494 I python : Android kivy bootstrap done. __name__ is __main__
08-24 21:18:37.558 4475 4494 I python : AND: Ran string
08-24 21:18:37.558 4475 4494 I python : Run user program, change dir and execute entrypoint
08-24 21:18:37.558 4475 4494 I python : main.py
08-24 21:18:38.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:39.361 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:39.823 10771 10771 D GeckoMemoryMonitor: onTrimMemory() notification received with level 80
08-24 21:18:40.091 4475 4494 I python : Creating window (app launch)...
08-24 21:18:40.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:41.000 1480 1518 I ThermalDaemon: Sensor 'tsens_tz_sensor0' - alarm cleared 1 at 46.0 degC
08-24 21:18:41.363 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:42.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:43.365 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:44.363 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:45.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:46.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:47.363 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:48.046 1845 1860 I ActivityManager: Config changes=480 {1.0 262mcc7mnc [en_US] ldltr sw360dp w640dp h336dp 240dpi nrml long land finger -keyb/v/h -nav/h s.48}
08-24 21:18:48.078 1845 1904 I InputReader: Reconfiguring input devices. changes=0x00000004
08-24 21:18:48.078 1845 1904 I InputReader: Device reconfigured: id=11, name='sec_touchscreen', size 540x960, orientation 3, mode 1, display id 0
08-24 21:18:48.083 1845 1904 I InputReader: Reconfiguring input devices. changes=0x00000004
08-24 21:18:48.147 10771 10771 D GeckoApplication: onConfigurationChanged: en_US, background: true
08-24 21:18:48.280 4475 4475 V PythonActivity: onPause()
08-24 21:18:48.280 4475 4475 V SDL : onPause()
08-24 21:18:48.280 4475 4475 V SDL : nativePause()
08-24 21:18:48.280 4475 4475 E libEGL : call to OpenGL ES API with no current context (logged once per thread)
08-24 21:18:48.281 1845 5577 D Sensors : setDelay: acc_delay=66667000, mag_delay=200000000
08-24 21:18:48.281 1845 5577 D Sensors : setDelay: handle=0, delay=66667000
08-24 21:18:48.284 4475 4494 I python : Entered background.
08-24 21:18:48.287 4475 4475 V SDL : onDestroy()
08-24 21:18:48.297 4475 4494 I python : Renderer destroyed (entered background).
08-24 21:18:48.308 4475 4494 I python : Terminating (app termination event: SDL_QUIT).
08-24 21:18:48.308 4475 4494 I python : Actually, ignoring this
08-24 21:18:48.308 4475 4494 I python : Terminating (app termination event: SDL_APP_TERMINATING).
08-24 21:18:48.308 4475 4494 I python : Actually, ignoring this
08-24 21:18:48.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:49.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:49.980 1845 1866 W WindowManager: Window freeze timeout expired.
08-24 21:18:49.981 1845 1866 W WindowManager: Force clearing orientation change: Window{3a2c612 u0 org.example.myapp/org.kivy.android.PythonActivity}
08-24 21:18:49.981 1845 1866 W WindowManager: Force clearing orientation change: Window{971fcdc u0 com.android.systemui.ImageWallpaper}
08-24 21:18:50.274 1845 1866 W WindowManager: App freeze timeout expired.
08-24 21:18:50.274 1845 1866 W WindowManager: Force clearing freeze: AppWindowToken{c4f40ae token=Token{d6cb2b0 ActivityRecord{191b5f3 u0 org.example.myapp/org.kivy.android.PythonActivity t3386}}}
08-24 21:18:50.281 1845 1866 I WindowManager: Screen frozen for +2s302ms due to Window{3a2c612 u0 org.example.myapp/org.kivy.android.PythonActivity}
08-24 21:18:50.366 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:51.363 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:52.314 1845 1866 I art : Starting a blocking GC Explicit
08-24 21:18:52.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:52.480 1845 1866 I art : Explicit concurrent mark sweep GC freed 52461(2MB) AllocSpace objects, 5(116KB) LOS objects, 33% free, 11MB/17MB, paused 2.319ms total 157.057ms
08-24 21:18:53.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:54.364 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:55.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:56.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:57.363 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:58.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:18:59.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:19:00.361 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:19:01.365 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:19:01.544 1845 1904 I InputReader: Reconfiguring input devices. changes=0x00000004
08-24 21:19:01.544 1845 1904 I InputReader: Device reconfigured: id=11, name='sec_touchscreen', size 540x960, orientation 0, mode 1, display id 0
08-24 21:19:01.548 1845 1904 I InputReader: Reconfiguring input devices. changes=0x00000004
08-24 21:19:01.553 1845 1860 I ActivityManager: Config changes=480 {1.0 262mcc7mnc [en_US] ldltr sw360dp w360dp h616dp 240dpi nrml long port finger -keyb/v/h -nav/h s.49}
08-24 21:19:01.607 10771 10771 D GeckoApplication: onConfigurationChanged: en_US, background: true
08-24 21:19:02.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:19:03.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:19:03.465 1845 1866 W WindowManager: Window freeze timeout expired.
08-24 21:19:03.465 1845 1866 W WindowManager: Force clearing orientation change: Window{3a2c612 u0 org.example.myapp/org.kivy.android.PythonActivity}
08-24 21:19:03.465 1845 1866 W WindowManager: Force clearing orientation change: Window{971fcdc u0 com.android.systemui.ImageWallpaper}
08-24 21:19:03.665 1845 1866 W WindowManager: App freeze timeout expired.
08-24 21:19:03.666 1845 1866 W WindowManager: Force clearing freeze: AppWindowToken{c4f40ae token=Token{d6cb2b0 ActivityRecord{191b5f3 u0 org.example.myapp/org.kivy.android.PythonActivity t3386}}}
08-24 21:19:03.675 1845 1866 I WindowManager: Screen frozen for +2s212ms due to Window{3a2c612 u0 org.example.myapp/org.kivy.android.PythonActivity}
08-24 21:19:04.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:19:05.362 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
08-24 21:19:05.719 1845 1866 I art : Starting a blocking GC Explicit
08-24 21:19:05.868 1845 1866 I art : Explicit concurrent mark sweep GC freed 5273(239KB) AllocSpace objects, 0(0B) LOS objects, 33% free, 11MB/17MB, paused 2.380ms total 145.978ms
08-24 21:19:06.365 1845 1881 D Sensors : LightSensor readEvents x = 0.000000, raw = 0
All I did during this output was 1. launch the app, 2. change screen orientation.
This is the output indicating the bug:
08-24 21:18:48.308 4475 4494 I python : Terminating (app termination event: SDL_QUIT).
08-24 21:18:48.308 4475 4494 I python : Actually, ignoring this
08-24 21:18:48.308 4475 4494 I python : Terminating (app termination event: SDL_APP_TERMINATING).
08-24 21:18:48.308 4475 4494 I python : Actually, ignoring this
This simply shouldn't happen, I think. I'm not sure why it does. When I change the code to not ignore those bogus events and actually terminate, the app crashes on orientation change with some java wrapper backtrace that looks like it's confused why the SDL window is suddenly gone. (well, why did it send me SDL_QUIT and SDL_APP_TERMINATING then...?)
Also, even more strangely, for any later orientation changes, this no longer happens. The bogus events only get sent for the very first one right after the app launched into my main.py code.
Steps to reproduce:
Build code above with --requirements=python3crystax,pysdl2,sdl2 --orientation user --window (last flag may or may not be required to reproduce)
Launch app, don't rotate the phone while it still unpacks & loads
When screen goes black and after adb logcat confirmed the app launch with the line Creating window (app launch)..., rotate your phone
Observe bogus events in log (or change the commented out code to be active, and observe the crash)
The text was updated successfully, but these errors were encountered:
I am using PySDL2 + python-for-android without kivy. In my test app, the first orientation change seems to cause an
SDL_QUIT
and anSDL_APP_TERMINATING
event, and I don't know why - it looks like a bug to me.This is the test code (feel free to build & test for yourself, needs
--requirements=sdl2,pysdl2,python3crystax
,--orientation user
of course, and possibly--window
to reproduce):This is the output:
All I did during this output was 1. launch the app, 2. change screen orientation.
This is the output indicating the bug:
This simply shouldn't happen, I think. I'm not sure why it does. When I change the code to not ignore those bogus events and actually terminate, the app crashes on orientation change with some java wrapper backtrace that looks like it's confused why the SDL window is suddenly gone. (well, why did it send me
SDL_QUIT
andSDL_APP_TERMINATING
then...?)Also, even more strangely, for any later orientation changes, this no longer happens. The bogus events only get sent for the very first one right after the app launched into my
main.py
code.Steps to reproduce:
--requirements=python3crystax,pysdl2,sdl2 --orientation user --window
(last flag may or may not be required to reproduce)adb logcat
confirmed the app launch with the lineCreating window (app launch)...
, rotate your phoneThe text was updated successfully, but these errors were encountered: