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
Fix setSurfaceTexture to handle surface caching

Changed the TextureView.setSurfaceTexture to apply the
existing listener to the surface provided in the method.
This is done to allow surface caching to work.
Whenever a new SurfaceTexture gets created, its listener is
created as well, so when the setSurfaceTexture is called
we should be attaching the listener to the new surface.

Change-Id: I4c1a704c587e977ab7a6b1fe3a7d3e0d20d00218
CRs-Fixed: 639136
wallpaper: limit wallpaper width to sys.max_texture_size

Image wallpapers are created ~1.5x screen size.  On some devices this
may exceed the maximum supported texture size, which will either fail
allocation or fail to composite.

Bug 991597

Change-Id: I9948b09f6e00a724212e73d36901f2bbea42e2f4
Correct stride for drawing to cached glyph bitmap

fixes the glyph cachebuffer index to account for pixelbuffer
format size.

issue: in launcher home screen create icon group and rename the
group to some text string with emo-icons (smilies). without this
change the drop shadows for emo-icons will look bad.

Change-Id: I525a9219d35f4541363fd64e7fc5fd1053269725
Signed-off-by: Digish Pandya <digishp@codeaurora.org>
Use alpha channel instead of red in drawCachedGlyphBitmap

the correct value to copy in bitmap is alpha component from
the cachebuffer. currently it is offset to red channel if format is
RGBA which is wrong.

this is followup fix for https://android-review.googlesource.com/#/c/93943/

Change-Id: I96b5ba35df5ccaef44caf2542d35d6585ba1df80
Signed-off-by: Digish Pandya <digishp@codeaurora.org>