frameworks/base: Fix change propagating issue

destroyLayer() function has been modified in kk. It is not correct
to propagate the UI corruption fix from jb to kk without considering
the new changes made in kk. This change is to make it align with
the new code in kk.

Change-Id: I34d11b230b9390fe8a989ab6f9c7d3a48d586205
WallpaperManager: add NULL pointer check for getCropAndSetWallpaperIntent

Originally the api 'getCropAndSetWallpaperIntent' does not check
whether the parsed parameter is a NULL pointer, as leads to the
whole app crash if it call this api with a null parameter accidentally.
A null pointer check logic is added into its original parameter check
logic, so that this API will throw an IllegalArgumentException if it
is parsed with a null pointer

Change-Id: Ib7de40e571419d09e1a744edc969eb7162766b75
MetadataRetriever: Check null pointer to avoid tombstone crash.

When the app's vm-heap is not enough, memory allocation for big
object like bitmap may failed.

This patch add protection for bitmap creating to avoid segment
fault error in the following GetIntField function.

Change-Id: I63977dc602f4ed395afd11004a0ed027173fb685
Signed-off-by: wang, biao <biao.wang@intel.com>
Signed-off-by: TingX Li <tingx.li@intel.com>
Signed-off-by: Wang LiangX <liangx.wang@intel.com>
Fix a NPE when putting a null-Bundle in an Intent

Happens frequently e.g. with GoogleAccountAuthenticator

Change-Id: I284bf153f40ee9cc3e70bce6efcc3b9e6706361b
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
[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
Keyguard: Move test app translations to the correct place

Google messed up again with translations.
This change is needed because it interferes with our translations
which happen to use same string names as the Keyguard test app.

Change-Id: I593ab5f004f09e1b33c5ba7ef3d1bb19ffc643b4