UMS [1/6]: LegacyUSB Squashed commit with updates for 4.2

LegacyUSB: add overlay for UMS lun and use existence of lun to enable legacy USB
LegacyUSB: Add support for legacy USB implementations
Option to hide Adb notification icon (framework) - authorship belongs to Rick C

2: https://gerrit.omnirom.org/#/c/5042/
3: https://gerrit.omnirom.org/#/c/5043/
4: https://gerrit.omnirom.org/#/c/5044/
5: https://gerrit.omnirom.org/#/c/5045/
6: https://gerrit.omnirom.org/#/c/5046/

Signed-off-by: Humberto Borba <humberos@gmail.com>
Change-Id: Id14f70f7e21b689c08cadef69f69da711c7dc566
UMS [2/6]: Add option for switching between UMS and MTP/PTP mode.

Change-Id: I8e692d468cb36ccc97ca69b8a2eb11afeb711eae

This adds support for switching between UMS and MTP/PTP.
Framework part (this part) will only enable UMS if the config setting is set.
Standard is to enable UMS if the primary volume supports UMS.

1: https://gerrit.omnirom.org/#/c/5041/
3: https://gerrit.omnirom.org/#/c/5043/
4: https://gerrit.omnirom.org/#/c/5044/
5: https://gerrit.omnirom.org/#/c/5045/
6: https://gerrit.omnirom.org/#/c/5046/

Signed-off-by: Humberto Borba <humberos@gmail.com>
Change-Id: I8e692d468cb36ccc97ca69b8a2eb11afeb711eae
UMS [3/6]: Add UsbDebuggingManager and UsbDebuggingActivity to LegacyUsbManager

The UsbDebuggingManager listens to adbd requests and displays a dialog
when the public key authentification fails, for the user to confirm if it
wants to allow USB debugging from the attached host. If the user chooses
to always allow USB debugging, the UsbDebuggingManager writes the public
key to adbd's config file so that the public key authenfication succeeds
next time.

1: https://gerrit.omnirom.org/#/c/5041/
2: https://gerrit.omnirom.org/#/c/5042/
4: https://gerrit.omnirom.org/#/c/5044/
5: https://gerrit.omnirom.org/#/c/5045/
6: https://gerrit.omnirom.org/#/c/5046/

Signed-off-by: Humberto Borba <humberos@gmail.com>
Change-Id: I819b8a0428ba34b68dadeb9fa67c53abb9a85fbc
UMS [4/6]: Allow USB notification to show when primary SD allows UMS and MTP

Previously if primary SD is set to allowMassStorage="true" the USB
dialog would never show.  This checks if persist.sys.usb.config is
set to mtp,adb and then allows the USB notification to show. With
this you can then have the option to select from MTP, PTP and Mass
storage when clicking the pull down notification. When Mass Storage
is selected it activates the USB connected dialog to turn on USB
storage. When set back to MTP the USB connected notification disappears.

1: https://gerrit.omnirom.org/#/c/5041/
2: https://gerrit.omnirom.org/#/c/5042/
3: https://gerrit.omnirom.org/#/c/5043/
5: https://gerrit.omnirom.org/#/c/5045/
6: https://gerrit.omnirom.org/#/c/5046/

Signed-off-by: Humberto Borba <humberos@gmail.com>
Change-Id: I2287075ec93cae75f19e8fb59965d9dddb234aca
UMS [5/6]: Allow mounting of multiple volumes via mass storage (framework part)

The volumes to mount is taken from storage_list.xml (allowMassStorage)
rather than ro.additionalmounts.

Hand ported from the following patches:

commit 0233209827d95221399b1fe0185f79863fc6bf26
Author: Tony Layher <layhertony@gmail.com>
Date:   Sun Jan 2 12:46:38 2011 -0500

    forward port of 93bb95929a0c017498625a87654b4d114fe17b96 to allow mounting and sharing of mulitple volumes to MountService.

    Change-Id: I9fa3994e6e7b85360b451f57c1cdd4df921bc035

(the second part of the above patch was not ported)

