A metric-butt-ton of cherries from AOSP's Gerrit.

Squashed commit of the following:

commit 71337dfc4431c60d3bbf2082806311854ff51f77
Author: Jean-Christophe PINCE <jean-christophe.pince@intel.com>
Date:   Fri Oct 26 13:20:55 2012 +0200

    Change the watchdog monitor to avoid false positives

    The critical section in the run's method might lead to
    a race condition overwriting the mCompleted flag.
    Generating a false positive detection.

    Change-Id: I4460cbcca83199f9c81b4bcd6bfa04cec39271e1
    Author: Jean-Christophe PINCE <jean-christophe.pince@intel.com>
    Signed-off-by: Jean-Christophe PINCE <jean-christophe.pince@intel.com>
    Signed-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: 63690

commit a7d9958cd4678ad77c8eb6c2ec85d9396c15a8e6
Author: Fabien DUVOUX <fabien.duvoux@gmail.com>
Date:   Mon Dec 24 11:44:52 2012 +0100

    Check ProcessesReady before broadcast

    Most of the time testIsSystemReady is used to know if we are allowed to broadcast intents.
    But in broadcast intent method we check mProcessesReady flag (not mSystemReady).
    If we broadcast after systemReady flag but before ProcessesReady flag, system will crash

    Adding condition to check if system & processes are ready fix that race condition

    Change-Id: I17e42bff957164b139f85ee92ace1c5867e7265a
    Signed-off-by: Fabien DUVOUX <fabien.duvoux@gmail.com>

commit 642964c764720ea447e10aea644051f529dbfd0a
Author: Yijun Zhu <yijunx.zhu@intel.com>
Date:   Wed Sep 5 17:38:28 2012 -0400

    [Browser]UI control button first flash chaotically at wrong place when playing http live clip

    Rotating the device orientaion when playing a video in fullscreen mode,
    the controller bar flash chaotically at wrong place for a second,
    and then back to right place, Now add  a interface to hide it,
    since ensure it will get repositioned and reshow at a later time.

    Change-Id: Iea98399b43daae51d2eeb18835782e10c045549a
    Author: Yijun Zhu <yijunx.zhu@intel.com>
    Signed-off-by: Yijun Zhu <yijunx.zhu@intel.com>
    Signed-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: 38905

commit 70a6b6b042ef37715b355066a27ad9a46cfd3c4c
Author: Jian Li <jian.d.li@intel.com>
Date:   Fri Jul 20 10:34:07 2012 +0800

    OrientationListener: add SENSOR_DELAY_NOPOLL

    Add a new delay (SENSOR_DELAY_NOPOLL) to SensorManager. It is dedicated
    to WindowOrientationListener to avoid polling accelerometer sensor to
    save CPU power.

    Change-Id: I0f117f1078b2b91a54ab59fc95e059f57d005a56
    Author: Jian Li <jian.d.li@intel.com>
    Signed-off-by: Jian Li <jian.d.li@intel.com>
    Signed-off-by: Wang Zhifeng <zhifeng.wang@intel.com>
    Signed-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: 21534

commit d730b34f772d8e6566255f1d2d8b57a863ea1048
Author: Dmitry Shkurko <Dmitry.V.Shkurko@intel.com>
Date:   Mon Aug 13 19:19:36 2012 +0700

    Avoid C++0x feature

    All other sources from frameworks/base do not require C++0x support.

    Change-Id: Ib82dabd296b954bbed0657946a41053f151a6179
    Author: Dmitry Shkurko <Dmitry.V.Shkurko@intel.com>
    Signed-off-by: Dmitry Shkurko <Dmitry.V.Shkurko@intel.com>
    Signed-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: 51499

commit e02af26876657886fbba260fa4e4e9ce4b63e9e6
Author: zobject <zbjection@gmail.com>
Date:   Fri Dec 14 21:11:08 2012 +0900

    Fix NullpointException problem in onMenuItemSelected

    If both title and condensed title is null,
    item.getTitleCondensed() could be return null value
    in onMenuItemSelected. therefore need to check
    whether retun value is null or not.

    Change-Id: Ib08f52b949a794aa7bd6cc25414041e820f62969

