ActivityThread: Avoid creating duplicate handlers and reuse mH

sMainThreadHandler is used for notification of changes in
SharedPreferences and refers to a new instance of Handler instead
of the existing instance, mH, of the ActivityThread. Fix to reuse
existing handlers associated with main looper.

Change-Id: I794a5802a9eacdb188bd0619db5e70e3ae89a07d
VibratorService: Fix to ensure actual delay in a vibrate pattern

delay might timeout early as value of duration isn't updated
correctly in the loop, should the wait be interrupted, to reflect
the elapsed time. Fix is to update duration in the loop.

Change-Id: I525b0e97799b288f46ae3a056cff7dcc69701bb0
Avoid system_server crashing due to mac address is null

It's possible that the mac address is null (getMacAddress() of WifiNative.java).
In this case system_server will crash like:

E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: WifiWatchdogStateMachine
E AndroidRuntime: java.lang.NullPointerException
E AndroidRuntime:        at android.net.arp.ArpPeer.<init>(ArpPeer.java:57)
E AndroidRuntime:        at android.net.wifi.WifiWatchdogStateMachine.doArpTest(WifiWatchdogStateMachine.java:866)

Check the mac address before parsing to avoid crashing.

Change-Id: I5d4205c04d479a3a2837172c6382816ea4bf74d6
WifiStateMachine: ignore auth-fail event during WPS connection

Disregard auth failure events during WPS connection. The EAP sequence is
retried several times, and there might be failures (especially for wps pin).
We will get a WPS_XXX event at the end of the sequence anyway.

Without this change, the SupplicantStateTracker class will disable
the WPS network we are connecting to after 2 failed authentication events.
Then, even if WPS succeeds, we will never connect to the selected network.

Change-Id: I57c8e508bfd738405b7f2c2c2325df7838e1b4af
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
Protecting more views from (bad) MotionEvents

When handling MotionEvents, the method findPointerIndex can return -1
if the current pointer id can't be translated to a pointer index.
Some views are not handling this, which will lead to an out-of-
index crash. In 2585e9b there were checks added, this change adds
some more.

Change-Id: I93ce2420afd83a06b689a1ed35ead7d170cd68f1
Fixes relative time formatting issue for dates in future

All variations of getRelativeTimeSpanString() now properly handle dates
that are in the future. Prior, the version used by
getRelativeDateTimeString() would occasionally show the time instead of
a date when the future date was the same weekday as the current weekday.
This resulted in the time output being duplicated, eg.: "11:23, 11:23"

Change-Id: If20972a6942cce792fa233437f94dedfb71379f3
Signed-off-by: Steve Pomeroy <steve@staticfree.info>
Make setCaptureRate locale safe

Dont use the default String.format in setCaptureRate as it is both
locale unsafe and less efficient than regular string concatenation
in this case.

Change-Id: I29418ec0352ef8c79967592b6eb8ff66cc9c99f0
Make addAddress locale safe

Using regular string concatenation to avoid unexpected
results in some locales.

Change-Id: I47dd5e174c4a2e88dc18e014002820cdbf63fcad
Make SimpleSessionDescription locale safe

Explicitly use Locale.US in SimpleSessionDescription to avoid
unexpected results in some locales.

Change-Id: Idb4a36a9e332d302e1b9b940355917c0f738e076
Default WiFi sleep policy setting

Creates a defult.xml setting for WiFi sleep policy.

It is now possible, through device overlays, to change
the default sleep policy to e.g. never in order to improve
user experience of WiFi.

Change-Id: Ie459b8e70fdbc7c605452fe0692d7bc26460e939
onSavePassword dialog can leak when WebViewClassic is destroyed.

The AlertDialog creates in onSavePassword method leaks if
WebViewClassic is destroyed when the dialog is shown.

Change-Id: I81f20e1dd138467a6413766c0a081b389b334ae0
[webkit] Runtime enablement of WebGL

Hook up debug setting to enable/disable WebGL.

