DO NOT MERGE. Fix crash in vold

b/11239345

Change-Id: I46a8d6b38e3c093e20e1e5c4f01efc13d1960ad4
merge in klp-release (no-op)
Merge "DO NOT MERGE. Fix crash in vold" into klp-dev
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
Merge "Extract UUID and label from inserted volumes." into klp-dev
Merge "Clean up ASEC unmounting on physical storage." into klp-dev
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: use blkid to detect filesystem type

In preparation for handling ext4 partitions via vold and fuse.

Change-Id: Ibaccded63a7a293ad53f16afb80448ddd493554c
vold: add support for ext4 media

Depends on:
http://review.cyanogenmod.org/31202
http://review.cyanogenmod.org/31211

Result:
http://pastebin.com/nzUbvW7K

Change-Id: I5bd227e637f2a1ed4d13a2eb81390c56c953f482
vold: Handle disks with multiple major numbers

Squashed commits of the following:

commit 6a248052c43bd8c05b9485d8144f778e367a988e
Author:	Emilio López <turl@tuxfamily.org>
Date:   Nov 17, 2011 12:47 AM

    Reintroduce BOARD_VOLD_EMMC_SHARES_DEV_MAJOR

    Code taken from CM7's vold

commit e8caab58ea2992e884fddd4e310ecaf2bf489f37
Author: codeworkx <daniel.hillenbrand@codeworkx.de>
Date:   2012-01-04 16:49:50 +0100

    DirectVolume: handle discs with multiple major numbers

    CFlag: BOARD_VOLD_DISC_HAS_MULTIPLE_MAJORS

    Allows Direct Volume to handle discs with multiple major numbers.
    Needed on Samsung Galaxy S II and variants.

    For example:
    mmcblk0p1 - 179:0
    mmcblk0p2 - 179:1
    mmcblk0p3 - 179:2
    mmcblk0p4 - 256:0
    mmcblk0p5 - 256:1

commit eda64d531e882c46baf88d41a8d3a04874a795e6
Author: codeworkx <daniel.hillenbrand@codeworkx.de>
Date:   2012-04-19 10:50:22 +0200

    vold: fix handling of discs with multiple majors on DirectVolume::getShareDevice()

    The method DirectVolume::getShareDevice() returns an invalid device if the partition
    referenced by mPartIdx is bad. A bad partition is one where the major/minor numbers on
    disk don't match what is expected.

    The original major number is stored for bad partitions so the fix attempts to
    retrieve it and return it if applicable.

    This fix is one part of fixing ICS encryption on the i777 (and possibly other devices)
    where bad partitions may exist.

Conflicts:
	Android.mk

Change-Id: Ibdb05126144adb483c590dec425967362b8af91a
vold: restore 4.4 sdcard logic

Mount points in 4.4 are always fuse-wrapped to provide granular
permission. Unix file systems no longer need to be manually
fuse-wrapped by us.

Change-Id: I6885b0baeaae7c380ec32d410a70a4f53801157b
vold: Support external non-emulated storage

It tries to acess EMULATED_STORAGE_SOURCE which is not
defined if the device doesnt have an emulated storage

mkdirs() also needs to be valid for EXTERNAL_STORAGE

See also https://github.com/CyanogenMod/android_system_vold/commit/5ced6afb769f09ada6e3d1787a36c6f9f8469ed6

Change-Id: I6463979a06eab301acd59e815713abc3f550853f
Handle missing UUID/LABEL from blkid.

Bug: 11627785
Change-Id: Iee757abbc3795234f41d513a6aed8ad33855cb7a
vold: cryptfs: Don't update KDF without validating pwd/key.

Prior to this, the Key derivation function would get
 blindly updated even if the user entered the wrong password.
Now, we only attempt to upgrade the KDF if the pwd/key have
been verified (i.e. after a successful mount).

Bug: 11460197
Change-Id: I0469228cc9b87c47754e8ca3c7146651da177da5
vold: allow override of MAX_PARTITIONS for devices with > 32 partitions

Default was updated to 32 and the error messages were changed to be less cryptic.

(cherry picked from commit cb80fef89874cb2833f93e7c6f0da214467e96b8)

Change-Id: I244f48c576af05b6569c8c40ebeb4ed1bfa53469
Merge tag 'android-4.4_r1.2' into HEAD

Android 4.4 Release 1.2
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: force SELinux context only for sdcard

It needs of https://gerrit.omnirom.org/#/c/2746/

Change-Id: I7b3db6a88ca9c2268f9176acdfc292335f8e25b3
Merge "vold: force SELinux context only for sdcard" into android-4.4