selectable text in gtalk

Change-Id: I9fe3634dfdc64cb37ece7f431d12845c164d639b
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
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
Don't add tint to app icons or custom images
http://gerrit.sudoservers.com/#/c/4663/
SystemUI: more consistent nav tinting behavior
http://gerrit.sudoservers.com/#/c/4905/
Re-use existing thread

Bug: 7377541
Change-Id: I097f2288ebfc2b4a9782cbced19d9c36d0703acb
Reduce jankiness of the transition between a text field with FLAG_NO_FULLSCREEN and a text field with FLAG_NO_EXTRACT_UI

Bug: 7393485

Currently, the extract text view blinks at the transition of InputMethodService.
This change reduces this blinking by making the extract text view invisible when the extract text view is hidden.

Change-Id: I9af96058283a9a5b60707d025ad1abbbbc23c16f
Optimize drawHardwareAccelerated method in Editor class

When inserting a new line or breaking a line,
every display list was invalidated and rebuilt before.
However, we can reuse the display lists above intactly and also
reuse the display lists below with only updating drawing locations.

This patch reuses the display lists if possible.
The display lists above the inserted line are just reused
and the display lists below are reused with only updating
drawing locations not fullly rebuilt.

mIndexOfFirstChangedBlock is the index of the first block
which is moved by inserting or breaking a line.
So the display list whose index is >= mIndexOfFirstChangedBlock
only needs to update its drawing location.

Change-Id: Ica20deb0ebb5750de21356ed31fa9f86e657ff92
Signed-off-by: Sangkyu Lee <sk82.lee@lge.com>
Fix autorotation sensor loop being reactivated even when off

The sensor loop was reactivated even if turned off after a wake up
=> consider it disabled also if !mEnabled
+ turn debug mode on in case there's another issue.

Since the current autorotation sensor loop is generating 3-4% cpu eating,
we really need a way to turn it off for good for the moment.
System_server now seems to stay at 0.0% cpu with this change & autorotation off on TF101

Change-Id: I5ed3c95809f6d789222819466dacc625ac2d9f1d
Decrease lag generated by autorotation on

There are different issues from what I understand:

1) Discarding of events too close to each others is broken
as mAccelerationTimestampNanos is conditionned by isAccelerating()
on TF101 no events are discarded anymore, and so it creates an update every ~50ms
filing up the android notification message queue quite a bit for nothing and so generating lag.
2) isAccelerating seems incorrect to me too, the code means more that it's accelerating "out of range" and should be discarded in that case.

=> Discard the sample if outOfRange and don't condition the update of mAccelerationTimestampNanos that way next time we come back "too soon"
the sample will be properly discarded.

3) with events being discarded properly on the WindowOrientationListener
the SensorManager can now update every 20ms instead of 50ms
but that is definitely overkill.
=> add SystemProperty sensor.loop.minms with a default value of 50ms to throttle the notifications.
That way the thread sleeps properly instead of sending events as fast as it can.

(increasing up to 100ms can be ok depending if you want faster response or not.)
This can be positionned on a per device prop too.

4) Add 2 SystemProperties:
one on the SystemSensor side: sensor.magnitude.threshold with a default 0 value(doesn't change the behavior)
one on the WindowOrientationListener: orientation.magnitude.threshold with a 200 (0.2G) default value
These allows to discard the sample if it is too close to STANDARD_GRAVITY (ie not accelerating much)
These can be set on a per device or use the default values.
On the TF101 200 works most of the time. But weirdly when docked the reported gravity seems to have an additionnal offsert of -0.2
maybe some magnetic interference from the dock...

For the moment the 0.2G threshold is positionned on the Orientation code.
Once the cpp sensor poll crazy loop is solved it could be better to use the sensor.magnitude.threshold instead.

That should take care of most of the lag generated by autorotation.

PatchSet2: position default SystemProperties values to do nothing.

Change-Id: I093227f539050a6bad8e6e8d9f533eff7bddd0d6
Reduce debugging - PhoneWindowsManager
installd: Delete cache properly for devices using datadata partition

The java side already checks /data/data for free space but installd
still checks /data causing it to never reap the cache (because it
thinks that enough free space is available.)

Change-Id: I736af6ff7ea0c8ae07900168f6b8ac2f7a4dbe0b
Monitor device storage directly in /data/data

The DeviceStorageMonitorService watches over /data, and when things get
full, starts deleting app cached files.  The app caches are actually
under /data/data, which on DINC is its own mount.  This means the
monitor did not notice when app cache grew too big, as it only saw the
size of /data proper.

This patch makes the monitor look at /data/data instead.  For DINC, this
means it can properly manage app cache, but it won't notice if the upper
/data partition is getting full.  That's not as common as /data/data
filling up though.  For the Samsung devices that mount a /datadata and
then symlink to /data/data, it should also work, as statfs dereferences
links first.  For all other devices with only /data, reading statfs on
/data/data still yields the total/free sizes of the /data partition.

Change-Id: I118a85a04c3a257d54d40ce7802426b4e0fe3e87
Audio: Fix abnormal keytone playback during silent mode changing

Change-Id: Icfc4003c9756b3c33578c137e59dc4a2b4f25647
Author: Chenyang Du <chenyang.du@intel.com>
Signed-off-by: Ertao Zhao <ertaox.zhao@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: 19084 4898
Fix for breakText returning count of glyphs not chars.

Paint.breakText should return the number of characters measured to a given maxWidth, but it returns the number of glyphs instead. The solution loops through the advances and whenever if finds an advance with length bigger than 0 decrements it until reaching zero or the end of the advances. The advance has a zero when a glyphs is for more than on character, for the subsequent characters. The width of the glyphs is added at the first character.

Change-Id: If26fca3a08133d08572dfda1e33536cc0bd8b1e5
MediaScanner: delete abnormal elements in prescan procedure.

There is a race in MediaProvider's mUnmountReciver.
when it doing external storage's database clean up at power down procedure,
if the datebase is big, system may shutdown after db.update, but db.delete
not done, there will be many elements with no filename in the database.
That may cause duplicated files and folders shown in MTP.

This patch clean up these abnormal elements in MediaScanner's prescan procedure.

Change-Id: I0a3dacffd12892b1a2a892b2749a02ab3dea109b
Author: Liang Wang <liangx.wang@intel.com>
Signed-off-by: Liang Wang <liangx.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: 58969
Remove unnecessary reference in ActivityManagerService.

Remove referencing mHander in itself. Make message codes simpler.

Change-Id: I996f2805e99297bbc11d8c156560a01017e1ac3c
Disable usage of WAL in DatabaseHelper

According to SQLite documentation, WAL can not be used when database
partition is not accessible for writing (even when the client just
performs read operation).
However, such situation may happen when the partition is full.
As SettingsProvider should always be able to read a value of ANDROID_ID
from corresponding database, this commit disables usage of WAL.
Without this we risk ending up in a situation where /data is full
and the phone is unable to boot properly.

Change-Id: I1f79bbcd8d0f64bf35dc9d7b846bcfb2664d2eac