Insufficient ProcessRecord cleanup when persistent process is killed

When persistent process with Service restarts, ActivityManagerService
does not reset ProcessRecord#hasClientActivites to false
(because ProcessRecord of persistent process is continued using
after killing).

It disturbs updating LRU list in ActivityManagerService, and then,
when new process calls ActivityManagerProxy#publishContentProviders,
SecurityException happens because of no entry in the list.

Bug: 13517358

Change-Id: I46b064f71a4f7025ade1bf117801352a7ab22e6a
Fix very long app_name crash.

http://ibrahimbalic.com/2014/android-os-memory-corruption-bug/ found an stack overflow bug.
The very long app_name make libandroid_runtime allocate a very large array on stack, the stack may overflow to other data areas in this situation.
This patch allocate large array on heap instead of on stack to avoid segment fault when doing memcpy.

Change-Id: I99999569b852d43a9c7a6eb1fa80e9f1a1f4e2b2
Fix setSurfaceTexture to handle surface caching

Changed the TextureView.setSurfaceTexture to apply the
existing listener to the surface provided in the method.
This is done to allow surface caching to work.
Whenever a new SurfaceTexture gets created, its listener is
created as well, so when the setSurfaceTexture is called
we should be attaching the listener to the new surface.

Change-Id: I4c1a704c587e977ab7a6b1fe3a7d3e0d20d00218
CRs-Fixed: 639136
decouple SW FLP and HW FLP overlay flags

currently there is only overlay flag shared by SW FLP and HW FLP. This
change allows having different overlay setting for sw / hw FLPs.

Change-Id: I643fa70380e7568ae851d23e87917a5b4b599fe8
CRs-Fixed: 622338
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
Keyguard: LN: fix and harden against null pointer exceptions

Change-Id: Iff66791bb35b911e837b0a1747a72effdce507e3

Conflicts:
	packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java

Conflicts:
	packages/Keyguard/src/com/android/keyguard/KeyguardViewManager.java