Gallery2: Clear undefined buffer before first draw

Clear undefined buffer before first draw.

Crs-fixed: 526603 523916
Change-Id: I1cfdb621bdcf08dc8994adddb0111a1aaf941f56
Camera App: return after synchronized block

For some boundary condition when surface allocated is null, due to
return within synchronization block it is giving ANR. This change
will ensure that return take place outside synchronization block.
It will also ensure to notify an object if already in wait state
before invoking wait on it.

CRs-Fixed: 529666
Change-Id: I8532aa410840785923388a879701be9e98b0154f
Camera: Update storage hint in full screen state change listener.

When user swipe from gallery to camera, storage hint was not updated
based on the latest storage space. This change will call update storage
hint in full screen state change listener callback.

Change-Id: I9950cb165ae49a7d062c012f24e63898045d0c6c
CRs-fixed: 522710
Fixes back button in Video Camera as per this bug: https://slimtrac.slimroms.net/redmine/issues/484

Change-Id: I688f3137481f2e5a9cdbc379db8d96c47bf8ddc4
Merge "Gallery2: Clear undefined buffer before first draw" into jb4.3
Merge "Camera App: return after synchronized block" into jb4.3
Merge "Camera: Update storage hint in full screen state change listener." into jb4.3
Gallery2: camera: disable all camera controls ASAP when swtich the camera

Camera switch button is a pieItem, there is a fadeInOut animation for these
kinds of menus. And the onClick event deliver to upper layer happens after
the end of the animation which lasts 600ms. We should add another event
callback before the animation to disalbe all camera controls as soon as
possible.

Change-Id: Iddcb9e9452aa0ff6ea8485c08c9c56b067995fb5
Gallery2: fix the display error of camera manu when rotate it

including: manu of native camera and camcoder

Crs-fixed: 529692 532833
Change-Id: I302358fcf9fbde722d8b032b89ee6c0d39d76a8b
stop recording from camcorder app in case of error.

This change makes sure that stopvideoRecording is called
for all error returns to the video recording app.

Change-Id: I70a942dab24e2665d76b3ff060e7ccf3d134e429
Gallery2: reduce the camera switch animation duration to 200ms

It is too long for the animation duration when switching from
the back sensor to front or vice-versa which costs 400ms. Reduce
it to 200ms to enhance the KPI.

Change-Id: I0ef532aa88104de3ea0ea859b36f8d8cbf457194
Camera: Fix concurrency issues with camera messages

Without this, multiple threads are
trying to access same data and
resulting in crash.

Change-Id: I1de6f6b85e257f40a4426c7684227606f81c720a
CRs-Fixed: 542706
Camera: Fix crash during open and close camera

When we open camera for the second time after opening camera,
switching to camcorder and exit camcorder rapidly, crash will
be observed. It's due to the assertion of double open.
When app receives pause event, it should cancel the switch
animation, as we as it's listener.

Change-Id: Id351d3e5db63c54646d592b728a4624e3d6e1211
Camera: Do not create start preview thread if one thread is alive

It will have exception if two same thread tried to manipulate
same UI component, check the thread status before create a new
one.

Change-Id: I6f9a5c03f46360d15fdcebcd52c48b924f5b42ad
CRs-fixed: 545574
Camera: Block shutter button during mode switch

Video recording will crash if start recording before startpreview is
done, so we need to disable shutter button before preview is ready.
Move the function which block shutter button after showVideoSnapshotUI
as the button will be enabled inside this function.

Change-Id: I9b7c4e352bd1f15742a4bdb7494a2e53f25d7a99
CRs-fixed: 545612
Gallery2: reduce the latency between cam&camcorder switch

There are animations of fadeIn and fadeOut effect when switching
from camera to camcorder or vice-versa which all last 300ms, thus
the black UI observed too long. Set the animator duration to a tiny
value for reducing this latency.

Change-Id: I9cee228e641ad82e7001e091944a30515f96ab2e
Camera: reduce the camera button animation duration to 100ms

It is too long for the animation duration when touch the button
which costs 600ms. Reduce it to 100ms to enhance the KPI.

Change-Id: I9a105c561419594e5a81e83f7ae3786e4eb86b8d
camera: Fix camera startup racing with orientation change

 * When launching the camera via the lock screen widget on some devices,
   the orientation change shows up late, and we get an
   onConfigurationChanged in the middle of setting up the textures,
   causing an infinite wait in the UI thread.
 * Ignore these events until the preview is up and running, orientation
   will be checked later.

Change-Id: Icf5013e039324d617acd1c1108d37c655776c1c3
Gallery2: Fix detail dialog image count

This commit fixes the displayed image index which needs
to be count up by 1 to make sense for the user.

Before: http://goo.gl/BeRp8Z
After:  http://goo.gl/N3xvX6

Change-Id: Ib8d782188207d9ee7444316e8426b8215c67e594
Gallery: Fix filmstrip source index

Change-Id: I0213871f47fb386ddce5728f0079eb7884e6d9d4
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>