From 5bb6fe377c000e4287432518080968344583357a Mon Sep 17 00:00:00 2001 From: zfu Date: Mon, 7 Mar 2016 15:14:53 +0800 Subject: Fix android.process.media got killed when capture android.process.media has a very low priority as Cached app in background. When snapdragon camera using ContentResolver and do query/updating it will promot to foreground priority, but there may have some race condition that lmk in the progress to kill media, and AMS want set to foreground. So, keep this process as foreground during the whole ActivityLife time, by hold a query cursor onCreate and destory onStop. CRs-Fixed: 984061 Change-Id: I530fddfa240030ad84dc09b599ad783f6a2f21e0 --- src/com/android/camera/CameraActivity.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index 186fa514a..a9a78e7b3 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -252,6 +252,7 @@ public class CameraActivity extends Activity // FilmStripView.setDataAdapter fires 2 onDataLoaded calls before any data is actually loaded // Keep track of data request here to avoid creating useless UpdateThumbnailTask. private boolean mDataRequested; + private Cursor mCursor; private WakeLock mWakeLock; private Context mContext; @@ -1437,6 +1438,8 @@ public class CameraActivity extends Activity mSecureCamera = intent.getBooleanExtra(SECURE_CAMERA_EXTRA, false); } + mCursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null, null, null, null); + if (mSecureCamera) { // Change the window flags so that secure camera can show when locked Window win = getWindow(); @@ -1757,6 +1760,8 @@ public class CameraActivity extends Activity getContentResolver().unregisterContentObserver(mLocalVideosObserver); unregisterReceiver(mSDcardMountedReceiver); + mCursor.close(); + mCursor=null; super.onDestroy(); } -- cgit v1.2.3