Solve a possible NPE in the Documents provider

This commit follows an internal bug report to fix a NPE that would be
thrown in specific situations on specific devices. All callers should
be able to handle the returned null value but if they don't, we can
worry about that later down the line. This null value should not be
returned under normal circumstances anyway.

Change-Id: I274844bf07733643923d5729259f1d9d9cf75e54
libhwui: Fix a native crash with patch caching

This commit makes the system silently deal with requests to remove
patches that have already been tagged for removal instead of dumping.
The garbage collector method (PatchCache::clearGarbage) should deal
with getting rid of this patch at a later date regardless since it
has already been added to the garbage array.

Fixes AOSPA-835.

Change-Id: I9bd801926bc5de5cdb0324c9ddeb91bd8bbfe155
Optimize drawBitmapMesh using TRIANGLE_STRIP

Draw BitmapMesh using STRIP instead of TRIANGLES.
Depending on where the bottleneck is located in the pipeline,
there is a potential for saving two-thirds of the time spent rendering.
The speedup is due to avoiding redundant operations,
i.e., mapping each vertex four times to texture and color attribute,
sending each vertex twice to the GPU, vertex processing of GPU ...

In this patch:
1. Refactoring mesh using Strip.
2. Batch triangles by adding degenerate triangles.
3. Optimize computing positions of texture and color attribute.

Benchmark: Drawing Bitmap(1152x768 px) with 200x200 meshes
Performance is doubled (from 26.4 fps to 53 fps, Nexus10).
Memory footprint: only 17% of original method.
(from 240000 to 40401 vertices with xy, uv, rgba data.)

Change-Id: I08c5c20d981d88528ce7b02012feefae468d6ec4
Signed-off-by: kui.zheng <kui.zheng@arm.com>