Revert "Remove duplicate if statement"

This reverts commit d908f744c0cfd2cf8f750eb03836527f54c6fe85.
Revert "Sensors could be disabled by any application"

This reverts commit bb736e97bdabbbaa8ce44c1681983f86c3208eae.
Revert "Make implementation of isEmpty consistent with implementation of getCount in HeaderListViewAdapter"

This reverts commit bdfa9a1015ec7bc82c96a92fc84117bf2d6a0180.
Revert "Correct the target app token for input method window"

This reverts commit b048432053f70a47a5ac9ef1303d08973c6478c1.