Closed david-allison closed 2 years ago
Rebase in:
git bisect reset
git bisect start
git bisect bad
git bisect good ceefefb2305db79b1d34637be73373741b1701f9
git bisect run ./gradlew AnkiDroid:testPlayDebug --tests "*themeChangeIsValid*"
@mikehardy bad commit is 5473fb471f128044f7d025c3219206b4ebe11d75 .
androidx.appcompat:appcompat:1.4.2 -> 1.5.1
Added in https://github.com/ankidroid/Anki-Android/pull/12343
Want to fix-forward, or revert?
fix-forward, we're still in alpha. For beta or or stable would just revert. I always worry when appcompat moves a minor version, I was half expecting this...
From the PR:
Standard dependency updates, but moving core-ktx and appcompat may be "interesting". Hopefully not
So, it is "interesting". Joy :-)
https://developer.android.com/jetpack/androidx/releases/appcompat#1.5.0 says:
This stable version includes improvements to night mode stability
Possible hit: https://issuetracker.google.com/u/1/issues/239882532 (noting @pavreh lists device as Android 12 typically, but @david-allison your android version is unknown. Is it 12?). This hypothesis may be checked via test on Android 11 vs Android 12.
I've posted a failing unit test above. I was testing on an Android 11 physical device
Got it re: Android 11. Glad we're not dealing with the above issue I linked then - or (alternative read) perhaps it will be a multi-bug with different effects.
If that's the case then, my reading of the changelog from appcompat 1.4.x to 1.5.x was that something about the attaching of contexts, their resources, their precedence, and how changes propagated from changes in the same, is different between 1.4.x and 1.5.x. So if I were triaging I would look very carefully at the context objects that are in play as uiMode changes
I had a brief look, there was a single recursive call on onConfigurationChanged(newConfig)
which could be problematic (recursive both in 1.4.2 and 1.5.1).
making an immutable copy of the config (Configuration(newConfig)
) before calling to super
appeared to fix this: but I'd like an investigation into what went wrong.
I'm not going to have time to take this further.
Oh boy. I'll look this on the weekend if I get the time
On Android11, with alpha84 It works if the system is in dark mode when starting. However, it doesn't response to the change of uiMode. Killing then restarting is ok.
As a side-effect, we now get configuration updates that are (correctly) missing our overrides. To counteract this, we let the delegate re-apply overrides and then we replace the configuration update contents with the desired overridden configuration contents.
It seems to be the cause.
I'm not gonna have time to fix this anytime soon. If someone else would like to take this, it would be very appreciated
This bug is introduced by the delegate who applies the overwritten config to the activity. It's fixed by https://android.googlesource.com/platform/frameworks/support/+/335eddbfe69984a079881274ebb72402f9adaf72%5E%21/#F0 which included in appcompat:1.6.0-rc01. I'll make PR when 1.6.0 is stable.
Hey @JalinWang fantastic! I don't see any problem with including an rc dep as a PR now if it really fixes things. Historically the rc -> stable transition for appcompat appears to be about 3 weeks, and dependabot will let us know to bump it to stable automatically so there won't be any follow-on, and this will be fixed now
Night mode do not work at all in AnkiDroid 2.16alpha84.
Originally posted by @pavreh in https://github.com/ankidroid/Anki-Android/issues/11982#issuecomment-1247607681