From f1ccb05dbefb19f87d6a6e3abc5db40feb4462b5 Mon Sep 17 00:00:00 2001 From: zhuw Date: Wed, 17 Oct 2018 11:12:49 +0800 Subject: fix monkey FC when delete item if no key found in the map, return new list Change-Id: I793f01a9ca7242b663fa90420d806352e50752ac --- src/com/android/gallery3d/data/LocalMergeAlbum.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) mode change 100644 => 100755 src/com/android/gallery3d/data/LocalMergeAlbum.java diff --git a/src/com/android/gallery3d/data/LocalMergeAlbum.java b/src/com/android/gallery3d/data/LocalMergeAlbum.java old mode 100644 new mode 100755 index db981c3d7..40e8b8ef0 --- a/src/com/android/gallery3d/data/LocalMergeAlbum.java +++ b/src/com/android/gallery3d/data/LocalMergeAlbum.java @@ -121,7 +121,12 @@ public class LocalMergeAlbum extends MediaSet implements ContentListener { // First find the nearest mark position <= start. SortedMap head = mIndex.headMap(start + 1); - int markPos = head.lastKey(); + int markPos; + try { + markPos = head.lastKey(); + } catch (NoSuchElementException e) { + return new ArrayList(); + } int[] subPos = head.get(markPos).clone(); MediaItem[] slot = new MediaItem[mSources.length]; -- cgit v1.2.3 From 41de1355ef13aa6ed7793415ee6cb40cd8386f4e Mon Sep 17 00:00:00 2001 From: zhuw Date: Fri, 2 Nov 2018 13:48:27 +0800 Subject: change Home button function in timelinepage finish activity state when Gallery is in timeline page Change-Id: I2b322430449d47d423f74143ad4e46b9dc90de80 --- src/com/android/gallery3d/app/GalleryActivity.java | 17 +++++++++++++ src/com/android/gallery3d/app/TimeLinePage.java | 29 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/com/android/gallery3d/app/GalleryActivity.java b/src/com/android/gallery3d/app/GalleryActivity.java index 16920b942..c4b9564d1 100755 --- a/src/com/android/gallery3d/app/GalleryActivity.java +++ b/src/com/android/gallery3d/app/GalleryActivity.java @@ -25,6 +25,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.Intent; +import android.content.IntentFilter; import android.content.UriMatcher; import android.content.pm.PackageManager; import android.graphics.Color; @@ -618,4 +619,20 @@ public final class GalleryActivity extends AbstractGalleryActivity implements On } return super.onGenericMotionEvent(event); } + + public void registerHomeButtonReceiver(TimeLinePage.HomeIconActionReceiver receiver) { + IntentFilter filter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); + registerReceiver(receiver, filter); + } + + public void unregisterHomeButtonReceiver(TimeLinePage.HomeIconActionReceiver receiver) { + if (receiver == null) { + return; + } + try { + unregisterReceiver(receiver); + } catch (Exception e) { + Log.w(TAG, "unregister HomeIconActionReceiver failed"); + } + } } diff --git a/src/com/android/gallery3d/app/TimeLinePage.java b/src/com/android/gallery3d/app/TimeLinePage.java index c3c08650b..dad1ef265 100755 --- a/src/com/android/gallery3d/app/TimeLinePage.java +++ b/src/com/android/gallery3d/app/TimeLinePage.java @@ -20,8 +20,10 @@ package com.android.gallery3d.app; import android.app.Activity; +import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.content.IntentFilter; import android.content.res.Configuration; import android.graphics.Color; import android.graphics.Rect; @@ -124,6 +126,7 @@ public class TimeLinePage extends ActivityState implements private int mSyncResult; private boolean mLoadingFailed; private RelativePosition mOpenCenter = new RelativePosition(); + private HomeIconActionReceiver mHomeIconActionReceiver; private Handler mHandler; private static final int MSG_PICK_PHOTO = 0; @@ -433,6 +436,7 @@ public class TimeLinePage extends ActivityState implements } } }; + registerHomeReceiver(); } @Override @@ -499,6 +503,7 @@ public class TimeLinePage extends ActivityState implements mAlbumDataAdapter.setLoadingListener(null); } mActionModeHandler.destroy(); + ((GalleryActivity) mActivity).unregisterHomeButtonReceiver(mHomeIconActionReceiver); } private void initializeViews() { @@ -896,4 +901,28 @@ public class TimeLinePage extends ActivityState implements tvEmptyAlbum.setVisibility(View.GONE); } } + + public class HomeIconActionReceiver extends BroadcastReceiver { + private static final String SYSTEM_DIALOG_REASON_KEY = "reason"; + private static final String SYSTEM_DIALOG_REASON_HOME_KEY = "homekey"; + + @Override + public void onReceive(Context context, Intent intent) { + if (TextUtils.equals(intent.getAction(), Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) { + String reasonHomeKey = intent.getStringExtra(SYSTEM_DIALOG_REASON_KEY); + if (TextUtils.equals(SYSTEM_DIALOG_REASON_HOME_KEY, reasonHomeKey)) { + StateManager manager = mActivity.getStateManager(); + int stateCount = manager.getStateCount(); + if (stateCount == 1 && manager.getTopState() instanceof TimeLinePage) { + manager.finishState(manager.getTopState()); + } + } + } + } + } + + private void registerHomeReceiver() { + mHomeIconActionReceiver = new HomeIconActionReceiver(); + ((GalleryActivity) mActivity).registerHomeButtonReceiver(mHomeIconActionReceiver); + } } -- cgit v1.2.3 From 963fb695cf83cc2f9ba96b3f22041aaf4c3cc286 Mon Sep 17 00:00:00 2001 From: junjiez Date: Tue, 20 Nov 2018 17:52:11 +0800 Subject: SnapdraongGallery:Fix black screen 1.Force the surface of the videoView to be recreated after resume when it's null 2.Process screen off intent only when screen is in off state. Change-Id: Ifc2fc5ca5414f3fd8bd753abb1e4e8f7477f6645 CRs-Fixed: 2348871 --- src/com/android/gallery3d/app/MovieActivity.java | 12 ++++++------ src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java | 11 +++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) mode change 100644 => 100755 src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java diff --git a/src/com/android/gallery3d/app/MovieActivity.java b/src/com/android/gallery3d/app/MovieActivity.java index 376338863..62ffa753f 100755 --- a/src/com/android/gallery3d/app/MovieActivity.java +++ b/src/com/android/gallery3d/app/MovieActivity.java @@ -52,6 +52,7 @@ import android.os.Bundle; import android.os.SystemProperties; import android.provider.MediaStore; import android.provider.OpenableColumns; +import android.view.Display; import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -109,7 +110,6 @@ public class MovieActivity extends AbstractPermissionActivity { private boolean mIsHeadsetOn = false; private boolean mVirtualizerSupported = false; private boolean mBassBoostSupported = false; - private boolean mUserPresentReceived = false; static enum Key { global_enabled, bb_strength, virt_strength @@ -746,21 +746,21 @@ public class MovieActivity extends AbstractPermissionActivity { @Override public void onReceive(Context context, Intent intent) { + Display display = getWindowManager().getDefaultDisplay(); if (LOG) { Log.v(TAG, "onReceive(" + intent.getAction() + ") mControlResumed=" + mControlResumed); } - if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) { + if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction()) && + display.getState() == Display.STATE_OFF) { // Only stop video. - if (mControlResumed && mUserPresentReceived) { + if (mControlResumed) { mPlayer.onStop(); - mUserPresentReceived = false; mControlResumed = false; } } else if (Intent.ACTION_USER_PRESENT.equals(intent.getAction())) { - if (!mControlResumed && !mUserPresentReceived) { + if (!mControlResumed) { mPlayer.onResume(); - mUserPresentReceived = true; mControlResumed = true; } } diff --git a/src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java b/src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java old mode 100644 new mode 100755 index 6b5a9bef0..0768e78fc --- a/src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java +++ b/src/org/codeaurora/gallery3d/video/CodeauroraVideoView.java @@ -461,6 +461,17 @@ public class CodeauroraVideoView extends SurfaceView implements MediaPlayerContr clearVideoInfo(); if (mUri == null || mSurfaceHolder == null || mTargetState == STATE_ERROR) { // not ready for playback just yet, will try again later + if (mSurfaceHolder == null) { + setVisibility(GONE); + getHolder().removeCallback(mSHCallback); + getHolder().addCallback(mSHCallback); + postDelayed(new Runnable() { + @Override + public void run() { + setVisibility(VISIBLE); + } + },500); + } return; } -- cgit v1.2.3 From 7c6746586829914560ac22dd2d5dc7cde4dad240 Mon Sep 17 00:00:00 2001 From: junjiez Date: Tue, 13 Nov 2018 17:01:26 +0800 Subject: SnapdraongGallery:Fix FileProvider permission Set exported property of FileProvider to true to avoid SecurityException when gallery is called from 3rd-party app. Change-Id: Ie22398753bd7482b02027c5243d74702330b3e19 CRs-Fixed: 2337962 --- AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 25371f922..3902bc03e 100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -319,7 +319,7 @@ Date: Tue, 4 Dec 2018 22:15:25 -0800 Subject: Revert "SnapdraongGallery:Fix FileProvider permission" This reverts commit 7c6746586829914560ac22dd2d5dc7cde4dad240. Change-Id: I8fa15a822e8d31298596e0caa81b91410445333d --- AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 3902bc03e..25371f922 100755 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -319,7 +319,7 @@