Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPEG library inclusion #1246

Open
wants to merge 2 commits into
base: celadon/r/mr0/stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
From 750a6d205960e2edaaa3e5b7ff8400bbac2daac5 Mon Sep 17 00:00:00 2001
From: gkdeepa <[email protected]>
Date: Wed, 3 Nov 2021 14:11:10 +0530
Subject: [PATCH] check orientation in camera 90deg case

Tracked-On:
---
...ck-orientation-in-camera-180deg-case.patch | 50 +++++++++++++++++++
.../api1/client2/Parameters.cpp | 10 ++--
2 files changed, 56 insertions(+), 4 deletions(-)
create mode 100644 services/camera/libcameraservice/api1/0001-check-orientation-in-camera-180deg-case.patch

diff --git a/services/camera/libcameraservice/api1/0001-check-orientation-in-camera-180deg-case.patch b/services/camera/libcameraservice/api1/0001-check-orientation-in-camera-180deg-case.patch
new file mode 100644
index 0000000000..42b83e5fa1
--- /dev/null
+++ b/services/camera/libcameraservice/api1/0001-check-orientation-in-camera-180deg-case.patch
@@ -0,0 +1,50 @@
+From 9aa1a62d7206fdd32ea61eaecea46a58d5915686 Mon Sep 17 00:00:00 2001
+From: gkdeepa <[email protected]>
+Date: Wed, 3 Nov 2021 14:11:10 +0530
+Subject: [PATCH] check orientation in camera 180deg case
+
+Tracked-On:
+---
+ .../camera/libcameraservice/api1/client2/Parameters.cpp | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp
+index dbc863b3ad..9979610ca0 100644
+--- a/services/camera/libcameraservice/api1/client2/Parameters.cpp
++++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp
+@@ -16,7 +16,7 @@
+
+ #define LOG_TAG "Camera2-Parameters"
+ #define ATRACE_TAG ATRACE_TAG_CAMERA
+-// #define LOG_NDEBUG 0
++#define LOG_NDEBUG 0
+
+ #include <utils/Log.h>
+ #include <utils/Trace.h>
+@@ -2828,10 +2828,12 @@ bool Parameters::boolFromString(const char *boolStr) {
+ }
+
+ int Parameters::degToTransform(int degrees, bool mirror) {
++ ALOGE("degrees and mirror %d %d ",degrees, mirror);
+ if (!mirror) {
+ if (degrees == 0) return 0;
+ else if (degrees == 90) return HAL_TRANSFORM_ROT_90;
+- else if (degrees == 180) return HAL_TRANSFORM_ROT_180;
++ //else if (degrees == 180) return HAL_TRANSFORM_ROT_180;
++ else if (degrees == 180) return 0;
+ else if (degrees == 270) return HAL_TRANSFORM_ROT_270;
+ } else { // Do mirror (horizontal flip)
+ if (degrees == 0) { // FLIP_H and ROT_0
+@@ -2839,7 +2841,8 @@ int Parameters::degToTransform(int degrees, bool mirror) {
+ } else if (degrees == 90) { // FLIP_H and ROT_90
+ return HAL_TRANSFORM_FLIP_H | HAL_TRANSFORM_ROT_90;
+ } else if (degrees == 180) { // FLIP_H and ROT_180
+- return HAL_TRANSFORM_FLIP_V;
++ return 0;
++ //return HAL_TRANSFORM_FLIP_V;
+ } else if (degrees == 270) { // FLIP_H and ROT_270
+ return HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_ROT_90;
+ }
+--
+2.17.1
+
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp
index dbc863b3ad..487e7cd426 100644
--- a/services/camera/libcameraservice/api1/client2/Parameters.cpp
+++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp
@@ -16,7 +16,7 @@

#define LOG_TAG "Camera2-Parameters"
#define ATRACE_TAG ATRACE_TAG_CAMERA
-// #define LOG_NDEBUG 0
+#define LOG_NDEBUG 0

#include <utils/Log.h>
#include <utils/Trace.h>
@@ -2828,18 +2828,20 @@ bool Parameters::boolFromString(const char *boolStr) {
}

int Parameters::degToTransform(int degrees, bool mirror) {
+ ALOGE("degrees and mirror %d %d ",degrees, mirror);
if (!mirror) {
if (degrees == 0) return 0;
- else if (degrees == 90) return HAL_TRANSFORM_ROT_90;
+ else if (degrees == 90) return HAL_TRANSFORM_ROT_270;
else if (degrees == 180) return HAL_TRANSFORM_ROT_180;
else if (degrees == 270) return HAL_TRANSFORM_ROT_270;
} else { // Do mirror (horizontal flip)
if (degrees == 0) { // FLIP_H and ROT_0
return HAL_TRANSFORM_FLIP_H;
} else if (degrees == 90) { // FLIP_H and ROT_90
- return HAL_TRANSFORM_FLIP_H | HAL_TRANSFORM_ROT_90;
+ return HAL_TRANSFORM_FLIP_H ;
} else if (degrees == 180) { // FLIP_H and ROT_180
- return HAL_TRANSFORM_FLIP_V;
+ return 0;
+ //return HAL_TRANSFORM_FLIP_V;
} else if (degrees == 270) { // FLIP_H and ROT_270
return HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_ROT_90;
}
--
2.17.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
From 2713d08ab434c8e16f6d7d1f15fc91efd7e8b119 Mon Sep 17 00:00:00 2001
From: gkdeepa <[email protected]>
Date: Thu, 28 Oct 2021 13:41:35 +0530
Subject: [PATCH] framework logs and WA

Tracked-On:
---
core/jni/android_hardware_Camera.cpp | 33 +++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index bc69735d7453..d46c77396960 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -40,7 +40,7 @@ enum {
// Keep up to date with Camera.java
CAMERA_HAL_API_VERSION_NORMAL_CONNECT = -2,
};
-
+int checkflag=0;
struct fields_t {
jfieldID context;
jfieldID facing;
@@ -544,9 +544,14 @@ static void android_hardware_Camera_getCameraInfo(JNIEnv *env, jobject thiz,
jniThrowRuntimeException(env, "Fail to get camera info");
return;
}
+ if(checkflag == 1){
+ if(cameraInfo.facing == 1)
+ env->SetIntField(info_obj, fields.orientation, 270);
+ }
+ else{
+ env->SetIntField(info_obj, fields.orientation, cameraInfo.orientation);
+ }
env->SetIntField(info_obj, fields.facing, cameraInfo.facing);
- env->SetIntField(info_obj, fields.orientation, cameraInfo.orientation);
-
char value[PROPERTY_VALUE_MAX];
property_get("ro.camera.sound.forced", value, "0");
jboolean canDisableShutterSound = (strncmp(value, "0", 2) == 0);
@@ -558,6 +563,7 @@ static void android_hardware_Camera_getCameraInfo(JNIEnv *env, jobject thiz,
static jint android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz,
jobject weak_this, jint cameraId, jint halVersion, jstring clientPackageName)
{
+
// Convert jstring to String16
const char16_t *rawClientName = reinterpret_cast<const char16_t*>(
env->GetStringChars(clientPackageName, NULL));
@@ -565,13 +571,25 @@ static jint android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz,
String16 clientName(rawClientName, rawClientNameLen);
env->ReleaseStringChars(clientPackageName,
reinterpret_cast<const jchar*>(rawClientName));
+ checkflag=0;
+ //check app orientation
+ const char *nativeString = env->GetStringUTFChars(clientPackageName, NULL);
+ // use your string

+ if (!strcmp(nativeString, "cn.eeo.classin"))
+ {
+ //only set for classin app
+ checkflag =1;
+ }
+ env->ReleaseStringUTFChars(clientPackageName, nativeString);
sp<Camera> camera;
if (halVersion == CAMERA_HAL_API_VERSION_NORMAL_CONNECT) {
// Default path: hal version is don't care, do normal camera connect.
+ ALOGE("connect Default path: ");
camera = Camera::connect(cameraId, clientName,
Camera::USE_CALLING_UID, Camera::USE_CALLING_PID);
} else {
+ ALOGE("connect Default path connectLegacy: ");
jint status = Camera::connectLegacy(cameraId, halVersion, clientName,
Camera::USE_CALLING_UID, camera);
if (status != NO_ERROR) {
@@ -580,6 +598,7 @@ static jint android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz,
}

if (camera == NULL) {
+ ALOGE("camera is null");
return -EACCES;
}

@@ -603,7 +622,6 @@ static jint android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz,

// save context in opaque field
env->SetLongField(thiz, fields.context, (jlong)context.get());
-
// Update default display orientation in case the sensor is reverse-landscape
CameraInfo cameraInfo;
status_t rc = Camera::getCameraInfo(cameraId, &cameraInfo);
@@ -611,6 +629,12 @@ static jint android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz,
ALOGE("%s: getCameraInfo error: %d", __FUNCTION__, rc);
return rc;
}
+ if(checkflag == 1){
+ if(cameraInfo.facing == CAMERA_FACING_FRONT)
+ cameraInfo.orientation = 270;
+ }
+ else
+ cameraInfo.orientation = 0;
int defaultOrientation = 0;
switch (cameraInfo.orientation) {
case 0:
@@ -633,7 +657,6 @@ static jint android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz,
break;
}
if (defaultOrientation != 0) {
- ALOGV("Setting default display orientation to %d", defaultOrientation);
rc = camera->sendCommand(CAMERA_CMD_SET_DISPLAY_ORIENTATION,
defaultOrientation, 0);
if (rc != NO_ERROR) {
--
2.17.1

47 changes: 47 additions & 0 deletions aosp_diff/caas_cfc/frameworks/base/0005-WA-camera-rotation.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From 453eb2d6b22fc4744156d9ee447d9e3e5fb06766 Mon Sep 17 00:00:00 2001
From: "Yang, Dong" <[email protected]>
Date: Tue, 2 Nov 2021 08:11:27 +0800
Subject: [PATCH] WA camera rotation

based on WA patch1, change camera rotation from 270 to 180 for classin
APP

Tracked-On:
Signed-off-by: Yang, Dong <[email protected]>
---
core/jni/android_hardware_Camera.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index d46c77396960..51dd84f8560f 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -545,12 +545,15 @@ static void android_hardware_Camera_getCameraInfo(JNIEnv *env, jobject thiz,
return;
}
if(checkflag == 1){
- if(cameraInfo.facing == 1)
+ if(cameraInfo.facing == 1)
+ env->SetIntField(info_obj, fields.orientation, 180);
+ else
env->SetIntField(info_obj, fields.orientation, 270);
}
else{
env->SetIntField(info_obj, fields.orientation, cameraInfo.orientation);
}
+
env->SetIntField(info_obj, fields.facing, cameraInfo.facing);
char value[PROPERTY_VALUE_MAX];
property_get("ro.camera.sound.forced", value, "0");
@@ -631,7 +634,7 @@ static jint android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz,
}
if(checkflag == 1){
if(cameraInfo.facing == CAMERA_FACING_FRONT)
- cameraInfo.orientation = 270;
+ cameraInfo.orientation = 180;
}
else
cameraInfo.orientation = 0;
--
2.17.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
From 8ccbbf500a40f220383f5a2b00a0627749510db5 Mon Sep 17 00:00:00 2001
From: gkdeepa <[email protected]>
Date: Sat, 23 Oct 2021 11:00:30 +0530
Subject: [PATCH] default vhal to 1 camera

Tracked-On:
---
include/VirtualCameraFactory.h | 1 -
src/VirtualCameraFactory.cpp | 6 +++---
src/VirtualFakeCamera3.cpp | 6 +++---
3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/include/VirtualCameraFactory.h b/include/VirtualCameraFactory.h
index 183ce48..81d26d7 100644
--- a/include/VirtualCameraFactory.h
+++ b/include/VirtualCameraFactory.h
@@ -107,7 +107,6 @@ public:
* callback.
*/
void getVendorTagOps(vendor_tag_ops_t *ops);
-
public:
/****************************************************************************
* Camera HAL API callbacks.
diff --git a/src/VirtualCameraFactory.cpp b/src/VirtualCameraFactory.cpp
index 8454fa2..1e30e93 100644
--- a/src/VirtualCameraFactory.cpp
+++ b/src/VirtualCameraFactory.cpp
@@ -206,7 +206,7 @@ int VirtualCameraFactory::cameraDeviceOpen(int cameraId, hw_device_t **device) {
getVirtualCameraNum());
return -ENODEV;
}
-
+ ALOGE("Deepa cameraIdcheck is %d",cameraId);
return mVirtualCameras[cameraId]->connectCamera(device);
}

@@ -311,10 +311,10 @@ void VirtualCameraFactory::createFakeCamera(std::shared_ptr<CameraSocketServerTh
case 3: {
mVirtualCameras[mVirtualCameraNum] =
#ifdef ENABLE_FFMPEG
- new VirtualFakeCamera3(mVirtualCameraNum, backCamera, &HAL_MODULE_INFO_SYM.common,
+ new VirtualFakeCamera3(mVirtualCameraNum, /*backCamera*/false, &HAL_MODULE_INFO_SYM.common,
socket_server, decoder, std::ref(mCameraSessionState));
#else
- new VirtualFakeCamera3(mVirtualCameraNum, backCamera, &HAL_MODULE_INFO_SYM.common,
+ new VirtualFakeCamera3(mVirtualCameraNum, /*backCamera*/false, &HAL_MODULE_INFO_SYM.common,
socket_server, std::ref(mCameraSessionState));
#endif
} break;
diff --git a/src/VirtualFakeCamera3.cpp b/src/VirtualFakeCamera3.cpp
index 3743cd1..92c0450 100644
--- a/src/VirtualFakeCamera3.cpp
+++ b/src/VirtualFakeCamera3.cpp
@@ -57,7 +57,6 @@ buffer_handle_t bufferHandle;
buffer_handle_t bufferHandle1;
buffer_handle_t bufferHandle2;
buffer_handle_t bufferHandle_3;
-
namespace android {

using namespace socket;
@@ -122,7 +121,6 @@ VirtualFakeCamera3::VirtualFakeCamera3(int cameraId, bool facingBack, struct hw_
#endif
ALOGI("Constructing virtual fake camera 3: ID %d, facing %s", mCameraID,
facingBack ? "back" : "front");
-
mControlMode = ANDROID_CONTROL_MODE_AUTO;
mFacePriority = false;
mAeMode = ANDROID_CONTROL_AE_MODE_ON;
@@ -1344,8 +1342,10 @@ status_t VirtualFakeCamera3::constructStaticInfo() {
orientation = 270;
} else {
ALOGV("persist.remote.camera.orientation: landscape");
- orientation = 0;
+ //hardcode the orientation to 270 deg
+ orientation = 270;
}
+
ADD_STATIC_ENTRY(ANDROID_SENSOR_ORIENTATION, &orientation, 1);

static const uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME;
--
2.17.1

Loading
Loading