REVERT: frameworks/base: tilerendering with fbo boundaries
Fix shutdown sequence to avoid SIGSEGV when running am command

When the app_process is shutting down the main thread will close the
binder fd while pool threads are executing an ioctl (in
IPCThreadState::stopProcess called by AppRuntime::onStarted in
app_main.c).

The binder driver will then return all pending calls in ioctl
without any error and with a command. One of the threads gets a
BR_SPAWN_LOOPER which will create a new thread (the other thread
gets a BR_NOOP). This new thread then calls
vm->AttachCurrentThread. Usually this results in a log entry with
"AndroidRuntime: NOTE: attach of thread 'Binder Thread #3' failed",
but sometimes it also causes a SIGSEGV. This depends on the timing
between the new thread an the main thread that calls DestroyJavaVM
(in AndroidRuntime::start).

If IPCThreadState.cpp is compiled with "#define LOG_NDEBUG 0" the
pool thread will loop and hit the
ALOG_ASSERT(mProcess->mDriverFD >= 0) in
IPCThreadState::talkWithDriver.

Crashes like this has been seen when running the am command and
other commands that use the app_process.

This fix makes sure that any command that is received when the driver
fd is closed are ignored and IPCThreadState::talkWithDriver instead
returns an error which will cause the pool thread to exit and detach
itself from the vm. A check to avoid calling ioctl to a fd with -1
was also added in IPCThreadState::threadDestructor.

Another solution might be to change the binder driver so that it
returns an error when the fd is closed (or atleast not a
BR_SPAWN_LOOPER command). It might also be possible to call exit(0)
which is done when System.exit(0) is called from java.

Change-Id: I3d1f0ff64896c44be2a5994b3a90f7a06d27f429

Conflicts:

	libs/binder/IPCThreadState.cpp
frameworks/base: tilerendering with fbo boundaries

1)tilerendering support when rendertarget switches
2)removed few rendering target switches to improve performance

Change-Id: I42c76e201537bd989631e11b0227ebcdc980f38b

Conflicts:

	libs/hwui/OpenGLRenderer.cpp
libstagefright: Fix for audio fail issue during continuous BT switching

- During playback, when BT is enabled and disabled
  continuously, audio fails after a while.
- A2DPNotificationThreadEntry() clears all the buffers
  in the response and request queues when BT is enabled
  and pushes back the buffers in the request queue.
  In parallel, eventThreadEntry() pushes a buffer back
  to the request queue which makes its size 5 causing
  audio failure.
- In eventThreadEntry(), acquire and release the request and
  response queue mutexes in a proper manner to prevent
  the scenario described above from happening.

Change-Id: I982f8c3281cfc19d44724b8d705453497a1c041b
CRs-Fixed: 365533
(cherry picked from commit da024eb01b8dd29739f2fda8000201a57e6c48de)
media: audio: Remove Pause IOCTL from seekTo

-Pause is now being handled in LPA kernel
driver incase of FLUSH, hence remove it
from seekTo routine.

CRs-Fixed: 342560
(cherry picked from commit 04a8cbf79658184887dc67716d9f11f915e4349b)

Change-Id: I3d04828624d861520dce50235540fff686c9bb01
frameworks/base: Fix for seek issue while LPA Playback

- During LPA playback if we drag the progress bar to seek
  several times, it is observed that audio will play the
  sound of previous position for 2-3 sec.
- When seek command is issued decoder thread is not blocked, which
  is trying to send data available at old position. Due to this we hear
  data available at old position for few seconds.
- Block the decoder thread till all the buffers are flushed

CRs-fixed: 358928
(cherry picked from commit 79165acf34bcd63de27dc735d807e0ef35d9d8c3)

Change-Id: I05203de136430876e61d6ef53a8a45c8fa54cb56
Nuplayer: Fix suspend resume issue for DASH content with no sidx

-For DASH content with no sidx seek fails.
-When suspend resume is done, there is a seek call made
 immediately after start. This causes an EOS to be queued
 for both audio and video tracks even before at least one
 frame is rendered.
-Fix to allow EOS to be queued even before a single frame is rendered.

CRs-fixed: 352201
(cherry picked from commit ab8bdcb673bebea3874071ff431143f54c58a400)

Change-Id: I2b30dd94cc1f822ee889a84773e0348af566d272
libstageright: Enable smooth streaming for Dash Live source

-Enabled smooth streaming for DashLiveSource
-Also,when smooth streaming is enabled, output format change
 event is sent after the next buffer is received from the decoder.
-Made a change to send output format change event immediately after
 it is detected.

CRs-fixed: 359374
(cherry picked from commit a729b71db9050fd589e5ac7008b2acd44498a0c7)

Change-Id: Ie695dbe3f2f5f7000fe1aeaff275e14489c8e1e4

Conflicts:

	media/libmediaplayerservice/nuplayer/NuPlayer.cpp
framework/base: hwui: Clear layer FBO after FBO cache is updated

Due to bug in GLRenderer stale FBO remains and can cause
corruption, clear layer fbo when fbo returned to cache.

CRs-fixed: 340481

(cherry picked from commit b01c082e12c4c4091016af1c95d851f29f5b7514)

Conflicts:

	libs/hwui/LayerRenderer.cpp

Change-Id: I8624879b4adbf9438a8c065b78932d1a4a2a15d4
REVERT: framework/base: hwui: Clear layer FBO after FBO cache is updated
REVERT: frameworks/base: tilerendering with fbo boundaries
frameworks/base: Fix sluggish to launch an app

The new trace feature/code in 4.0.4, which will dump the app stack
trace every 500ms if an app can't be launched within 500ms, is
holding the global ActivityManagerService lock unnecessarily. It
slows down the app's startup.

Change-Id: I91fbb043912b4d1fcf3e80d8ac4e61cd20ad89d1
Solution: move the trace file write operations out of sync block.
ActivityManagerService: stay away from zombie content providers

When the lowmemorykiller kills a content provider in an unfortunate
moment, an innocent client app can become attached to a zombie provider
and be unconditionally killed moments after, when the dead provider is
being removed.
Prevent this race by addition of isAlive function to Process.java that
determines whether a process is still running and is not only a zombie,
add a check of the state of the provider process to getContentProviderImpl.

Change-Id: Id753b8dab103e4b447c4138468938ca9f5cb857d
Dock Battery Fix to show Level

There is an issue with the dock battery where the battery icon
will show immediately on dock, but the battery level can take some
time to show.  This fixes that issue by the BatteryManager listning
for dock events and when one is detected it checks the battery level
and fires a battery intent.  This enables the battery level on the dock
to show immediately when docked.

Change-Id: I5677133c8492e3336f83342e702e638782f3ca6d
Signed-off-by: Chuck Haines <chaines@codemonkeyjava.com>
REVERT: quiet hours
Quiet Hours (1/3) - CyanogenMod

Change-Id: Idc415ae0aa6d77ae819b829e02d5044bc4510b87
Signed-off-by: sethyx <sethyx@gmail.com>

Conflicts:

	core/java/android/provider/Settings.java
	services/java/com/android/server/NotificationManagerService.java
bluewall firewall (1/2)

mutes notification sounds for an application
  for <X> seconds after playing

patch set 2: default to 0 to disable

Change-Id: Iaf4661f9cda9ab257ec2282f01f2a2f240ed21e7

Conflicts:

	core/java/android/provider/Settings.java
Add BLN to Quiet Hours (1/2)
fix Torch toggle FC
enable Led notifivation by default