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

This reverts commit 061e6a372321a907486f25c799d1d159da0dced7.
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>
docs: fix broken youtube playlists

Change-Id: I07a1e9af2c8104a56c9a5e6d1060de7578cbd1ae
MediaCodec: Allow getting the chosen component name

Currently, when the codec was opened by createDecoder/EncoderByType,
the caller does not know what codec actually was chosen, and
(for encoders) thus cannot know what color formats it supports.

This adds new public API.

Change-Id: Ie471f40f8104b37d27ced3dba5a54facc6504b1b
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>
Add return after NULL check in JetPlayer

When pointer lpJet is NULL, it should return.

Change-Id: Ia0471173b57da8f9bf22b3a19479aa5b3c4a5acb
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
Fix EventLog string class problem in onOptionMenuSelected

EventLog function can handle string,integer class and long class. (in android_util_EventLog.cpp)
If menu title string are used bold tag(like <b>test</b>), it'll be android.text.SpannedString.
In onOptionMenuSelected, it is using item.getTitleCondensed() function for writing event log.
therefore any android activity using tag menu string(like <b></b>) can be crashed by IllegalArgumentException.

I found this crash on GMS Application.
change locale chinese -> launch Google+ -> hangout -> menu key -> Invite(expressed chinese) click -> Google+ crash

Change-Id: I0437be81699925e29bf4510eb615ef2424432763
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
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>
Revert "MediaCodec: Allow getting the chosen component name"

This reverts commit 056ef2ed5ff92b742fe53f2498c596ec1f6bed3c.
[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
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: I4fd6e0b1397331c9db7627edbbca75d572aa8a4e
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

Conflicts:
	core/res/res/values/public.xml
Fix NPE during startup when battery is low

During startup the mConfiguration in the ActivityThread for the
system_server process is null until the CONFIGURATION_CHANGED
message is received. This message is sent by the
WindowManagerService.PolicyThread (and later another one is sent
by the SystemServer.ServerThread). If the PolicyThread happens to be
scheduled a bit later for some reason the LAUNCH_ACTIVITY message
for the ShutdownActivity will be received first, causing a NPE in
performLaunchActivity when executing new Configuration(mConfiguration);

Change-Id: I004b02038ba0e55ded399b3b2fe5b74ad0a76c78

Conflicts:
	core/java/android/app/ActivityThread.java
Phone browser application stopped while connect BT headset and wsheadset browsing video streaming.

If we tap the full screen button quickly in video playing webpage,
first play is playing and enter to full screen mode,
and second action will check first play status and release something,
 so the error happens, when play same videos,
I add free action and set flags to default
before we start to play second video in full screen mode.

Change-Id: Ia980cc1b77f983bce0fbd0c04931a4627d819e96
Author: Bin Xu <bxu10X@intel.com>
Signed-off-by: Bin Xu <bxu10X@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: 44018
Press button on Wired Stereo Headset while httplive audio playback in black screen, music playback automatically.

The key event is handled by media controller,
If media controller is hidden, the event can't be handled.
Try to make vedio view handle the event when media controller hidden.

We only handle media control key events when in fullscreen,
otherwise the Back or Menu key will be handled by MediaController.

Change-Id: Iccfaf6f47a135d0ace32ec253c400fd82ed877d1
Author: Weiwei Ji <weiweix.ji@intel.com>
Signed-off-by: Weiwei Ji <weiweix.ji@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: 29426, 46540
[Browser] Video can not continue to play after wake up.

Save the time to make the player continue.
While playing, lock-screen will make the play paused, the time is not saved,
so it will play from beginning after unlock screen.

Change-Id: Idc57b994854bdc25c1d5a15594e3904a3f78ec26
Author: Bin Xu <binx.xu@intel.com>
Signed-off-by: Bin Xu <binx.xu@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: 26444
[ACS-Monkey] Javacrash java.lang.NullPointerException in com.android.browser.

Provide a WebView interface in WebSettings, for BrowserSettings need to access it.

Change-Id: I375561867f3eb05681d579dfa173b5e298f7649e
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: 34962
Fixing NullPointerException in TextView

Adding null pointer protection for layout that fixes some force closures.
Signed-off-by: Dmitry Tsyganyuk <fdt017@motorola.com>

Change-Id: Ia9039912aafa76090da9016a0fb3ee4d6774caef
Fix: Notification LED will not turn off without Keyguard

The problem is that there are cases where the screen turns on,
but there is no Keyguard:
1) The user disables the LockScreen from the Settings.
2) Following the auto screen-timeout, there is a grace period
   (~10 secs) where the Keyguard will not activate after the
   user presses the POWER key.
In those cases, the LED will continue to flash, with the screen
turned on, until the user explicitly acknowledges the notification.
This is redundant (since the user can see their notifications in
the status bar) and a waste of power.

Change-Id: I9a3319be0c3e6dd3baf5691515259e7f08baf217