force jpeg quality to 100
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: Clear undefined buffer before first draw

Clear undefined buffer before first draw.

Crs-fixed: 526603 523916
Change-Id: I1cfdb621bdcf08dc8994adddb0111a1aaf941f56
Camera: Fix camcorder crash during pause and resume

When camcorder is suspended in background, if it receives resume
and pause event in very short interval, crash will happen.
After receiving resume event, the onresume method will be called,
and it will start another thread for starting preview. And soon,
the main thread receives pause event, the onpause method which will
close camera is called.
There will be a racing between the main thread and start preview
thread. If close camera get done first, crash will be observed.
To avoid the racing, the close camera operation should wait for the
start preview operation, and the join method is used here for
synchronization.

CRs-Fixed: 526007
Change-Id: Idf6a8660378bf1a65af1f5194a35d30822f1dcf6
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
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
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: improve snapshot KPI

In camera snapshot, thunbnail slide animation is start in JPEG
callback, make it start in raw data callback so that it can make
use of JPEG encode time which in turn shorten the snapshot time.

Change-Id: I1ce8a768a1cb54e8244725bdcb1e49d3ca5a914b
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
Gallery: Fix filmstrip source index

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

Conflicts:

	src/com/android/gallery3d/app/PhotoPage.java