DO NOT MERGE. Fix crash in vold

b/11239345

Change-Id: I46a8d6b38e3c093e20e1e5c4f01efc13d1960ad4
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
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
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>
Handle missing UUID/LABEL from blkid.

Bug: 11627785
Change-Id: Iee757abbc3795234f41d513a6aed8ad33855cb7a
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.
Logging-fu
vold: allow swapped storage paths at vold init

Advanced storage settings patch series:
[1/4] vold: allow swapped storage paths at vold init
      http://review.cyanogenmod.org/56515
[2/4] Advanced storage: vold swap storage paths
      http://review.cyanogenmod.org/56516
[3/4] storage: allow swapping primary storage for apps
      http://review.cyanogenmod.org/56950
[4/4] Advanced storage: swap primary storage for apps
      http://review.cyanogenmod.org/56951

By setting persistent system properties
 persist.sys.vold.switchexternal=1
 persist.sys.vold.switchablepair=sdcard0,sdcard1 (for example)
two non-emulated extended storage devices can swap between primary
and secondary storage.

This commit is heavily inspired by Rick Fernie and Ricardo Cerqueira's
"vold: Allow pre-configured device pairs to switch mountpoints"
[http://review.cyanogenmod.org/12764] but adapted to CM's newer vold.

Change-Id: I2be5d4799c2d8f04a535096ac4c7619849f1f84a

Conflicts:
	DirectVolume.cpp