Revert "SystemUI: fix long pressing notifications"

This reverts commit e9df23b638b2cff1b35d42f5b5033d24d5ae8323.
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
QuickSettings: fix GPS graphic state logic

Current logic shows the gps_off icon once the requesting
app has terminated (inUse = false). expected graphic is
gps_on. To reproduce:
1. Start with the GPS off. Tile has gps_off graphic and
   off text.
2. Tap the tile, graphic turns to gps_on, text turns to on
   (this is the idle state where GPS is on and available,
   but does not acquire satellites).
3. Start Google-Maps, once GPS is locked, graphic changes
   to gps_locked.
4. Now stop Google-Maps. Graphic will change to gps_off
   though you would expect it to return to state (2) above.

PS2: always set iconId=0 unless we have a GPS fix

Change-Id: Id044635016a848bb6bc02032b87e977ba0782f06

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java

Signed-off-by: iceandfire <arhamjamal@gmail.com>
telephony: hide needsOldRilFeature

Change-Id: I741b510fdacc166ad40741bf2e9db5c8a1039384
SystemUI: Make the HSPA+ drawables more consistent with the HSPA drawables

Though the older HSPA+ drawables are sharper, that makes them look
out of place in comparison with the HSPA drawables.

Change-Id: I76313ae0125b3a8fda928b240f33715e48f77867
Notification sound-to-vibration conversion toggle

Allows to change the new feature of AOSP 4.2, where all notification are
changed to vibrations on vibrate mode. Instead, allow the old behaviour
to silence sound notifications and to only play vibrations if desired.

Alle credits go to romanbb from AOKP, I just ported it.
Original AOKP-Commit:
https://github.com/AOKP/frameworks_base/commit/c1b2bb9b5d0c33e790973841bb2acaa5ea5d51fe

Change-Id: Id27dd2975d3383f6d7395a0ee995d7832e87ca66

Conflicts:
	core/java/android/provider/Settings.java

Signed-off-by: iceandfire <arhamjamal@gmail.com>
bugfix against missing search agent

Change-Id: Ic05ac4fa4e68bc442b57eb74a51699924dd987d2
QS: Fix Brightness, Favorite Contact & User tile FC in TabletUI
Telephony: Consider EVDO ecio zero value as valid.

When mEvdoEcio receives 0 getEvdoEcio returns -1.

Ecio valid values are positive integers, to fix this
consider EVDO ecio zero value as valid.

Change-Id: Ice8415150e7502c7f39e1a4135d35ea2bec1eb1f
CRs-Fixed: 402159
Fix WPS configuration method of BSS enrollee.

Remove keypad from WPS configuration method of BSS enrollee
becuase JB UI does NOT support keypad, only supports pbc and
display.

Change-Id: I9ab6f1514805e8307b46e38261f1c657568aeb59
Signed-off-by: Yoshihiko Ikenaga <yoshihiko.ikenaga@jp.sony.com>
Remove config_wifi_p2p_support from config.xml.

"config_wifi_p2p_support" is no longer used.
It was replaced with PackageManager.FEATURE_WIFI_DIRECT.

Change-Id: Ib57c5246b2ad218e65b4cbbb77fd37c04b5d9682
Signed-off-by: Yoshihiko Ikenaga <yoshihiko.ikenaga@jp.sony.com>
Fix possible integer overflow in MtpStorage

When converting the MB value MtpReserveSpace value to bytes there is a
possible integer overflow since 3 integer values are multiplied, even
though the result is stored in a long variable. This would be visible when
the value is more than 2 GB. This is solved by making the constants
longs instead of ints.

Change-Id: I799129f7076a6e331cece17b5c05aed210499648
Added focusable true on search_button for D-pad.

To give focus to search_button on ActionBar by using D-pad,
the search_button should be set focusable true.

How to reproduce:
(1) Open "API Demos" application -> App -> Action Bar -> Action Bar Usage
(2) Try to focus the Search View, using the D-pad.

Change-Id: Idc0b8e8d88391c152e0fc20467c23d03ab558f62
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.

Change-Id: I093227f539050a6bad8e6e8d9f533eff7bddd0d6
Navbar : Fix left over glow

Invalidate all buttons, to avoid nearby glow interference

Change-Id: I83ab05b91bd5db70390a5c9480513768864a2be7
FM Radio: Add support for FM Radio in Android

Creating interface and framework for using FM Radio
RX and TX from different vendors.

Signed-off-by: Christian Bejram <christian.bejram@stericsson.com>
Change-Id: I1a71aed01bfffdddfabf1cdfbfa3707cb1ed016b

Conflicts:
	core/java/android/app/ContextImpl.java

Conflicts:
	core/java/android/app/ContextImpl.java

Signed-off-by: iceandfire <arhamjamal@gmail.com>
Increase themeability of Clock, Signal, Wifi in statusbar

Now fixed negative numbers

Patch-set 2: Forgot cleanup log.

Patch-set 5: Compatibility with alt. signal layout

Change-Id: I6458998c37e7d9c07d389d851647bb98a15797f9
Signed-off-by: kecinzer <kecinzer@gmail.com>
Revert "Decrease lag generated by autorotation on"

This reverts commit 03c817b87272e53f047b017bc0d50739594224a9.