SecUSo / privacy-friendly-todo-list

Privacy Friendly App to manage To-Do lists on Android.
Apache License 2.0
84 stars 40 forks source link

'isunlock' may always be false when 'onSaveInstanceState' in 'MainActivity' #74

Closed AICT20 closed 4 months ago

AICT20 commented 4 years ago

I notice that in 'MainActivity', both 'onStop' and 'onSaveInstanceState' use the field 'isunlock'. However, accoding to the Android official documents, the execution order of these two lifecycle callbacks may reverse after Android API 28. In this case, if users use devices at or over API 28, 'isunlock' is always set to false in 'onStop' and afterwards saved into the bundle in 'onSaveInstanceState'.

0xC0FFEEC0DE commented 4 months ago

Hello @AICT20 , thanks for the hint! I read the documentation Fragment and View CREATED. I think the solution is to do isUnlocked = false at the end of onSaveInstanceState(). I don't know if this is necessary but I still do that at onStop() if API Level < 28.