The guide from Android developers is rather ambiguous.
The default implementation of onSaveInstanceState() saves information about the state of the activity’s view hierarchy, such as the text in an EditText widget or the scroll position of a ListView widget.
These get stored as far as I know:
- the
Intent
that started your activity (found out through testing) - properties of the objects in the
Activity
's view graph if they have been given an Id, presumably Fragment
s that are not in the back stack and which have been set to retain their instance (Fragment#setRetainInstance(boolean)
)
However, in the API I have not found such contract being described and I am not sure whether this list is exhaustive either. I have not been able to find any documentation which clearly expresses what gets stored.
This is a possible duplicate to this question, however that question doesn't ask for sources or exhaustiveness and the answers there do not provide that. Are developers supposed to just look into the SDK in every single View, Activity, Fragment, AutofillManager etc. they use to see what gets saved and what doesn't? What are the guarantees?