Keyguard: add smart cover support

Change-Id: I436eba7678b923a9f293e15d786447214bc9bdcb
Signed-off-by: Roman Birg <roman@cyngn.com>
policy: respect FLAG_TURN_SCREEN_ON flag with device flip covers

If an application uses WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
and the device supports covers and the cover is closed, then after the
screen would turn on due to this flag, it would immediately be turned off
because PhoneWindowManager thinks the cover is closed, so it puts the device to
sleep.

Respect this flag and do nothing if it is detected.

Change-Id: I7eb36ce676730e47c551518e214b08561c401ea5
Signed-off-by: Roman Birg <roman@cyngn.com>
ProximitySensor: check for correct MaxRange value

Use TYPICAL_PROXIMITY_THRESHOLD for devices that returns incorrect mProximitySensor.getMaximumRange() value;

Presto's proximity sensor returns values: 0.0f(near) or 5.0f(far).
mProximitySensor.getMaximumRange() must return proximity sensor's availible range, but it always return 0, so mProximityThreshold is also 0.

So boolean positive = distance >= 0.0f && distance < mProximityThreshold;  positive will never be
true.
The cause of this problem is proprietary sensor.msm8660.so, it must set proper Range and Resolution for proximity sensor.

Change-Id: I0cf81fd20f210115cbd6db10c0070b12f1c57336