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

Change-Id: I2b65bf8e06e176da1b65b9069abcb9183fa63110