Allow line-breaking after close punctuation

Improves the approximation of the Unicode line-breaking algorithm in
StaticLayout slightly.

Change-Id: I9f8a3eed1904bd8482bb5cee4fb7b00ee6667df1
Parallel shutdown

Decrease shutdown time by doing some shutdown tasks in parallel.

There are two threads executing during the shut down: the ShutdownThread
and a separate thread for the radio shutdown. However, the execution is
done in serial, as the ShutdownThread immediately joins on the radio
thread.

This commit will move the shutdown of the radio to the beginning of
shutdown and execute it in parallel to the shutdown of the rest of the
system.

The flow of the two threads during shutdown is now:

Radio Thread
  * Start shutdown of the radio
  * Wait for radio off or time out
  * Notify that the radio is done
ShutdownThread
  * Broadcast ACTION_SHUTDOWN as a parallel broadcast. (The receivers
    will get as much time to handle onReceive as it takes execute the
    rest of the tasks in the shut down flow. If they are not done in
    that time, we don't care.)
  * Shutdown ActivityManager
  * Shutdown MountService
  * Wait for MountService and radio to notify done
  * Vibrate
  * Low level shutdown

Change-Id: Ifdd8a9c75337fd9d00148a0d2b9917e10fa60634

Conflicts:
	services/java/com/android/server/power/ShutdownThread.java
fix wrong transparent computation when background is transparent

1. when a view is set to be WILL_NOT_DRAW, it would check if the background is
null or not, to change mPrivateFlags follow rules:
    a) background is null, add the flag PFLAG_SKIP_DRAW
    b) background is valid, remove PFLAG_SKIP_DRAW and add PFLAG_ONLY_DRAWS_BACKGROUND
so when flag has PFLAG_ONLY_DRAWS_BACKGROUND, it must exclude PFLAG_SKIP_DRAW.

For transparent region computation, the function gatherTransparentRegion check
"non-PFLAG_SKIP_DRAW" case firstly, but it's wrong for PFLAG_ONLY_DRAWS_BACKGROUND
case,since it always has no PFLAG_SKIP_DRAW, it will always match the "if" part and
never go to the "else if" part, and always be taken as a non-transparent region
without checking background properties, which is wrong behavior.

So check PFLAG_SKIP_DRAW and PFLAG_ONLY_DRAWS_BACKGROUND here at the same time to
get the correct transparent computation.

2. In applyDrawableToTransparentRegion, getTransparentRegion of Drawable returns null
sometimes if subclass not implemented, so add opacity check here to make sure get the
correct transparent region.

3. Visibility change can also influence transparent region computation, so request
layout here to make sure the correct result.

Change-Id: I0978e022add002b94541b14c149ec8990e728ac7
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Reviewed-on: http://android.intel.com:8080/130698
Reviewed-by: Yao, Yong <yong.yao@intel.com>
Tested-by: Chen, HuaqiangX <huaqiangx.chen@intel.com>
Signed-off-by: Jian Luo <jian.luo@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 120472
[BatteryStatsImpl] Avoid memory corruption due to Parcel Recycling

While processing batterystatsfile, in present code there is a race where a parcel
might be recycled while it is being written to disk in another thread.

The write process is done in 2 steps:
- write into a Parcel (memory block)
- then write this Parcel to disk using Journaled API.
The Journaled API ensures robustness against file-system issues due to power cut.
The writing is done in batch using a thread running commitPendingDataToDisk().
This function writes the parcel to disk but this parcel is a global variable
initialized by writeLocked(). If the writing takes too long time and two write
threads are launched, the parcel is freed by the second writeLocked() call;
which could cause the memory corruption.

Hence, change global Parcel variable by a Parcel parameter to commitPendingDataToDisk()
and only this function will be allowed to recycle the parcel.

Change-Id: Ifecb2dd132a75334c821df2269b974db93f9a892
Author: Pavan Kumar S <pavan.kumar.s@intel.com>
Signed-off-by: Pavan Kumar S <pavan.kumar.s@intel.com>
Singed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 47466, 19426
Audio: Fix abnormal keytone playback during silent mode changing

Change-Id: I603dbf70615b25dfad846235b97be5eb2731617e
Origin-Change-Id: I29e8673bb8305d96d5adc0a7e82b9bb9bcb3e7de
Orig-Change-Id: I5240aa118d3eeb7c630b2e03abe5536c26e6a405
Orig-Change-Id: I70e634beaedf5a9220d7b36224bad7b5c0a164f3
Author: Chenyang Du <chenyang.du@intel.com>
Signed-off-by: ezhao3X <ertaox.zhao@intel.com>
Signed-off-by: Jian Luo <jian.luo@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 19084