Merge "Improve isInForeground" am: 1b043e301d am: cc28b4329f

Change-Id: I39e29123084aaedd31bf00f0fa92c06155a0f139