Skip to content

Fix App's background state on low memory conditions #4033

Description

@daniloercoli

We're not correctly disabling the ConnectionChangeReceiver listeners, and bumping analytics, when the app goes background while the device is running in low memory conditions. Also the variable mIsInBackground is not set to true.

Basically ApplicationLifecycleMonitor.onTrimMemory(final int level) is called with a level that's not the classic TRIM_MEMORY_UI_HIDDEN (level used when the process had been showing a user interface, and is no longer doing so), and then all of our code is not running.
In my test case that was called with TRIM_MEMORY_COMPLETE, but we should check all other available constants.

Note that onTrimMemory(final int level) could be called anytime if the device is running in low memory conditions. Don't think we can just redo the same thing we're already doing in TRIM_MEMORY_UI_HIDDEN.

Tested on [device], Android [version]

Nexus 5X, 6.X

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions