storage: Don't list removed volumes in storage list

 * Don't tell apps that USB storage or empty SD slots are available for
   use. This fixes errors about trying to create dirs in vold as well
   as the relevant CTS cases.

Change-Id: Ic763d40c19b0bb9f7497cc1515baf1661d76e9ee
MediaScanner: delete abnormal elements in prescan procedure.

There is a race in MediaProvider's mUnmountReciver.
when it doing external storage's database clean up at power down procedure,
if the datebase is big, system may shutdown after db.update, but db.delete
not done, there will be many elements with no filename in the database.
That may cause duplicated files and folders shown in MTP.

This patch clean up these abnormal elements in MediaScanner's prescan procedure.

Change-Id: I0a3dacffd12892b1a2a892b2749a02ab3dea109b
Author: Liang Wang <liangx.wang@intel.com>
Signed-off-by: Liang Wang <liangx.wang@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: 58969
Send media button intent with FLAG_RECEIVER_FOREGROUND set

In Kitkat, it is changed how intents are sent. During high
system load, intents can be delayed. This could make it
impossible to answer a call via headset button during high
loads. Make sure intents for media button press is sent with
flag FLAG_RECEIVER_FOREGROUND so it is sent immediately.

Change-Id: I1b55f77941dbd028dd25365bf61307951aeca437
Add UUID (re-)scan support for vold-mounted volume (1/2)

Consider the following scenario:
* Using physical primary only storage cofigurations with the sdcard
  daemon
* On first boot, the UUID is plumbed to the framework via vold, but this
  is only done when a volume is mounted (via the extractMetadata()
  function).
* When the framework crashes/restarts, vold does not need to mount any
  volumes (as the sdcard daemon will still be running), which means
  that the UUID is never plumbed to the framework upon restart.
* MediaProvider will continuously crash with an NPE due to the UUID being
  null.

Workaround the issue by adding "scanuuid" to the "vdc volume" command
list, and trigger a scan when the framework detects that a volume is
mounted but the UUID is null.

Change-Id: I01fceadf85dac97fbf19c41eb865abed714fe0f4