keyboard: re-add code to detect lid state

This was lost in the cm-11 merge. Without this, a change in lid state
isn't generated to light up the keyboard backlight

Change-Id: Ief35cebcb62da13afe1ae7531d69ab58e196be9e
Merge tag 'android-4.4_r1.2' into cm-10.2

Android 4.4 Release 1.2
PhoneWindowPolicy: Fix NPE race condition by excessive screen on delay

When screen on has an excessive delay mTopFullscreenOpaqueWindowState could
not be initialized. This derives in a NPE from a Power key press. If
mTopFullscreenOpaqueWindowState = null then PREVENT_POWER_KEY can be safelly
ignored

Change-Id: I04ce5d88f6f9abf02b2bbcdce4a2acad2f6451fa
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>