Wipe and re-create database on downgrade.

Not a very common situation but should fix some errors that could
 arise from flashing an old ROM over a new one, without wiping data.

Change-Id: I27f2a00396761105987830921bb3f8cb339d2171
Fix for framework reboot on format of SD card

MountService is not aware of /storage/emulated/legacy path which is
causing the issue on ExternalStorageFormatter service. We are getting
the a list of non-emulated SD cards and format the first one .

Change-Id: Iba1a9f6e40499f7f6fb095a5ee4e711b02bed439
CRs-fixed: 489037

Conflicts:
	core/res/res/values/symbols.xml
SystemUI: do not collapse panels if keyevent was canceled.

Change-Id: I9af82e9fa2305142521075938dfd05521adeb9f4
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
Fix certain setting writes being incorrectly skipped.

If a value that previously had a very long value (over the 500 char
threshold) is now set to null, isRedundantSetValue would incorrectly
return true even though the value was changed.

Change-Id: Ia5304743024ec01024be98aa51ed260d38caf93c
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
Add method to PowerManager that allows querying the lowest possible
brightness.

Used by the auto-brightness adjustment to adjust the sliders.

Change-Id: Idb58fd86dee1a053fe858291be6c9b3169ac4247
Allow adjusting progress on touch events.

Change-Id: Ide0a7ae057a62f3631a32eeaa63f3e04dec5bf54
media: Configure audio encode parameters only for valid audio codec.

Added extra check for audio codec in profile
(Cherrypicked from commit eed39d0053dee6649424867418e511b918b3c634)

Change-Id: Ie1ac5252e3d544ce61af2b3ae5080ec9c6966e44
(cherry picked from commit 81dfde16ffb3fc8f6b110a3df2921a3d3361db10)
(cherry picked from commit 8069457a313853247f2017237e29bcf3b3eb2323)
(cherry picked from commit db4bf86a6b50ce84b5a678476ee08c12f0fe272b)
frameworks/base: Add support for FM feature.

- Added changes for FM device

Change-Id: I61ab748166e3a8703054b664ba9c53da251f6b83
(cherry picked from commit fa1e277978d7bdf139fe2d790ef4a8b413d31c01)
(cherry picked from commit 2df42ca1ad2b04b9b4920d90ee60658150dfb210)
(cherry picked from commit 292b40317c470e9579bf875f43adecccc2f98b3e)
Wifi: wifi not connecting, once the APN gets disabled state

APNs are disabled on select network and they are enabled on
receiving connected event.
But forgetting an APN before the connected event is received,
will result all the remaining APN to be in disabled state and
they never connect.
So, Enabling all the disabled APN on forget network will help
to connect automatically to a saved APN.

Change-Id: I6ac5e9856d6ec0b72c089b159206abd2de98e6a3
CRs-fixed: 496165
AudioService: Don't adjust volume when vol-downing to vibrate or silent

Pressing vol-down to vibrate or silent would (previously) still adjust the
stream volume, setting the last audible volume to 0, which is not allowed
for voice-capable devices.  Thus, the last audible volume would reset to
default on reboot if on vibrate/silent or the lowest volume setting.

By not adjusting volume when vol-downing to vibrate or silent on
voice-capable devices, the last audible volume is always preserved across
reboot.
AudioService: allow volume control on analog dock

This re-enables volume control on some Motorola docks.

Change-Id: If7751867de2c0cefb5a8518b5a6a607a9676b946
Prevent audio players starting on startup.

Previously, (at least) Apollo was started on startup (in that it
appeared in the notification bar) because it listens to the AUDIO_BECOMING_NOISY
intent to silence itself in that case. This intent is broadcast by
AudioService when there's a user switch to silence any potential audio
players for the old user. As the system also sends around a
USER_SWITCHED intent on startup, this led to the aforementioned player
startup.
As the intent of AudioService was to act on a user backgrounding anyway,
send out AUDIO_BECOMING_NOISY as reaction to a USER_BACKGROUND intent
instead of the USER_SWITCHED intent.

Change-Id: Iba35844a1274c9dd195f104068304e6a7ffa809e
AudioService: Restore volumes after boot and when a headset is plugged

The correct volume levels for <device>_speaker and <device>_headset are not
restored after booting and when a headset device is plugged in or out.

This fixes a glitch where the first volume change event causes the volume to
be reset to the last stored value instead of increasing/decreasting it by
one step.

Change-Id: I6a483af34fd6d9dd706c6979202bf0cf26d80854

Conflicts:
	media/java/android/media/AudioService.java
audio: Add overlay to fix analog docks.

Of particular interest to devices using libhardware_legacy and
affected by commit 5a484b753cc72d6a50c1dd3bbf68b3403c741a3a: http://goo.gl/rVR1Z
which restricted the routing of AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET
to docks using FORCE_ANALOG_DOCK cases. The EXTRA_DOCK_STATE_CAR case is
returning FORCE_BT_CAR_DOCK, preventing the dock audio from routing properly.

Add an overlay option for overriding to FORCE_ANALOG_DOCK.

Change-Id: Ib7d70c242aa6f537ea5d65098ceb2c591662d8bb