koreader / android-luajit-launcher

Android NativeActivity based launcher for LuaJIT, implementing the main loop within Lua land via FFI
MIT License
130 stars 83 forks source link

fix notch reported size on 1st launch after instal #469

Closed hugleo closed 4 months ago

hugleo commented 6 months ago

Issue: https://github.com/koreader/android-luajit-launcher/issues/463


This change is Reviewable

hugleo commented 6 months ago

It seems like as seeing in the log: "Looks like '02-09 07:18:36.395 16369 16402 V NativeThread: Activity window ready.'" is never called in the case of the nitpick problem. Trying to blit but no window is ready yet.

After manually force closing the remaining dialog, looks normal:

02-09 07:17:47.494 16047 16125 D NativeGlue: android_app_destroy!
...
02-09 07:18:36.055  1840  2073 W ActivityManager: setHasOverlayUi called on unknown pid: 15409
02-09 07:18:36.249 16369 16369 I MainActivity: loading libluajit
02-09 07:18:36.305 16369 16369 D NativeGlue: Creating: 0xb4000078eb499400
02-09 07:18:36.306 16369 16402 V NativeGlue: User FIFO already exists at `/data/user/0/org.koreader.launcher.debug/files/alooper.fifo`
02-09 07:18:36.306 16369 16402 D NativeThread: Starting
02-09 07:18:36.306 16369 16402 V NativeThread: waiting for activity
02-09 07:18:36.314 16369 16369 I Assets  : loading lib7z
02-09 07:18:36.328 16369 16369 V Surface : Using Native Content implementation
02-09 07:18:36.330 16369 16369 V MainActivity: native orientation: portrait
02-09 07:18:36.344 16369 16369 V NativeGlue: Start: 0xb4000078eb499400
02-09 07:18:36.345 16369 16402 D NativeGlue: activityState=10
02-09 07:18:36.348 16369 16369 V NativeGlue: Resume: 0xb4000078eb499400
02-09 07:18:36.348 16369 16402 D NativeGlue: activityState=11
02-09 07:18:36.348 16369 16402 D NativeGlue: Post APP_CMD_RESUME
02-09 07:18:36.367 16369 16369 V NativeGlue: InputQueueCreated: 0xb4000078eb499400 -- 0xb4000078eb405a00
02-09 07:18:36.367 16369 16402 D NativeGlue:  APP_CMD_INPUT_CHANGED
02-09 07:18:36.367 16369 16402 D NativeGlue: Attaching input queue to looper
02-09 07:18:36.374 16369 16369 D Surface : onAttachedToWindow()
02-09 07:18:36.374 16369 16369 V Surface : top 93 pixels are not available, reason: window inset
02-09 07:18:36.395 16369 16369 V NativeGlue: NativeWindowCreated: 0xb4000078eb499400 -- 0xb40000781ac36810
02-09 07:18:36.395 16369 16402 D NativeGlue: APP_CMD_INIT_WINDOW
02-09 07:18:36.395 16369 16402 V NativeThread: Activity window ready.
02-09 07:18:36.410 16369 16369 V Surface : surface changed {
02-09 07:18:36.410 16369 16369 V Surface :   width:  1080
02-09 07:18:36.410 16369 16369 V Surface :   height: 2307
02-09 07:18:36.410 16369 16369 V Surface :  format: RGB_565
02-09 07:18:36.410 16369 16369 V Surface : }
02-09 07:18:36.410 16369 16369 V NativeGlue: NativeWindowResized: 0xb4000078eb499400 -- 0xb40000781ac36810
02-09 07:18:36.419 16369 16369 V NativeGlue: ContentRectChanged: l=0,t=0,r=1080,b=2177
02-09 07:18:36.421 16369 16369 V NativeGlue: NativeWindowRedrawNeeded: 0xb4000078eb499400 -- 0xb40000781ac36810
02-09 07:18:36.436 16369 16369 V NativeGlue: NativeWindowRedrawNeeded: 0xb4000078eb499400 -- 0xb40000781ac36810
02-09 07:18:36.439 16369 16369 V NativeGlue: WindowFocusChanged: 0xb4000078eb499400 -- 1
02-09 07:18:36.439 16369 16402 V NativeThread: Activity gained focus.
02-09 07:18:36.441 16369 16402 V NativeThread: Launching LuaJIT assets

If we do not close, niptick problem:

