LegacyUSB: Add support for legacy USB implementations

Change-Id: I029d8eeca4de6d92499856feab2761a8bfa9a526

Conflicts:

	core/res/res/values/config.xml
	services/java/com/android/server/usb/LegacyUsbDeviceManager.java
	services/java/com/android/server/usb/UsbService.java
FM: missing stream channel

Change-Id: I429ca6a67ef544180b64bcee41582716f99c5e56
force usb legacy sysfs paths and fix the lun file

Change-Id: I06aae9536a9824f53de3aaecb8ba3e3c986167bc
HW Video Codecs

Conflicts:

	include/media/stagefright/OMXCodec.h
	media/libstagefright/OMXCodec.cpp
Revert "force usb legacy sysfs paths and fix the lun file"

This reverts commit f6bc0e27548fd32ace10abf1aeaf8fc90fbb9670.
LegacyUSB: add overlay for UMS lun and use existence of lun to enable legacy USB #2

Change-Id: Id14f70f7e21b689c08cadef69f69da711c7dc566

Conflicts:
	core/res/res/values/config.xml

Conflicts:

	core/res/res/values/config.xml
Fix already present
Add LegacyUsbDeviceManager::setCurrentFunction method.

Method implementation is the same as UsbDeviceManager::setCurrentFunction.
The override is required to use LegacyUsbDeviceManager's mHandler, as
UsbDeviceManager's mHandler is an uninitialized private field.

Change-Id: I9ffece5247c17de77fa799e1f6c9b439ebd074db
1% step battery
add MotoWrigley3GRIL

to fix:
- outgoing call identification dependency on Caller ID setting
- supplementary service notification issue known from gingerbread

Change-Id: Ic17b52e4abf5bf44a585e58bd6cb6e4863041a87
Keep track of tetherable USB interfaces in both up and down link states.

USB network interfaces that are present-since-boot are never issued "added"
(or "removed", for that matter) notifications from netd, and thus, are only
discovered by Tethering when their link state changes.  Prior to this
commit, such interfaces were only tracked on change to "up" link state,
even though the interfaces were _not_ removed on changes to "down" state.

On some devices (e.g., epicmtd) a change to "up" state only occurs after
(i) IFF_UP is set on the interface, (ii) the rndis USB gadget function is
enabled, and (iii) a USB cable is connected to another machine.  Since
rndis is enabled immediately before the start of USB tethering, the "up"
state is achieved asynchronously, and often _after_ Tethering looks for a
tetherable interface.  However, "down" state is synchronously reported when
IFF_UP is set, and thus, serves as an effective mechanism to notify
Tethering about the existence of the interface.
Add support for using a custom USB management service.
Add support for USB tethering interfaces that are always present.

Previously, the state machine assumed that the USB tethering interfaces
appear/disappear when reconfiguring USB or changing the USB status. Add
some fallback handling for devices where this isn't the case.
Some fixes for custom USB service handling.
move vendorServices config to arrays.xml

Change-Id: I38abdea64bd1ae15349a944a0c43216e508e1903

Conflicts:

	core/res/res/values/arrays.xml
	core/res/res/values/config.xml
Use the Hotspot driver call from WIFI HAL

Change-Id: Ie27de1c073681e92ba1602dcd40ef1aa297fd4f4
Allow customization of SoftAp

Support for device with SoftAp only relying on one interface.
Support for device with SoftAp that does not required manual firmware.

Change-Id: If2db6e8ce675c3214ce645231c7a354f41ea0cc6
Fix a couple of nasty heap corruption bugs.

- When replacing the buffer pointer with another one, the allocated
  length wasn't updated. As the TI encoder relies of those being matched
up (it e.g. does a memset(pBuffer, 0, nAllocLen) at certain places), this
could lead to random memory being overwritten (or to a segfault when
reaching the end of the mapping)
- When replacing the buffer, the old buffer wasn't saved and restored
  before calling freeBuffer. This led to a different address passed to
free() than was returned by malloc(), could lead to all kinds of weird,
undefined behaviour.

Conflicts:

	include/media/stagefright/OMXCodec.h
tether: Link to legacy wifi for tiap_drv module based wlan #5

remember to add this in system.prop :
  wifi.hotspot.ti = 1
  wifi.ap.interface = tiap0

and in the frameworks overlay :
  <!-- whether Softap rely on a different interface (beware these flags can be badly understood) -->
  <bool name="config_wifi_ap_use_single_interface">true</bool>

  <!-- Dont reload the firmware via the framework, let wifi legacy and tiap_loader do that -->
  <bool name="config_wifi_ap_firmware_reload">false</bool>

Change-Id: I248d9e5c929386f5e03efa1dde6eafa56c38f5c7

Conflicts:

	services/java/com/android/server/NetworkManagementService.java
Fix buffer overflow and make code a little more readable.

Conflicts:

	opengl/libs/GLES2/gl2.cpp