Allow pre-configured device pairs to switch mountpoints

Original CM patch by Ricardo Cerqueira <cyanogenmod@cerqueira.org>,
message from commit dc8d157d73fb88ee33b38e724a8aabe7d5e53eee follows:

  The use-case for this are devices with internal extended storage
  (pseudo-SDCard emmc) and an actual microSD card reader.
  In CM, we choose to use the microSD as primary storage, and leave
  the internal partition mostly unused; some users usually come up with
  imaginative and data-destroying ways of working around that.

  This allows us to specify a pair of mountpoints which can be
  switched from a user preference. For this vold.fstab:

  -----
  dev_mount sdcard /mnt/sdcard ...<path-to-microSD-sysfs>
  dev_mount emmc /mnt/emmc ...<path-to-emmc-partition>
  -----

  We can add to build.prop:
  "ro.vold.switchablepair=/mnt/sdcard,/mnt/emmc"

  A persistent toggle (persist.sys.vold.switchexternal), controllable
  through CMParts, can be presented to the user to allow choosing
  something other than our default as primary storage.

In Android 4.4 (CM11.0) vold uses labels instead of mount points in the
fstab files, so instead of ro.vold.switchablepair the property is named
ro.vold.switchablelabels -- this way both properties can be specified
and the same device tree can be used for pre-4.4 versions as well.
Extract UUID and label from inserted volumes.

Uses "blkid" tool to extract metadata from an inserted volume, and
reports it up to the framework.  This needs to happen in vold, since
only the FUSE-wrapped volume is visible to userspace.

Remove autorun sanitization, since FUSE takes care of this now.

Bug: 11175082
Change-Id: Ie69b38011ad6011bfb50e40d4f35a29e02150c19
Handle missing UUID/LABEL from blkid.

Bug: 11627785
Change-Id: Iee757abbc3795234f41d513a6aed8ad33855cb7a
vold: mount ext4 with forced SELinux context

Always mount voldmanaged ext4 partitions with the SELinux sdcard_external
context. For other file systems, this is done via the genfs_context,
but since ext4 supports SELinux natively, it must be set here.

Change-Id: I1364f37018b25d79b1826c85849def64e868d72f
vold: force SELinux context only for sdcard

Google uses this code to mount ASEC as well and we shouldn't force
their SELinux contexts

Change-Id: I873af4dc2309d3d0942ce466b8acf8158abb85ae
vold: Initialize flag variables

* These variables may actually be checked before they are set. Set them
  to reasonable defaults to prevent very strange behavior.

Change-Id: I303c4c6742ce86bbde6bda768f4e396263518ed2
Use correct minor device number to format SD card

When formatting SD card partitions, instead of assuming partition
minor device numbers start from 1, use (minor device number of
the disk device + 1) as the starting point.

Bug: 11352632
Change-Id: I69d37f57aec6b62fe2a055470f7525ec09dc3859
Signed-off-by: Blair Prescott <blairp@broadcom.com>
Signed-off-by: Pierre <pierre@broadcom.com>
vold: allow non-vfat devices to be used as ASEC

CM supports alternative file systems (which some devices specify
in the fstab as 'auto').

Change-Id: I7e78fe87a7efc49d6749d5892107085d55156cce
vold: support more than 1 UMS share

Used for devices with both mountable internal and external sdcards.

This is a forward-port and clean up of the 10.2 code (which contains
a lot of deadcode.)

Original authors:

    Alex Zepeda <alex@inferiorhumanorgans.com>
    Genokolar <genokolar@gmail.com>
    Josh Stone <cuviper@gmail.com>
    mik_os <kiril.mik.os@gmail.com>
    Oran Avraham <oranav@gmail.com>
    Pawit Pornkitprasan <p.pawit@gmail.com>
    Tony Layher <layhertony@gmail.com>

Change-Id: I926ce244255414697373d26d252a9da89aea7226

Conflicts:
	Volume.cpp
vold: pass selinux context to ext4 mount (remount ro)

Change-Id: Ic0bb314b30e42489c45caec29d35d6896c9849eb
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
vold: Raise MAX_PARTITIONS to 32

 * We raised this in 10.2 globally, lets put it back to 32 so that
   new bringups don't get stuck on this. It's likely that every single
   device which uses physical, nonremovable volumes with vold will hit
   this limit.

Change-Id: Id7522681a2317c4aff49ca27e1c57e69fe57213c
Clean up ASEC unmounting on physical storage.

When physical devices are unsafely removed, unmountAllAsecsInDir()
fails to find any ASECs, and leaves them all mounted, preventing the
rest of volume from going down.

Now we examine all ASEC containers, and remove when on external
storage, or when the storage media is no longer found.

Bug: 11175082
Change-Id: Iffa38ea43f7e5ad78b598374ebeb60a8727d99fd
Merge tag 'android-4.4.1_r1' into HEAD

Android 4.4.1 Release 1

Conflicts:
	Android.mk
	Volume.cpp
	Volume.h
	VolumeManager.cpp

Change-Id: Ic3e413d61df82b9fbe49079279ca0d00b08d8ed3