Gallery2: support audio effects during video play.

Change-Id: I1706a1aaa9d76bc84b2e0720991fad9f7c45c336
CRs-Fixed: 516108
CRs-Fixed: 516113
CRs-Fixed: 516114
Gallery2: Check the validity of effect

There's a contention when effect is released but user still adjust it.
we need check the validity to avoid call member function of an already released object.

Change-Id: Ifdc637f5211670b63dc8ec6b42f3756195d1e88d
CRs-Fixed: 516911
Gallery2: if selected count is 0, leave selection mode.

If the selected count is 0, no need stay in selection
mode.

After we toggle a item, if selected count is 0，leave
the selection mode.

CRs-Fixed: 412492

Change-Id: Ia3ecd1c77f4074f21b1f906050b4a7bc2dc37c6e
Gallery2: force close happens when remove Gallery widget

The mSource may be null if we destroyed the widget.

So we make the function return null if we remove the
widget to make gallery avoid force closing.

CRs-Fixed: 362477

Change-Id: Ied227235f4dc78aeed69a70c264e523268c344d0
Gallery2: update selected number for database change

mSourceMediaSet will be updated for database changed
But mTotal will not if it is more than zero.

Update mTotal all the time for database changed

CRs-Fixed: 407961

Change-Id: I432b33ba62c04b18c6a1628b6b10dc9b77a72fc1
Gallery2: set the progress bar when we pause the video

The progress bar isn't set when we pause the video.

Set the progress bar when we pause the video

CRs-Fixed: BZ1623

Change-Id: I3d450df6fdf8195983692ed8a71ab42717e9c36c
Gallery2: dismiss delete-confirm dialog when pause

If user choose delete operation in camera page mode,
then a confirm dialog will show,then user pause and
resume from pause,will find the dialog still exists
in camera preview.

To prevent confusing user,we will change to dismiss
confirm dialog when pause.

CRs-Fixed: BZ737

Change-Id: Ib22cf78cc6c7e513208f57e502eaf0a4d1f50917
Gallery2: invalidate album view even only size changed

After deleting the pictures, it didn't request to
update the view. so the left pictures can not be
updated and displayed instantly.

Invalidate album view even only size changed to
make it shown correctly.

CRs-Fixed: 393995

Change-Id: I9924edf3a1d0e46d045425b9d078758e8cb50685
Gallery2: keep selection mode when deSelectAll

Origin code will call leaveSelectionMode function in
deSelectAll and will not keep in selected status on
this situation.

Add DESELECT_ALL_MODE in AlbumPage and
AlbumSetPage to make stay in selection mode even if
choose deSelectAll.

CRs-Fixed: 342469

Change-Id: Ia8819ba197444c33b1641ad33dd8602ecca0075c
Gallery2: request thumb if fail to get region decoder

When fail to get region decoder in SinglePhotoAdapter, try to
request thumb image rather than return null directly.

CRs-Fixed: 369231

Change-Id: I11fe4b4f3ac10550f10e0391a919c0ea18fe47e0
Gallery2: update time-cluster albums for database change

When in time clustering and picture/video added,the page
is not updated for current cluster album will ignore this
change.

We add to reload cluster albums on this solution,meanwhile
change time clustering method from dynamic to static which
makes same month and same year items into same cluster.

CRs-Fixed: 383896

Change-Id: I59b592d91c045290b4b2a0ff4279f5a95fa83706
Gallery2: update content start/end once getUpdateinfo

When viewing last picture in screenshot album and do screenshot, the
new picture will become the first one in album and the album has
changed, but this time current index and content start/end is still
old value, so user will find change to previous picture from current
one in current page.

To aviod this situation, will update content start and content end
once after getUpdateinfo and then can get correct current index and
item path.

CRs-Fixed: 420908

Change-Id: If0da8f8b2ea25d4aed9b8a73f6050e58aadae5de
Gallery2: if phone is locked, pause the video, if not, start it.

If there was a video playing before locking the phone,
After pressing the emergency call option in lock screen,
and then presses back key, the MovieActivity will resume,
so the video will play background.

Set a listener, if Keyguard is locked,pause the video,
if not, start it.

CRs-Fixed: 427283

Change-Id: Ia825afee691ee53f53eebf1f96efe09ef88ca743
Camera: Wrong count is displayed when view details for a video

mSource size is coming as 2 even if there is only one image due to
wrong initialization. Fixing that initializaiton may break other use cases.
So, the fix has been given only for this particular error (Wrong count).

Change-Id: I65117dd34d2ec80ca68e5a22e0403f5470e2621a
CRs-fixed: 514328
Gallery2: put a itemPath to the bundle when start photopage.

In some cases,  it request to start photopage, but
the deletions is not cleared, it get 0 when get
media item count, so it can not get a itemPath to
create a photodata adapter when create photopage,
then it request to finish state when resume, then a
NullPointerException happens.

We put a itemPath to the bundle when start photopage.
So it can create a photodata adapter, and do not finish
the photopage state.

CRs-Fixed: 521735

Change-Id: I539bcfa35db35fdf0fe9004470e7a77acc65a94d
Gallery2: fix fail to share file-scheme uri in MovieActivity

MovieActivity only supports sharing uri with content scheme.
We add to support sharing uri with file scheme for it's
secure and proper.

CRs-Fixed: 516075

Change-Id: I977862b79fe7ecfbfcab116630705623bdd2b2e4
Gallery2: Recycle effect instance when MovieActivity pauses

VideoView will deallocate audio track for local video playback when
MovieActivity being paused, which causes audio effect being released
twice when onDestroy() is called.

To avoid such special case, we should ensure effect be
deallocated/allocated when video view call pause/resume.

Change-Id: I571f9f3126be747ebe4e65a01f6880941d00d25d
CRs-Fixed: 522349, 523853, 524557
Gallery2: fix save button is disabled after rotate in TrimVideo

After rotating the phone, TrimVideo activity will recreate,
the save button will be disabled when create activity.

We restore the state of the save button.

CRs-Fixed: 521010

Change-Id: Ided934a6e54b20289c21608f2df19875d25adb7d
Gallery2: Don't restore strength from pref when toggling switch

Currently when user toggles swith to enable effects, it'll restore the
strength from pref which is saved last transaction which is not
consistent with what is showed on strength widiget.

Change-Id: Ic6ef415b2fcea905ad5cb6266b37cda92b319a99
Gallery2: Fix fail to share in MovieActivity after use camera

When using camera, it will call PhotoPage which creates its
share option menu and clear the shared provider's intent which
causes the problem. The option menu uses ShareActionProvider
to handle operation, and it saves the share intent in
ActivityChooserModel. The PhotoPage onCreateActionBar
method will create the menu which sets the share intent to null.
So when click the share button, there is no responding.

Recreate the provider's intent when resume to MovieActivity.

CRs-Fixed: 513809

Change-Id: I1f4ff891b3909009b716d243147de886ae98dd9e