You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently state saving is based on the android_native_app_glue design whereby there is a saved_state, malloc() allocation and saved_state_size that are only allowed to be modified during MainEvent::SaveState.
This state is initialized during onCreate but it is cleared after each Resume event.
This means that if there are multiple Resume events (can happen when switching Android applications) then later Resume events may be passed no state (and even the first Resume may get no state if no state was passed to onCreate.
The current design is also awkward from the POV that we are tracking a malloc() allocation whose ownership is context sensitive. It is owned by the app when passed to onCreate and it is owned by the ANativeActivity when it is set during MainEvent::SaveState.
Instead of tracking this malloc() allocation state we should simply track a save_state: Vec<u8> that can be updated and queried at any time. When ANativeActivity needs to get this state via onSaveInstanceState then we can simply copy the state into a transient malloc() allocation.
The text was updated successfully, but these errors were encountered:
Currently state saving is based on the
android_native_app_glue
design whereby there is asaved_state
,malloc()
allocation andsaved_state_size
that are only allowed to be modified duringMainEvent::SaveState
.This state is initialized during
onCreate
but it is cleared after eachResume
event.This means that if there are multiple
Resume
events (can happen when switching Android applications) then later Resume events may be passed no state (and even the firstResume
may get no state if no state was passed toonCreate
.The current design is also awkward from the POV that we are tracking a
malloc()
allocation whose ownership is context sensitive. It is owned by the app when passed toonCreate
and it is owned by theANativeActivity
when it is set duringMainEvent::SaveState
.Instead of tracking this
malloc()
allocation state we should simply track asave_state: Vec<u8>
that can be updated and queried at any time. WhenANativeActivity
needs to get this state viaonSaveInstanceState
then we can simply copy the state into a transientmalloc()
allocation.The text was updated successfully, but these errors were encountered: