Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69b94f7c authored by Igor Murashkin's avatar Igor Murashkin
Browse files

SmartCamera: Fix to build against latest camera2 api

Bug: 10818732
Change-Id: I536021b9663331532e2f4c21a4fc0f3de5da9aa9
parent bd7f343c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ LOCAL_MODULE_TAGS := tests
LOCAL_PROGUARD_ENABLED := disabled

# comment it out for now since we need use some hidden APIs
LOCAL_SDK_VERSION := current
# LOCAL_SDK_VERSION := current

LOCAL_STATIC_JAVA_LIBRARIES := android-ex-camera2

+7 −5
Original line number Diff line number Diff line
@@ -20,9 +20,10 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.ImageFormat;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CameraProperties;
import android.hardware.camera2.CaptureFailure;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.CaptureResult;
import android.os.Handler;
@@ -56,7 +57,7 @@ public class Camera2Source extends Filter implements Allocation.OnBufferAvailabl
    private CameraDevice mCamera;
    private RenderScript mRS;
    private Surface mSurface;
    private CameraProperties mProperties;
    private CameraCharacteristics mProperties;
    private CameraTestThread mLooperThread;
    private int mHeight = 480;
    private int mWidth = 640;
@@ -92,7 +93,8 @@ public class Camera2Source extends Filter implements Allocation.OnBufferAvailabl
        }

        @Override
        public void onCaptureFailed(CameraDevice camera, CaptureRequest request) {
        public void onCaptureFailed(CameraDevice camera, CaptureRequest request,
                CaptureFailure failure) {
            // TODO Auto-generated method stub
            Log.v(TAG, "onCaptureFailed is being called");
        }
@@ -198,7 +200,7 @@ public class Camera2Source extends Filter implements Allocation.OnBufferAvailabl
        }
        mProperties = null;
        try {
            mProperties = mCamera.getProperties();
            mProperties = mCameraManager.getCameraCharacteristics(mCamera.getId());
        } catch (CameraAccessException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
@@ -228,7 +230,7 @@ public class Camera2Source extends Filter implements Allocation.OnBufferAvailabl

            // FIXME: Hardcoded value because ORIENTATION returns null, Qualcomm
            // bug
            Integer orientation = mProperties.get(CameraProperties.SENSOR_ORIENTATION);
            Integer orientation = mProperties.get(CameraCharacteristics.SENSOR_ORIENTATION);
            float temp;
            if (orientation != null) {
                temp = orientation.floatValue();
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := tests

LOCAL_SDK_VERSION := current
# LOCAL_SDK_VERSION := current

LOCAL_PACKAGE_NAME := SmartCamera-tests