PianOli icon indicating copy to clipboard operation
PianOli copied to clipboard

Visual artifacts upon first keypress

Open juleskers opened this issue 2 years ago • 3 comments

In #73, @nicolasbrailo mentioned jumping keys upon first keypress.

One suggestion for a test: can we add one to test the stability of the sizes? I noticed the size of the keys in the app change after the first keypress on the latest version of the app, and I'm not sure why or when we introduced that

While I haven't seen size changes myself, I have seen black areas that only get filled out after the first touch.

It seems we have some kind of cached screen surface (probably from Android itself?) that only gets repainted on first trigger.

Since I am not quite sure where to start fixing this, I'm opening this ticket to track the investigation.

juleskers avatar Sep 26 '23 17:09 juleskers

So far, i Have personally observed:

  • upon app-resume black bar at right/bottom, exactly matching the android bottom bar (home, back, recent apps), not sure how to reproduce this one..
  • after completely closing the app (swiping to the side in "recent apps" view, first opening of the app will show a black screen with the android locking warning, like so:
    • Screenshot_20230926-191909_PianOli
    • closing the android warning will show a completely black screen
    • touching anywhere will play a note and draw the normal piano.

My phone is running /e/-OS, a LineageOS derivate, since Android flavours probably differ in their rendering and resume behaviour.

@nicolasbrailo, do your "jumping" keys happen in the "closed from recent apps" scenario?

juleskers avatar Sep 26 '23 19:09 juleskers

Just a realisation, while I was refactoring PianoCanvas..

Should we (re)draw on surfaceChanged?
Currently, we just ignore it, which may lead the OS to do "smart" things with outdated, wrongly scaled cached previews.. (or black screens if it doesn't have those)..

Current implementation:

https://github.com/nicolasbrailo/PianOli/blob/453e67dd30abf3c872a8d402d6fd523941eaeac6/app/src/main/java/com/nicobrailo/pianoli/PianoCanvas.java#L325-L328

juleskers avatar Dec 17 '23 19:12 juleskers

@juleskers good find. I think it only makes sense to redraw when the OS is telling us the screen changed!

nicolasbrailo avatar Dec 20 '23 11:12 nicolasbrailo