Ensure running mTouchModeReset when AbsListView is detached

mTouchModeReset should be executed when AbsListView is detached from window.
If not, when the AbsListView is re-attaced to window,
the child can retain a pressed state.

You can see this problem easily when you double-touch an item of
option menu very quickly.

Change-Id: I5aaa1fd5b95847efb2f5f1b5ec7cabe8eb85b237
Signed-off-by: Sangkyu Lee <sk82.lee@lge.com>
Leak in ToneGenerator_native_setup

Failure in ToneGenerator::isInit causes a leak.
lpToneGen should be deleted.

Change-Id: I48df7a328fed01be8412d5449ee0753dad3c101f
convert jint to uint32_t.

This works around a compiler bug, and is probably more
correct anyway.

Change-Id: I1c49064bd64c31dafae560e416c665de0449f245
Fix regression in ListView click handling

Regression caused by patch a607223f34

If an item click handler results in the ListView becoming detached
from the window, the performClick runnable could be executed twice.
Null out the mTouchModeReset runnable before running the click handler
so that it is not run by the detach handler.

Change-Id: I2fab60232027bb4876f9912088e0ffb9b17d308c
Add return after NULL check in JetPlayer

When pointer lpJet is NULL, it should return.

Change-Id: Ia0471173b57da8f9bf22b3a19479aa5b3c4a5acb
Make implementation of isEmpty consistent with implementation of getCount in HeaderListViewAdapter

Fix for Issue ID 18316. Make isEmpty() return false when getCount() returns a non-zero value. So that the list cannot be considered empty when a header or footer is present.

https://code.google.com/p/android/issues/detail?id=18316

Change-Id: Ib69201e9d5ef3efcbb68ea298b8cc8ca6e027246
Signed-off-by: Emma Sajic <esajic@effectivelateralsolutions.co.uk>
Return error upon attempt to use non-existent APN

startUsingNetworkFeature will ignore errors from
reconnect - causing ConnectivityService to send
faulty information back to requester.

Change-Id: I4e0fcc1addd84da409cdc1eed1a95d25d925e020
Fix logging typos in GpsLocationProvider

Change-Id: Ibf12947f3758defee990fbf685323334b8d1eeda
Signed-off-by: Magnus Eriksson <eriksson.mag@gmail.com>
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>
Allow purging of asset bitmaps

It seems that neither CM9 nor CM10.x includes the actual framework-side
code to facilitate user-controllable bitmap purging. Odd, since the
CyanogenMod Settings app in both CM9/CM10.x includes the option.

Backported from original Gingerbread commit:
http://review.cyanogenmod.org/#/c/3908

Original description:

Allow the system to reclaim more free RAM when needed on 'low' memory devices
(e.g. Droid/Milestone) that are struggling with 2.3. This option enabled
efectively restores the froyo way of forcePurgeable BitmapFactory asset
handling.

Change-Id: Ia7efca91fb74dda39f4d176875ee8a66bb34509d
fix NoSuchElementException error with CPU ProcessStats

Credit to Eugene373

p2: update commit message
p3: cleaned up tabs
p4: also added aosp changes from this commit - https://github.com/android/platform_frameworks_base/commit/ca894b396b93344ac255746e12730cb269d4d856

Signed-off-by: Jonathan Steadman <xxwhitehawk@gmail.com>
Change-Id: I3c71dbd5fb8e42811c47d6431003101943cb388a
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
A tiny optimalization

Change-Id: Ib2cb773ffe5cb579c2b46bd0e6a5a3f2c55d190d
bootanimation: performance enhancements

This patch implements two simple performance enhancements, which
might benefit devices. They are completely opt-in by setting
the following variables.

  * TARGET_BOOTANIMATION_PRELOAD: will preload the bootanimation
    zip to memory; this is handy on devices where the storage
    might be slow. By preloading it, we get quick access to the
    zip file, and the animation doesn't stutter.

  * TARGET_BOOTANIMATION_TEXTURE_CACHE: allows maintainers to
    force texture cache on/off.

Also fixes the sign warnings related to int / size_t comparison

Change-Id: Ie92d1b0aa90b43ba39c368a2a33657a60c3a64b5
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
PackageManager: fix app lib migration for device with /datadata

For devices using /datadata, dataPathString will point
to /datadata while nativeLibraryDir will point to /data/data.
Thus, compare to /data/data directly to avoid problems.

Change-Id: I11149cf9cc5a573cc85513e12d3569b514f5ffb5
Revert "fix potential memory leak"

This reverts commit bc268b9014f211910e412a7fda96b6394ff2badc

Change-Id: I07f49bd0cfecc43bc761d2b0635c9915a8e30272
Use most specific attributes for distinguished name display

Bug: 7894348
Bug: http://code.google.com/p/android/issues/detail?id=41662
Change-Id: I8048a53b8a9a17b384f12b6a4f40071bb3dd3e04
Correcting typo in doc of MEDIA_XXX intents

Correcting typo in documents of MEDIA_MOUNTED,
MEDIA_UNMOUNTED,MEDIA_UNMOUNTABLE intents, which
may be confusing to APP developers.

Change-Id: Id909b7bfad98e305b8054978f054f4fb9b705311