fix possible buffer overrun and memory leak

Use snprintf instead of sprintf and fclose() before return.

Change-Id: I3ed193464cc0dc90e9935ae19162667ad367628b
Make implementation of isEmpty consistent with implementation of getCount in HeaderListViewAdapter

Fix for Issue ID 18316. Make isEmpty() return false when getCount() returns a non-zero value. So that the list cannot be considered empty when a header or footer is present.

https://code.google.com/p/android/issues/detail?id=18316

Change-Id: Ib69201e9d5ef3efcbb68ea298b8cc8ca6e027246
Signed-off-by: Emma Sajic <esajic@effectivelateralsolutions.co.uk>
Keyguard: fix statusbar lags when default widget shown.

When statusbar became expanded KeyguardStatusView receives
onKeyguardVisibilityChanged callback and refreshes ClockView.
Because it receives more than one call and every time it reads
new values from resources it cause lags in opening statusbar panel.

Replace this code with BroadcastReceiver and ContentObserver to
refresh it only in case something was changed.

Change-Id: If0dbc1db059536806852661931cb2e6436f2acf4