commit 2dde5056c438bb6d305cb4eb744280ef6a0c1407
Author: Bing Deng <bingx.deng@intel.com>
Date:   Thu Nov 29 14:14:47 2012 +0800

    Catch the NameNotFoundException and return to avoid null pointer when updating package in AMS.

    Change-Id: I26cf200cc84639e1261085b6905a567320cbb0a9
    Author: Bing Deng <bingx.deng@intel.com>
    Signed-off-by: Bing Deng <bingx.deng@intel.com>
    Signed-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: 63612

commit bef007439b143fa5667c56b9e87bc2685bfeb9c2
Author: Pavan Kumar S <pavan.kumar.s@intel.com>
Date:   Fri Aug 3 12:03:01 2012 +0530

    [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: Ie86ee0a66434b7107264c79f68411196c7505a34
    Signed-off-by: Pavan Kumar S <pavan.kumar.s@intel.com>
    Author: Pavan Kumar S <pavan.kumar.s@intel.com>
    Signed-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

Change-Id: Ia189b1de29b2fbd49eaf84e21aaed2054daa50a1
Fix cast exception in dateview

Change-Id: Id6b40e3741a600cef33617369fe85f7fe09c843f
remove some lag launching apps and improve scrolling

Change-Id: Ib10c11a1a3a798e57ddd31f550461b9ebd17bc38
REVISIT: remove some lag launching apps and improve scrolling

CHANGES:
    AbsListView:
        Clear cache when aborting previous fling
    Activity manager service:
        Reduce unnecessary locking in message handler
        Move a few locks relating to idle activities from inside
            a foor loop to outside. would rather hold until it's
            done than get stuck waiting for something else to release

Change-Id: Ie59615bfad90e3d7acd4f95367248868497e172d
Avoid possible memory leaks by ensuring stream closures

Stream close() methods should always be called in finally block
to ensure we don't accidentally leak a stream.

Time to fix some old sloppy code.

Patch Set 2:
 + ensure closure of some other streams
Patch Set 3:
 + missing import java.io.IOException
Patch Set 4:
 + missing import
Patch Set 5:
 + missing ';'
 + whitespace cleanup
Patch Set 6:
 - Reverted changes to MemoryUsage (final requirement
     prevents my implentation)
 + fixed Object allocation in Root.java
Patch Set 7:
 + fixed curly bracket style violations
Patch Set 8:
 x fixed my own sloppy code :/

Change-Id: I3460b558ed5b4489296388c9a52fbb773cefd31f
Make ActivityStack hacks more conservative with their mutual exclusion, as was before.

Change-Id: I30bc63337087e198701d3f89e44e80bb22e30f1e
Tweak "smooth spinners" so small spinner works again and attempt to make horizontal bar smoother

Change-Id: I6bb8c8c3ad3503b3c1e475aba93bf8c226dcd4f0
Performance increase in thumbnail handling

Allow for 160*120 thumbnails which is what cameras commonly
generates. The constants for the micro thumbnail were set to other
values, resulting in recalculations of the thumbnais, which
takes time.

This change only affects the maximum size of the temporary image,
when choosing whether to use the EXIF thumbnail or decoding and
downsampling the full image. Without this change, it will choose
an x16 downsampling of the full image over an x2 downsampling of
the EXIF thumbnail, after the change it will prefer the EXIF
thumbnail.

Cf the DCF specifications at http://www.exif.org/dcf.PDF,
"3.3.6. DCF basic thumbnail data structure, (C) Pixel count"

Tested by running DDMS and measuring the time required to create
a thumbnail. This was 220-280 ms prior to change, < 20 ms after.

Change-Id: I59c753493f947e920bad3fde5eeed5d49d509863