Fixed
Status Update
Comments
ki...@google.com <ki...@google.com>
al...@google.com <al...@google.com> #2
Please include a sample project that reproduces your issue.
al...@google.com <al...@google.com> #3
Here is the sample project.
Steps to reproduce:
1. Press on "Search" icon;
2. Write something;
3. Search this text, keyboard will be dismissed;
4. Tap on "Dialog" button;
5. Dissmiss dialog;
With the new 1.5.0 fragment library version text will be cleared in the search box after dismissing dialog.
In the version 1.4.1 and lower text in the search is not clearing and this is correct behaviour.
Please suggest some workarounds or how to fix this issue?
Steps to reproduce:
1. Press on "Search" icon;
2. Write something;
3. Search this text, keyboard will be dismissed;
4. Tap on "Dialog" button;
5. Dissmiss dialog;
With the new 1.5.0 fragment library version text will be cleared in the search box after dismissing dialog.
In the version 1.4.1 and lower text in the search is not clearing and this is correct behaviour.
Please suggest some workarounds or how to fix this issue?
al...@google.com <al...@google.com> #4
Hello, have you checked sample project? I hope it will help find the issue.
Description
Devices/Android versions reproduced on: pretty much any device and api (seen on emulators/Huawei/Samsungs, api 27/29/30)
If you have a stack of activities which includes one with android:configChanges="uiMode" and you call AppCompatDelegate.setDefaultNightMode it can cause other activities to not be recreated.
Eg :
Activity A DOESN'T intercept uiMode config changes in manifest
Activity B DOESN'T intercept uiMode config changes in manifest
Activity C DOES
Here is your stack : A > B > C (C on top)
Call AppCompatDelegate.setDefaultNightMode with a new mode on activity C
Activity C receives the change in onConfigurationChanged but there is a good chance that activity A and/or B were not recreated
Results can be different depending on which activity will be handled first in AppCompatDelegateImpl.updateForNightMode (see below).
Technically here is what I think is the issue :
- When I call AppCompatDelegate.setDefaultNightMode ultimately AppCompatDelegateImpl.updateForNightMode will be called for each activity (order can vary depending on activities creation/destruction cycle).
- When handling Activity C, AppCompatDelegateImpl.updateResourcesConfigurationForNightMode is called.
- It then calls res.updateConfiguration which updates the config for the whole app.
- For the remaining activities AppCompatDelegateImpl.updateForNightMode will find that "currentNightMode != newNightMode" is false because of that.
- Result is : these activitites won't be recreated.
Regards,