Gallery2: Can't slide to left and "Force Close" alert box pops up

When press Camcorder's shutter button, VideoModule's
onShutterButtonFocus() will be called twice(down and up) and there
is a time interval between this two events. When slide right from
Camcorder, VideoModule's onFullScreenChanged() will be called.
The root cause is when press the shutter button to stop the recording
and slide to right nearly at the same time, onFullScreenChanged() may
be called between these two onShutterButtonFocus() calling(The correct
order should be onShutterButtonFocus(true)->onShutterButtonFocus(false)->
onFullScreenChanged()). Then the first onShutterButtonFocus(true)
calling makes the flag mEnabled to be true, and after that
onFullScreenChanged(false) makes it false, and finally the second
onShutterButtonFocus(false) calling makes it true. Thus, dispatchTouch()
in PreviewGestures will dispatch user's touch events to VideoModule
instead of the CameraActicity.

Add a flag mIsFullScreen to VideoModule.java. when
onShutterButtonFocus(false) is called after onFullScreenChanged(false)
and mIsFullScreen is set to false, we should call
mUI.setShutterPressed(true) to disable the PreviewGestures.

CRs-Fixed: 539360

Change-Id: Ib7bc38dfdd2a9033ba83c2c89133eae909f6c276
Gallery2: Fix screen freeze when switch language several times

The size of thread pool is 4, when change language, the activity
will be recreate. All of activitystate in state stack also
be recreate. But it only call oncreate, don't call onresume
and onpause. All of threads is submmited at onresume except
TileImageView. TileDecoder of TileImageView will submmited at
oncreate. and it will not be release as it didn't call onpause.
So it will submmit a new thread every time change language.
The thread pool will full after switch several times language.
It will lead other thread can't be submmited, such as slideshow
load thread, it will block the slideshow.

When user touch screen or click back key, it will exit slideshow
it will release the thread, but the thread is not running,
so it will wait the thread complete. So the UI will be block
and the screen is freeze.

Remove TileImageView submit thread at constructor.
Only submit in prepareTextures().

CRs-Fixed: 529641

Change-Id: I5e22f43747460f7f796d96bf6fd3f6f66103adb4
Gallery2: fix NPE when tap home key in FilterShowActivity

If tap home key when it just enter filtershow activity,
renderscript context will be destoryed when pause
activity, then loadBitmap task call onPostExecute to
handle the load result, a NPE will happen.

If activity is paused, do not set FilteringPipeline,
it will be set when resume.

CRs-Fixed: 527277

Change-Id: Ib97f328acccfa35cab36a2bb7c8efea4d359844a
Gallery2: fix issue in readTag when parse Exif

When read some Tag of jpeg images,the offset is less than
the IFD0 offset position,then try to copy data above IFD0
as Tag value no matter whether data exists above IFD0,so
null exception occurs in System.arraycopy.This issue can
effect user in two aspects:
1.black thumbnail for some jpeg images in ALbumSetPage
and ALbumPage.
2.force close happens when get details of some jpeg images.

We set offset for this Tag not value on above situation.

Change-Id: Icd368afcbed80556de0940e562dbcca42c53c849
CRs-Fixed: 525081
Gallery2: fix FC when view the details of some pictures

Pictures captured by some devices seems didn't comply
with the standards, it will get null when set details,
then it will throw out an exception.

If it can not get a detail value, do not display it,
and print error log.

CRs-Fixed: 583463

Change-Id: I69be48cb25a4413ae7ddbe301891c94e88671c0f
Gallery2: fix screen flashing after rotating pictures

After rotating a picture, it needs to redraw the bitmap,
but the bitmap can not be available immediately, and it will
draw a rectange of placeholder color (gray) first, then it
redraw the bitmap, this make it seems like the screen flashing.

We draw the placeholder color only if the texture is null.

CRs-Fixed: 570056

Change-Id: I28bc65ba674906f39eae3d872988fe96511a3ecb
Camera: Refresh parameters to avoid change on saved settings.

We do not want the parameters that set in one Module used by
another Module. So after open Camera, we need refresh paramters
in CameraHolder, in order to grantee new copy in the next
getParameters call.

Change-Id: I11f7d47028be6bda0cc98e09b50ca47d520b3814
Camera: fix memory leak when switch and snapshot in front/back

Memory leak is found in com.android.gallery3d when do fornt/back
switch and snapshot. Need clear the mOverrides Map when init.

Change-Id: Iaca466f91fb7dc6273b03c2f148439fb1795b1d6
Gallery2: Remove slideshow option if all files of the folder are video

Enter Gallery and open folder whose files are all video, press
menu key should no slideshow option.

Add condition to remove slideshow if the folder are all video
files.

Change-Id: Ib1603f1609b6490e44039ab64abefb44f14bd477

CRs-Fixed: 574984
Gallery2: fix FC when try to open video folder as MMS attachment

If there are too many videos in the folder, it will takes some
time to check if all the items are videos, then the application
may not responding.

If it is get content from other apps, it do not display option
menu, no need to check all items.

CRs-Fixed: 581769

Change-Id: Ie59830c8756e3a2ece7fcaa526d8f09212b20d6f
Revert "Camera: Fix camcorder crash during pause and resume"

 * Fixes OPPO-131. I am not able to reproduce the original issue
   that this was fixing, let's just revert it to fix the freeze
   when in the filmstrip view.

This reverts commit 593f1735c0d380b7be237fe468ad8f343d767935.

Change-Id: Icf18d7aaafaa1de85621b088d62c2e853675945e
Camera: Fix camcorder pause/resume issue

Keep the pause button disabled when it's clicked,
It'll be re-enabled delay PAUSE_BUTTON_TIMEOUT.

Change-Id: Ib0f3f69632cfd22e671c79732d6b03fd44bbe5c4
Don't record audio for HFR or timelapse modes

 * This just doesn't make sense and causes issues with the HAL.

Change-Id: I8c608e5c9428adb5a709373547166045770b1850
camera: Fix various issues with HFR

Change-Id: Icca780589a8245219566c29f2cf3d3a1d4d8b3f7
camera: Override color effect when scene mode is active

Change-Id: Ia27ed59f3f27e9c867cbb4c8823abb78b0035047
Camera: Dont reset camera state while capture is in progress.

While capture is in progress and if we get autofocus event,
currently we reset the camera state to IDLE blindly. This is
resulting in app exception because it will trigger another
takepicture and lower layers will return error.

Change-Id: I947e471cfc1f5cf5055f1d85550d4534b147d7f0
camera: Move smartscene indicator to the left

 * It overlaps on the preview thumbnail, fixit!

Change-Id: I041c88c8a4f4948995936e5ea595322dfa217354
camera: Synchronize parameter use

Change-Id: Iaf783c0232b480a8db78f7c6c18d2c0e6c40a8e0
Gallery2: fix display abnormal when tap sharpness in filtershow

In Android4.3 version, it using stride to pad row layouts in
script, and can't do 1D indexing of 2D objects, this make
the resulting pixel values are not the corresponding
coordinates' pixel value.

We change to use rsGetElementAt() not gPixels() to
get the correct pixel values.

CRs-Fixed: 539928

Change-Id: Ifc0e516014c9fd974f3e7df163b06f732499f7c0
merge CyanogenMod

Change-Id: I4a2216b5c51573e06b290d0461fc0cc0ef5256f4