Change-Id: I46790e61471a76eb5a8d8ff552022e12c3782204
net: customize memory cache size

Change-Id: I2b7cc83707a567676550be2639095c5bb28dc6dc
webkit: Multimedia feature port from ICS

- Multi-context HTML5 video support
- Smooth inline to fullscreen video transition
- Support for autoplay, muted, loop, preload attributes
- Support for web pages with more than one audio element
- Support for HTTP live streaming

Change-Id: I82b01295da4663437d5c35eb45d145b243ecc9f1

webkit: HTML5 video user experience and stability fixes

- Fix HTML5 video unable to resume from navigation history
- Fix occasional crash when reloading page from history
- Show last decoded frame of streaming video when buffering
- Fix incorrect fullscreen video position during orientation change
- Replace HTML5VideoView resetted state with released state
- Remove unneeded videoLayerId in HTML5VideoView
- Resume from last played position after video suspend
- Call MediaController::show() during HTML5VideoView play and pause
  to update fullscreen MediaController state

Change-Id: I82f1255225b2ee6cc95f70e40017d562e5e635c6

webkit: Fix black screen shown during webkit exitFullscreen

Notify WebChromeClient to hide custom view during exit fullscreen.

CRs-fixed: 387484

Change-Id: If67cc000991d9fa0696692ce3982e0a04499e343
Remove opaque check in GLRenderer when preparing dirty region.

Since preserved swap is enabled, we need to clear the color buffer
when the scissor rect is prepared for a new process. This prevents
garbage to be present from the previous process in the color buffer

Change-Id: Id9aa90c5008ffa08d6a27a568fc205538db680b8
hwui: Disable framebuffer discarding for exynos4 devices

Change-Id: I27671f1dfc32f19dc792b9b13c328247e2b7b5fc
input: Add workaround for broken hardware keyboard support

* Add workaround var for devices with broken kernels
input: Fix workaround for broken hardware keyboard support

Using a wrong reference to mHardKeyboardAvailable caused device config
to never report physical keyboards.

Change-Id: I9b64e2d89512436c17fa8929464e2b727fba1cf3
Separate configuration of auto-brightness for button/keyboard backlights.

Presently, light-sensor based automatic brightness
(config_autoBrightnessLevels) controls both button and keyboard
backlights in addition to the screen backlight.  Unfortunately
auto-brightness for button/keyboard backlights doesn't work well on
devices (e.g., epicmtd) with neither (i) dimmable button/keyboard
backlights (so when they're on, they're very bright even if the screen
backlight is relatively dark) nor (ii) identifiable surface features on
capacitive buttons (so they can't be found if the backlights are
permanently turned off).

For these devices, the non-auto-brightness behavior of button/keyboard
backlights, whereby they turn on during screen-on events and user
activity and timeout-to-off shortly thereafter, is preferable.  Thus,
this commit adds a config option, config_autoBrightnessButtonKeyboard
(defaults to
true), that when disabled allows for automatic brightness control of
the screen backlight, but retains the timeout-based behavior for button
and keyboard backlights.

Also addressed is a bug that disables the button and keyboard
backlights on screen unlock, and reenables the backlights on touch
events so that capacitive keys may be located.

Additional fixes for button/keyboard backlight auto-brightness.

- Use sensor-determined brightness values when the button and/or
keyboard lights are on, even if button/keyboard auto-brightness is
disabled, since users may want to specify a custom brightness setting
that disables the button/keyboard backlight entirely in low-ambient
light situations.

- When button/keyboard auto-brightness is disabled, don't update button
and keyboard brightnesses immediately if ambient light (the sensor)
changes, as this may reactivate these lights after they've turned off
in absense of user activity.  This is a particular problem when
watching video or other circumstances when the lights are not expected
to reactivate.
frameworks/base: support for qcom application tiling

Support for tiled rendering, can be disabled or enabled with
debug.enabletr property.

Change-Id: Id49301f9dbafc6ef2e44170c95818caee199c03c