summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamera Software Integration <camswint@localhost>2016-12-22 22:55:16 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-12-22 22:55:16 -0800
commitaedc2351ec569c670dd167220cb2f2ca5dc7d71e (patch)
treee46f3736b4158f82219acda591bfe5523a71c3be
parent1fd9901abce1ff4eb09b5aaa3be22e1a0d846ff7 (diff)
parentf015351c73740b25cd65d934dfc6a44c7367dc1c (diff)
downloadandroid_packages_apps_Snap-aedc2351ec569c670dd167220cb2f2ca5dc7d71e.tar.gz
android_packages_apps_Snap-aedc2351ec569c670dd167220cb2f2ca5dc7d71e.tar.bz2
android_packages_apps_Snap-aedc2351ec569c670dd167220cb2f2ca5dc7d71e.zip
Merge "SnapdragonCamera: Fix FC NullpointerException in PanoCapture" into camera.lnx.1.0-dev.1.0
-rw-r--r--src/com/android/camera/ui/PanoCaptureProcessView.java30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/com/android/camera/ui/PanoCaptureProcessView.java b/src/com/android/camera/ui/PanoCaptureProcessView.java
index 2b37fd61e..95e9a095f 100644
--- a/src/com/android/camera/ui/PanoCaptureProcessView.java
+++ b/src/com/android/camera/ui/PanoCaptureProcessView.java
@@ -120,6 +120,7 @@ public class PanoCaptureProcessView extends View implements SensorEventListener
private static final boolean DEBUG = false; //TODO: This has to be false before release
private BitmapArrayOutputStream mBitmapStream;
private static boolean mIsSupported = false;
+ private Object mBitmapStreamLock = new Object();
private boolean mIsFrameProcessing = false;
enum PANO_STATUS {
@@ -337,13 +338,15 @@ public class PanoCaptureProcessView extends View implements SensorEventListener
public void onPause() {
mSensorManager.unregisterListener(this, mRotationSensor);
- if(mBitmapStream != null) {
- try {
- mBitmapStream.close();
- } catch (IOException e) {
- //Ignore
+ synchronized (mBitmapStreamLock) {
+ if(mBitmapStream != null) {
+ try {
+ mBitmapStream.close();
+ } catch (IOException e) {
+ //Ignore
+ }
+ mBitmapStream = null;
}
- mBitmapStream = null;
}
}
@@ -510,13 +513,16 @@ public class PanoCaptureProcessView extends View implements SensorEventListener
}
private void doTask(BitmapTask bitmapTask) {
- if(mBitmapStream == null) {
- mBitmapStream = new BitmapArrayOutputStream(1024*1204);
+ int rtv = -1;
+ synchronized (mBitmapStreamLock) {
+ if(mBitmapStream == null) {
+ mBitmapStream = new BitmapArrayOutputStream(1024*1204);
+ }
+ mBitmapStream.reset();
+ bitmapTask.bitmap.compress(Bitmap.CompressFormat.JPEG, 100, mBitmapStream);
+ rtv = callNativeProcessKeyFrame(mBitmapStream.toByteArray(), mBitmapStream.size(),
+ bitmapTask.x, bitmapTask.y, 0, bitmapTask.dir);
}
- mBitmapStream.reset();
- bitmapTask.bitmap.compress(Bitmap.CompressFormat.JPEG, 100, mBitmapStream);
- int rtv = callNativeProcessKeyFrame(mBitmapStream.toByteArray(), mBitmapStream.size(),
- bitmapTask.x, bitmapTask.y, 0, bitmapTask.dir);
if(rtv < 0) {
mShouldFinish = true;
stopPano(false, mActivity.getResources().getString(R.string.panocapture_direction_is_changed));