Add new APIs to use SAVEPOINT

This is implemented based on SAVEPOINT. Savepoints are useful for implementing
complex error recovery in database applications. If an error occurs in the midst
of a multiple-statement transaction, the application may be able to recover
from the error (by rolling back to a savepoint) without needing to abort
the entire transaction.
This APIs can be operated with TransactionStack.

Change-Id: I2cada3ccf98d6a330cb93f1d12e487a259c39998
Catch corruptexception during Transaction operation

If corruption occurs in a transaction running,
DB file should be deleted.

Change-Id: I5b3a122ebe51770966c334021ab6717d5ff081c3
Signed-off-by: muzbit.kim <muzbit.kim@lge.com>
To protect mFds and mThread with this for thread-safe.

It may take a lot of time to execute run() of new thread after the
thread is started. To protect mFds and mThread with this to prevent
NullPointerException.

Change-Id: I27f1cc5b184b3574dbeda1b391188b346fe363fd
Signed-off-by: hanpengx <pengfeix.han@intel.com>
TouchExplorer: throw exception only in debug build

In stead of throwing exception to cause system server dead, printing
out error message in release build will be more reasonable.
In debug build, keep throwing exception to crash system server.

Change-Id: I6e9cfdbfaaed6c03972c223c46ed78bfb0e00069
frameworks: Rquests permission for accessing downloaded files

Allowing systemUI to share downloaded files with RecntsPanelView
via granted permission request ACCESS_ALL_DOWNLOADS.

Change-Id: If7a137639ed69c43cf7736756abe0f1b98442010
ImagerReader: Return the buffer to queue if it fails to lock

Return the buffer to the queue when failing to lock it with the
error ACQUIRE_NO_BUFFERS, which acquireNextImage of
ImageReader will return null. Otherwise, there is no chance to return
the buffer back later since the caller can't get the new SurfaceImage
object.

Change-Id: I774e91d52f3e10c8d2dd88d835505da79086c5b2
BroadcastQueue: change ActivityInfo to ResolveInfo

ActivityInfo should be ResolveInfo regarding the defination of
r.receivers, otherwise nextReceiver should always be null.

Change-Id: I6123b1bb689d840ae4240c1530c49e0eaa911cc0
[ActivityManager] Reduce report ANR on wrong activity.

Symptom: ANR report on wrong activity.

Root Cause:
  KK changed resume behavior that will not update focus when only resume,
if the activity blocked, it may report ANR on previous focus.
  By original concept, it will try to correct the ANR target,
but the stack of waiting(waitingVisible=true) activity may
different with current top stack.
  If it gets key dispatch timeout, mResumedActivity and mPausingActivity
of its stack will be null becuase it is not top stack.
Then it is unable to change ANR target to the real no response activity.

Solution:
 Use focused stack to get the real culprit.

Reproduce steps:
1.Launch an Activity X from launcher, press home key.
2.Launch X from launcher again, X blocks(sleeps 15sec) in onResume, press back key in the beginning of blocking duration.
3.ANR dialog shows launcher is no response.

Change-Id: I99416ad91e349096f995990f2240a97616fbaf28
mSurface was reset and lost initialization.

mSurface got reset and lost initialization when the developer call
setSurfaceTexture() in onSurfaceTextureAvailable().

Change-Id: If07260e3897e99b96e7a9d86ee5bc1528fb30ab4
Signed-off-by: ChaoJun Xue <xdtq47@motorola.com>
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
Don't allow MemoryFiles of negative length.

Prevents us from converting a (signed) jint into an
(unsigned) size_t and having horrible things happen.

Change-Id: I0f04e2eb9852ae7fc49b435fd0974f56e86751a4