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

Signed-off-by: Shubhang <shubhang92@gmail.com>
Fix error checking in MemoryFile.

mmap returns MAP_FAILED on failures, not 0 (NULL).
Also, convert some C style casts to C++ since they
make intent clearer.

Change-Id: I367993c73e9ee576f11ebe76e530d2c2f27c662d

Conflicts:
	core/jni/android_os_MemoryFile.cpp

Signed-off-by: Shubhang <shubhang92@gmail.com>
Fix a bug in KeyStore.getInstance().

Sometimes keystore process may die unexpectedly, so client cannot connect it.

Let KeyStore.getInstance() return null when it cannot get KeyStore
service, so that caller can get informed to prevent NullPointerExcepion.

Change-Id: I7aafc959dee9a77fda80ab6eb5c82f9a3f56f959
Signed-off-by: hanpengx <pengfeix.han@intel.com>
Signed-off-by: Guobin Zhang <guobin.zhang@intel.com>
Signed-off-by: Shubhang <shubhang92@gmail.com>
hwui: fix projection uniform caching.

The previous caching would only consider a change in the
actual matrix to figure out that the projection matrix
uniform needs to be updated. This would not work if the
requested projection matrix is identical, but only the
offsetting would change.

The fix now considers changes in the requested offsetting.

Change-Id: I49848de99a4ef80f43d9ca8437aa8403759c7d28

Signed-off-by: Shubhang <shubhang92@gmail.com>
Audio: Fixed system/call stream volume can't adjust with HS connected.

Issue Description:
When headset connected, the system/voice call stream volume can't be
adjusted from Volume bar.

Root Cause:
Currently adjustStreamVolume is applied to stream type alias and the
device for the stream alias. So when headset connected and adjust
volume for SYSTEM_STREAM, the operation will be applied to RING_STREAM
(which is aliased by SYSTEM_STREAM) and speaker. As headset is returned
from getDeviceForStream(SYSTEM_STREAM), but speaker for RING_STREAM.

Solution:
Change the adjustStreamVolume to apply volume to the stream alias and
the device for the stream type exactly.

Change-Id: Icd226d9eb197017cd3c186a0096edaed755680ec
Signed-off-by: Guo Xie <gxie@marvell.com>
Signed-off-by: Shubhang <shubhang92@gmail.com>
Always call super.onCreate(). Always.

Bug 12991134

(cherrypick of commit 9d6376a1d88ab5b3a41ee4400e3aaa4c4ee69e2a)

Change-Id: Ife16ef93408253e3318a06dc0206ab4b88c7f367

Signed-off-by: Shubhang <shubhang92@gmail.com>