framework:Thread synchronization for UI update

Issue : Framework reboot was observed due to out of sync between
        two threads which inturn causes Null pointer exception
        while updating airplanemode.
Fix : Handled Null pointer exception and the crash is not observed.
CRs-Fixed: 570122

Change-Id: I2e969f6e7726ffcf8648b366ebb54cb2b0afc292
(cherry picked from commit cff036dbd8461c5347afe5f9ac299e64774265c2)
Remove unnecessary updateSurfaceScreenOn call.

This change stops updateSurfaceScreenOn() from being called one time
right after another. It's called at the end of stayAwake(boolean awake),
which is called right before updateSurfaceScreenOn() in release().

Change-Id: I3e5db322f0abce0cd37320a103015ba72dffa64f
(cherry picked from commit c1e53282eed200ab3076ceb7d02b69b8b0397c77)
Frameworks: Add per app controls for LP keyguard notifications (1/2)

Nice done by google but the UX is a problem especially for ppl who are using a lot apps and just want
to see from important apps the notifications on the lockscreen.

This commit adds the ability to

- enable/disable per app the keyguard notification at all
- enable/disable per app ongoing notifications on the keyguard

We handle this over the app policy conf file like the other per app notification options.

Change-Id: I3e4641c3413ca0a8920b1680ca5f01f6eb4d0225
(cherry picked from commit f79066dfa12553b0168fc6a051804d1205223f62)