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