02-09 07:11:21.642 13494 13579 D NativeGlue: android_app_destroy!
...
02-09 07:11:26.034 13494 13494 I MainActivity: loading libluajit
02-09 07:11:26.067 13494 13494 D NativeGlue: Creating: 0xb4000078eb43e880
02-09 07:11:26.067 13494 13845 V NativeGlue: User FIFO already exists at `/data/user/0/org.koreader.launcher.debug/files/alooper.fifo`
02-09 07:11:26.067 13494 13845 D NativeThread: Starting
02-09 07:11:26.067 13494 13845 V NativeThread: waiting for activity
02-09 07:11:26.068 13494 13494 I Assets  : loading lib7z
02-09 07:11:26.070 13494 13494 V Surface : Using Native Content implementation
02-09 07:11:26.071 13494 13494 V MainActivity: native orientation: portrait
02-09 07:11:26.078 13494 13494 V NativeGlue: Start: 0xb4000078eb43e880
02-09 07:11:26.078 13494 13845 D NativeGlue: activityState=10
02-09 07:11:26.080 13494 13845 V NativeThread: Launching LuaJIT assets
02-09 07:11:26.080 13494 13494 V NativeGlue: Resume: 0xb4000078eb43e880
02-09 07:11:26.090 13494 13845 I Assets  : New install
02-09 07:11:26.093 13494 13845 V Assets  : Uncompressing module/koreader.7z
02-09 07:11:30.559 13494 13845 V Assets  : Reading symlinks map from module/map.txt
02-09 07:11:31.888 13494 13845 I Assets  : update installed in 5797 milliseconds
02-09 07:11:31.947 13494 13845 I KOReader: Android 13 - S (API 33) - flavor: rocks
02-09 07:11:31.954 13494 13845 W KOReader: cannot blit: no window
02-09 07:11:31.965 13494 13845 I KOReader: initializing for device spes_global
02-09 07:11:31.965 13494 13845 I KOReader: framebuffer resolution: {
02-09 07:11:31.965 13494 13845 I KOReader:   h = 2400,
02-09 07:11:31.965 13494 13845 I KOReader:   w = 1080
02-09 07:11:31.965 13494 13845 I KOReader: } --[[table: 0x78d0337d98]]
02-09 07:11:32.303 13494 13845 I KOReader: Loading plugins from directory: plugins
02-09 07:11:32.463 13494 13845 I KOReader: Loading plugins from directory: /storage/emulated/0/koreader/plugins/
02-09 07:11:32.551 13494 13845 W KOReader: cannot blit: no window
02-09 07:11:32.551 13494 13845 D NativeGlue: activityState=11
02-09 07:11:32.551 13494 13845 D NativeGlue: Post APP_CMD_RESUME
02-09 07:11:32.565 13494 13494 V NativeGlue: InputQueueCreated: 0xb4000078eb43e880 -- 0xb4000078206b9800
02-09 07:11:32.565 13494 13845 D NativeGlue:  APP_CMD_INPUT_CHANGED
02-09 07:11:32.565 13494 13845 D NativeGlue: Attaching input queue to looper
02-09 07:11:32.638 13494 13494 D Surface : onAttachedToWindow()
02-09 07:11:32.639 13494 13494 V Surface : top 93 pixels are not available, reason: window inset
02-09 07:11:32.669 13494 13494 V NativeGlue: NativeWindowCreated: 0xb4000078eb43e880 -- 0xb40000781ac30010
02-09 07:11:32.670 13494 13845 D NativeGlue: APP_CMD_INIT_WINDOW
02-09 07:11:32.671 13494 13494 V Surface : surface changed {
02-09 07:11:32.671 13494 13494 V Surface :   width:  1080
02-09 07:11:32.671 13494 13494 V Surface :   height: 2307
02-09 07:11:32.671 13494 13494 V Surface :  format: RGB_565
02-09 07:11:32.671 13494 13494 V Surface : }
02-09 07:11:32.671 13494 13494 V NativeGlue: NativeWindowResized: 0xb4000078eb43e880 -- 0xb40000781ac30010
02-09 07:11:32.675 13494 13494 V NativeGlue: ContentRectChanged: l=0,t=0,r=1080,b=2177
02-09 07:11:32.682 13494 13494 V NativeGlue: NativeWindowRedrawNeeded: 0xb4000078eb43e880 -- 0xb40000781ac30010
02-09 07:11:32.708 13494 13494 V NativeGlue: NativeWindowRedrawNeeded: 0xb4000078eb43e880 -- 0xb40000781ac30010
02-09 07:11:32.725 13494 13494 V NativeGlue: WindowFocusChanged: 0xb4000078eb43e880 -- 1
02-09 07:11:32.770 13494 13494 V NativeGlue: ContentRectChanged: l=0,t=0,r=1080,b=2307

I don't know if these changes should have any implications on the Android lifecycle. Pinging @pazos for thoughts.

pazos commented 4 months ago

@hugleo: sorry, I miss this PR.

I have no problem with these changes. Do you want them merged?

How I should name it? Something like "fix notch reported size on 1st launch after install"?

hugleo commented 4 months ago

@hugleo: sorry, I miss this PR.

I have no problem with these changes. Do you want them merged?

How I should name it? Something like "fix notch reported size on 1st launch after install"?

Please, this will fix that nitpick problem for good ;-)