Fix never-ending SIM PIN/PUK unlock progress dialog

If a recreation of the keyguard UI is triggered while waiting
for the SIM PIN/PUK unlock response, the response will be posted
to Views which are not attached to any Window. Since the code
runs in a Binder thread, the work will end up in an unused
work-queue and never be run. This will cause the unlock dialog
to never go away.

The solution is to create a handler which is attached to the UI
thread. Instead of posting via the post method of the View class
we post directly to the handler - hence avoiding that some work
ends up in a unused queue in case of being in detached state.

Change-Id: I9781a1600865705949626f97eb3c7a4f952d2de9
Prevent a duplicated registration of Observers

If same Observer and same URI are registered, the callback functions are called multiple times
when data identified by a given content URI changes.
It makes system slow and it cause ANR sometimes.
And When run unregisterContentObserver(), just one deleted
but others are remained in mObservers.
So add prevent code to avoid to duplicated registraion of Observers

Change-Id: I5c7845deb682db289ff0d53150ef012174859767
Signed-off-by: muzbit.kim <muzbit.kim@lge.com>
Avoid SystemUI crash due to NPE

BaseStatusBar.createNotificationViews() returns null
when it reports handleNotificationError(), leading to
a forced crash of the misbehaving app. However, it
should not add a null object of Notification.Entry
since it will also crash SystemUI (crashing at compare).

Change-Id: I86678c8024e931420b0fbab1f36b330e7e75d581
Fix to memory leak leaving WallpaperCropActivity.

After running wallpaper cropper serveral times it crashes with
an OutOfMemotyException.

When leaving WallpaperCropActivity all textures are leaking until end
of process lifetime. This is due to a missing call to function
TiledImageView.destroy which in turn assures TiledImageRenderer
releases held resources.

Resolved by assuring WallpaperCropActivity calls TiledImageView.destroy
from WallpaperCropActivity.onDestroy. In case where onDestroy is not
called resources will be released anyway by process being brought down.

Change-Id: I016b1b9da5f4db8d2b14767edb59fe742415e074
Fix a system crash due to orphan HandlerThreads

In SeekBarVolumizer class a HandlerThread is
instantiated that is not halted after the object
is garbage collected. The final consumer of
this class is volumes adjustment dialog in Settings.
If the user invoke the dialog several times, many pipes
are opened in Settings process that it finally exceeds
the maximum permitted number and the system crashes.

Change-Id: Ifd777365b5779f5db92c605413eb0254a53c8b00