commit 678fadf517126c8468ef2d8dcaea9c9fce96035b
Author: Josh Stone <cuviper@gmail.com>
Date:   Sun Nov 7 13:38:58 2010 -0800

    MountService: Remount all volumes after USB disconnect

    If USB was removed while UMS was enabled, the MountService was only
    remounting the primary share.  Any other shares, like the HTC Inc's
    emmc, were left in limbo.  This patch now iterates over *all* shared
    volumes to remount after disconnect.

    Change-Id: Ie6fd49ad80ba6fa0e4e194a386549cac786b4bbe
    Signed-off-by: Josh Stone <cuviper@gmail.com>

commit b1da9ed003edcd10ccda56fdf087e8f1b0f77b2a
Author: Josh Stone <cuviper@gmail.com>
Date:   Sat Jan 22 12:03:53 2011 -0800

    MountService: Only notify PackageManager for true ASEC changes

    MountService can be dealing with multiple mounts (emmc, sdcard), but
    only the EXTERNAL_STORAGE has any ASEC mounts on it.  Since the PMS
    updateExternalMediaStatus doesn't specify the path, we need to make sure
    it's only called for the real ASEC mount.  Otherwise we get into nasty
    race conditions when multiple mounts are coming and going, like during
    UMS transitions, and sdcard-installed apps tend to break.

    Change-Id: I85c6a601e84afd30b44270b0892686c2d864ce8d

commit c8c58f3d14fbb8c77ab1e90541e59fb74bef54cf
Author: Josh Stone <cuviper@gmail.com>
Date:   Sun Mar 6 12:34:50 2011 -0800

    MountService: Unmount secondary volumes more carefully

    Use the same message handler for unmounting both the ASEC external-
    storage path and any secondary paths like emmc.  This seems to help with
    additional race conditions encountered on Inc.

    Change-Id: Icca71756fa6721bd85da1f35b8b8c7fc7caa1eb1

commit 47495ab860ed97499e0c4268bf40b1f9c429bf99
Author: atinm <atinm.dev@gmail.com>
Date:   Sun Apr 10 14:50:41 2011 -0400

    Allow multiple shareable SD Cards by using getShareableVolumes()
    to get all the volumes that are shareable and allowing
    sharing/unsharing for all of them rather than just the hardcoded
    getExternalStorage calls.

    Unmount immediately if PM is not updating and not an ASEC
    mount. Change from Josh Stone.
    Change-Id: Iaf1a7a4484deac373e1c1d7bf16d5f22ca49fd64

    Only allow package manager for sdcard (packages aren't on
    external card).

    Change-Id: I0d148ea52dc1285905a9dd061d1ceedcfb761b52

    Take out extra logging.

    Change-Id: I6beb007700ef4be04c3eb273bbf2069c87b30011

1: https://gerrit.omnirom.org/#/c/5041/
2: https://gerrit.omnirom.org/#/c/5042/
3: https://gerrit.omnirom.org/#/c/5043/
4: https://gerrit.omnirom.org/#/c/5044/
6: https://gerrit.omnirom.org/#/c/5046/

Signed-off-by: Humberto Borba <humberos@gmail.com>
Change-Id: I5ea83afeda6cdaf63dd15857b3827bb00afbd6d2
UMS [6]: Make "SD Card removed" notification dismissible if the removed SD Card is not the primary storage

The Galaxy S uses the "external SD Card" as the extended storage
and it the notification should be dismissible as it's okay not
to have it.

Additionally, this patch also not hide the USB storage mount dialog
if the removed storage is not the primary storage

1: https://gerrit.omnirom.org/#/c/5041/
2: https://gerrit.omnirom.org/#/c/5042/
3: https://gerrit.omnirom.org/#/c/5043/
4: https://gerrit.omnirom.org/#/c/5044/
5: https://gerrit.omnirom.org/#/c/5045/

Signed-off-by: Humberto Borba <humberos@gmail.com>
Change-Id: Ic752a3da917e0d7736a619fb68f07905106987fb