Merge "Skip background memory trim if the app is in the foreground state" into main