Devices/Android versions reproduced on: Pixel 6 - Android 13
Issue:
If a child activity enables local night mode and is then closed, inflating a view (for instance creating and showing a DialogFragment) will cause the view to also follow night mode.
Step to reproduce:
Open the project, build and install the app
Open the app, with a device with night mode disabled
MainActivity is opened. The activity is using day mode. Tapping on SHOW DIALOG creates and shows a DialogFragment. Verify the dialog is also using day mode.
From MainActivity, open DarkActivity by tapping on the OPEN DARK ACTIVITY button
DarkActivity calls setLocalNightMode with AppCompatDelegate.MODE_NIGHT_YES right before super.onCreate. This activity is now in night mode.
Go back to MainActivity by performing a back gesture or by tapping on the button that calls Activity.finish
Tap on SHOW DIALOG. The dialog is using night mode
Description
Component used: AppCompatDelegate
Version used: 1.5.1
Devices/Android versions reproduced on: Pixel 6 - Android 13
Issue:
If a child activity enables local night mode and is then closed, inflating a view (for instance creating and showing a
DialogFragment
) will cause the view to also follow night mode.Step to reproduce:
MainActivity
is opened. The activity is using day mode. Tapping on SHOW DIALOG creates and shows aDialogFragment
. Verify the dialog is also using day mode.MainActivity
, openDarkActivity
by tapping on the OPEN DARK ACTIVITY buttonDarkActivity
callssetLocalNightMode
withAppCompatDelegate.MODE_NIGHT_YES
right beforesuper.onCreate
. This activity is now in night mode.MainActivity
by performing a back gesture or by tapping on the button that callsActivity.finish