DockAudio: Route audio via dock for Samsung devices

This patch simply removes the audio routing checks for Samsung
devices and routes audio via the dock when the mobile is docked.

There is no option to disable audio routing out through the dock

Change-Id: Ie3f99101b051326913d06f1c78894d50035f6e62
Revert "platform: Remove mapping of android.permission.CAMERA to camera group"

This reverts commit de1e404d570dd03529c1e4e8ffbbce432e8be4a2.

Change-Id: Ibc62cb0fc9992e6676ed2af9f1718d28257f65d0
Rework thumbnail handling

Since ids of media file are usually not continuous, the original file of thumbnail are
sparse. When there are big numbers files on ex\
ternal storage, the size of this file will be horrible.
Ex, when the id is 20000, then the .thumbnails/.thumbdata3-xx file will be 50000*10k = 488.28M.
Can refer http://stackoverflow.com/questions/12396715/android-huge-thumbdata4-file-in-dcim-folder
Because after 4.0, MediaProvider will scan any files, this will be a big problem. So I modify MiniThumbFile.java to avoid this.
According to the id, we now produce an index file. In this index file, one id will use BYTES_PER_MINTHUMB_INDEX(8) bytes in offset (i\
d+1)*BYTES_PER_MINTHUMB_INDEX. The data of these 8 bytes is the index of thumbnail file. The first BYTES_PER_MINTHUMB_INDEX bytes kee\
p next available index. And when you need insert a thumbnail, the index increase by 1. In this way, the block data in thumbnail file \
will be continuous. And thus unnecessary zero paddings will not be saved.

Change-Id: I66005dd69b0a5c8f4353bd7a8225d163a654fd2d
Fix for Concurrency issue reported in  525529

List of services mainted by ActivityManager may get
updated/iterated concurrently if serviceTimeout() is
scheduled simultaneously with launch/stop of new services
for the same package.To fix the issue ,iteration of
proc.executingServices set in serviceTimeout() is synchronized
with same lock used by updating the set during
start/launch of service.

CRs-fixed: 525529

Change-Id: Ic230ad0d16e6ec64a20cf394aa1c1ce777c37a2b
services: Fix the bug in NFC shutdown logic

nfcOff should be checked for NFC shutdown instead of radioOff,
which is used for radio status.

Change-Id: Iafd620dc89ae8bed7855e313676527d4de32cb7c
base: App crash when select suggestion's length more than specified.

App crashed by catch IndexOutOfBoundsException which raised
by check span range when select suggested string.The root
cause is that the editor will truncate the suggested string
which length is more than it specified, but it also set span
use the suggestion's original length.

Update the suggestion's real length after editor replace the
original string to suggested.

Change-Id: I2d765701934a9e68be172cb87a104590f3cdeceb
CRs-Fixed: 532211
Audio: Fix abnormal keytone playback during silent mode changing

Change-Id: Icfc4003c9756b3c33578c137e59dc4a2b4f25647
Author: Chenyang Du <chenyang.du@intel.com>
Signed-off-by: Ertao Zhao <ertaox.zhao@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: 19084 4898
PackageManager: Let system-defined permissions take precedence over settings

If a permission was already present in the device's settings due to having
no prior system definition, and the system tried to take it over
(after a version upgrade, for example), it'd fail, since the saved
value would clobber the one previously read from the permissions XML.

This breaks system-behavior changes (gid grants, in particular) unless
the user performs a factory reset after upgrading, which isn't acceptable.

Change-Id: If2e44110f6db735ad29cdf1086e814bd1299e290
Revert "base: App crash when select suggestion's length more than specified."

This reverts commit dcf75fbfd06c6a940e4124550edd19e191656047.

Change-Id: I6d236f16e9c428b06caf4423903839d54cf24bd0
PackageManager: Limit the platform-key protection to test-keys builds

This block (change I7390b3bdf5289411f7a335c69635bed9f74bbfb3) is intended
to protect the system from abuse of well-known keys. That's not the case
if the system is signed with dev or release keys.

Change-Id: Ifb66f775dd28c577447634ae177442732a18b592
Add Motorola EMU audio dock jack sensing support

Don't route to dock output just because the device is docked.
Let the actual jack presence to control it.

Change-Id: I4066d08b1aa58ead39aad9410b9dd71624776187
server: add enhanced routing support

Add support for policy and metric based routing APIs to
NetworkManagementService. This functionality is used for WQE, IMS, and
Android QoS features.

Change-Id: I5e50185c9ac1cf72c9366815c2ecf590842edfca
frameworks/base: IPV6 tethering support

This patch adds two new API calls addUpstreamV6Interface and
removeUpstreamV6Interface to the tethering framework to pass the IPv6
upstream and downstream interfaces to netd if IPv6 is available.
Required to enable ICMPv6 forwarding.

Change-Id: I1f4f6284b2f152d8b4f0fbd02ac5a17f57c71dd7
frameworks/base/: Fix black wallpaper issue when home pressed.

In the specified usecase, there is a completely new set of
windows that appear on the screen during rotation. And the
existing code in the framework ignores the drawstate of the
hidden windows.

Wait till the drawState is ready for the hidden windows also.

CRs-Fixed: 521758

Change-Id: Ibd96502059c84210ad84ecb03aac5eca28f3c9fe
IPV6 tethering: Check info for null before removeUpstreamV6Interface

When tethering on dual stack networks such as verizon wireless and
sending or recieving MMS you get an null pointer exception and hard
reboot.

It starts to go wrong here:
10-14 19:11:51.375: E/Mms/smil(28035): Failed to parse SMIL document.
10-14 19:11:51.375: E/Mms/smil(28035): org.xml.sax.SAXParseException:
expected start tag notEND_DOCUMENT null@1:1 in java.io.InputStreamReader
@4192ada0

And then:
10-14 19:11:55.559: E/AndroidRuntime(23125): java.lang.NullPointerException
10-14 19:11:55.559: E/AndroidRuntime(23125):    at com.android.server.
connectivity.Tethering$TetherMasterSM$TetherModeAliveState.processMessage
(Tethering.java:1573)

Which is line 1573 of:

https://github.com/CyanogenMod/android_frameworks_base/blob/cm-10.2/services/java/com/android/server/connectivity/Tethering.java#L1573

CMD_UPSTREAM_CHANGED's message.obj can be null (line 776).

Change-Id: I13d531d398f2e33a828c6e81f25f4b2a27518d34
Camera: Video HDR Feature Integration.

Added framework support for camera applications to query supported
video HDR modes and set the required mode.

Change-Id: Ie318e586838a2f035e59e30fa51af35b52f7c886
Camera: Adds support for meta data callbacks

- This change adds a new type of callback
  that will be called when there are pending
  meta data notifications.

Change-Id: I84f5cbafe4f023c7b0efa9ec8620756b0eaa428d
Fix merge derps