fixed bug in "onlyWhenFocused" mode.

Change-Id: Ifa88e230029fc1c4e4143849c5757b75fcced553