Gallery2: catch OOM error when crop big-size picture

An OOM error happened when set big size of picture as wallpaper

We catch the OOM error, and if fail to crop the picture, we
show a toast.

CRs-Fixed: 522476

Change-Id: Ia9d7f41ca768c9183b26051fb08c9f823fec0074
Gallery2: The menu bar will not flicker.

When select/unselect items,the operation of menu bar is set
visible or invisible repeatly which cause the menu bar flicker.

Add a condition to judge whether the menu bar should invisible at the
beginning. And make the Share operation invisible only when the num of
selection picture is over 300.

CRs-Fixed: 567580

Change-Id: I58c724f7426a33f8b94bac174fc4d512a7aa6c49
Gallery2: Fix the superposition of two images issue

When we zoom out to film mode from single photo mode with more than two
fingers, PhotoView will receive multi onScaleBegin/onScaleEnd streams.
But when mModeChanged is true, it will only notify PositionController to
beginScale but not to endScale, then mInScale remains in true state. So
when we back to single photo mode from film mode, focuse photo can't do
scale animation in Box.startSnapback().

According to the logic in onScaleEnd(), we will ignore other scale begin
notification if film mode has been changed.

CRs-Fixed: 551984

Change-Id: I468d932adab0a3540f107501db4d0ea4b7ffbb10
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.

CRs-Fixed: 574984

Change-Id: Ib1603f1609b6490e44039ab64abefb44f14bd477
Gallery2: fix cropview shows abnormal if lock and rotate screen

The canvas value will effect the screenbounds value.
When screen is locked, the screen orientation will be force
changed to portrait but the screenbounds will still use
landscape value.

To fix this issue, if found screenbounds changed, we will make
dirty true to update the view.

CRs-Fixed: 557210

Change-Id: Ia84581d122da76f084117dfd0a195ce2784e18c9
Gallery2: fix can not add gallery widget to home screen

When selected to add a cropped picture to home screen,
the binder transaction failed because it was too large,
add widget failed.

We reduce the allowed maximum bitmap size in intent,
to make sure that binder size will not greater than 1M.

CRs-Fixed: 528927

Change-Id: Id63c8503dead66ab18531a78b0b4206d1fd30d07
Gallery2: fix selection count didn't update after floder is deleted

If we select an album and then delete it in file explorer, the
Gallery2 can not update the selection count, we change to
leave selection mode when albumsetpage is paused.

CRs-Fixed: 529042

Change-Id: Ic972ea23a64e0779e18ca9397b4619fb90ce3ecf
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
Gallery2: Fix force close when deletes about 5000 pictures.

According to the log analysis, it's the NullPointerException
and ArrayIndexOutOfBoundsException which will cause application
crashes.

The root cause is multiple thread will call the method
getMediaItem in LocalMergeAlbum. To avoid multiple thread mess,
add lock to keep safe.

CRs-Fixed: 545575

Change-Id: Iaadbb638cfb3f15193f5fcb7d4027ddd5f881201
Gallery2: Fix NPE in LocalSource during monkey test.

The object which is obtained by accquire MediaProvider client is null
when MediaStorage is killed or disabled by monkey test or others.

Add null check in LocalSource.java::pause().

CRs-Fixed: 540075

Change-Id: Icba85e77e86793e344e55255c27b195c11186fc8
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: support GIF animation

(cherry picked new files from commit
2b133c9747af26701a12d60caef3e7e14cf55536)

Change-Id: I227cef76cbacd66b7e87bc59b4f07d518b70a859
Gallery2: support GIF animation

This change implements a Java GIF decoder.

Change-Id: I72b6e8eb25572bba77a2a46e1754d8db8c47a0cc
CRs-Fixed: 517575
Gallery2: Support HSCI screencolor settings use

Let it can change HSCI when the picture selected from Gallery2 in screencolor settings.

Change-Id: I57cdb7080820defaa27a2f2e93e479374f00b09a
Gallery2: support loop/single video play mode

(cherry picked new files from commit id
990c6d43ea7c184846e19d41bef0d93aee4e581b)

Change-Id: I0f55dfdfe812262804e7e45c99c7c9bbc5fb7503
Gallery2: support loop/single video play mode

This change allows a video to be played repeatedly. It also
introduces an extension framework.

Change-Id: I5566192f138c1f0fd889b85496dd27fbf2aed10d
CRs-Fixed: 507973
Signed-off-by: scott <scott@ubuntu>

Conflicts:
	src/com/android/gallery3d/app/MovieActivity.java
Gallery2: support stereo/single track play mode

(cherry picked new files from commit id
990c6d43ea7c184846e19d41bef0d93aee4e581b)

Change-Id: I2d7d523ca586a031c3fb139eda321d5073b30589
Gallery2: support stereo/single track play mode

User can select stereo/single track play mode.

Change-Id: I8225739815484f3c288823802f68478cb457725e
Gallery2: support live streaming and bookmarks

(cherry picked new files from commit id
990c6d43ea7c184846e19d41bef0d93aee4e581b)

Change-Id: Idc254cf0f7e8a9b492203313fa63349d07d19d5c