why in api 28 the app is not really killed when "Background process limit - No background processes" is checked

Viewed 133

with android os 7.1.1 when "Background process limit - No background processes" is checked (in developer option settings), when minimized the app and re-open the app, all global data like val ViewModelDataMap = HashMap<String, Data>(), which is defined in file level - not inside any class are destroyed.

(also has the dont keep activity alive setting on)

but with api 28, when re-open the app the map is still have the old data in the map, seems the app has not been destroyed (although the trace shows the activity/fragment's onDestroy() are called).

why the behaviors are different? does with the api 28 that the os will not destroy the app process even if chosen "Background process limit - No background processes"?

1 Answers

I'm not sure, I'd have complete answer. However, the reason about Background processes is changed, because of the new configuration of LMKD starting with Pie Android 28. There is a lot of changes, but in the documentation, there are few words only about this.

Regarding Don't keep Activities. It should work in any version, because it's completely different thing and not driven by process term here. It's another simpl optimization, for clearing Activities in background (where process might be still alive).

Related