summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2015-06-03 16:03:30 -0700
committerEino-Ville Talvala <etalvala@google.com>2015-06-05 17:19:39 -0700
commite3afb2cc438b76ae433c8c40ceabf0457ad7a678 (patch)
tree4410c41bb351d0b646e5d156a0e8fbd4cb69e533 /camera
parentafd492436efc7f66b958da14659b52232efa5910 (diff)
downloadframeworks_av-e3afb2cc438b76ae433c8c40ceabf0457ad7a678.zip
frameworks_av-e3afb2cc438b76ae433c8c40ceabf0457ad7a678.tar.gz
frameworks_av-e3afb2cc438b76ae433c8c40ceabf0457ad7a678.tar.bz2
Camera: Change error for app ops reject, propagate binder errors
INVALID_OPERATION surfaces as an non-specific device-level error to applications in the onError callback. This is not a condition apps targeting camera2 in L will generally have to deal with. Instead, return -EACCESS which maps to throwing CameraAccessException.CAMERA_DISABLED, same as disabling camera access with DevicePolicyManager. The old camera API converts any error code to -EACCESS at the JNI layer, so this doesn't change anything for the older API. Also update the various native ICameraService binder connect calls to check for the transact error code, and return it if it is not OK. Without this, PERMISSION_DENIED transact errors from the camera service cannot be distinguished from CAMERA_DISABLED errors in some codepaths. Bug: 21604925 Change-Id: Ifccc8989b8c20653429e2d3e51dba7abb2be9c35
Diffstat (limited to 'camera')
-rw-r--r--camera/Camera.cpp3
-rw-r--r--camera/ICameraService.cpp21
2 files changed, 17 insertions, 7 deletions
diff --git a/camera/Camera.cpp b/camera/Camera.cpp
index 3a9fb4c..9bf3134 100644
--- a/camera/Camera.cpp
+++ b/camera/Camera.cpp
@@ -97,7 +97,8 @@ status_t Camera::connectLegacy(int cameraId, int halVersion,
c->mStatus = NO_ERROR;
camera = c;
} else {
- ALOGW("An error occurred while connecting to camera: %d", cameraId);
+ ALOGW("An error occurred while connecting to camera %d: %d (%s)",
+ cameraId, status, strerror(-status));
c.clear();
}
return status;
diff --git a/camera/ICameraService.cpp b/camera/ICameraService.cpp
index 0071e70..7bb24ee 100644
--- a/camera/ICameraService.cpp
+++ b/camera/ICameraService.cpp
@@ -175,10 +175,13 @@ public:
data.writeInt32(cameraId);
data.writeString16(clientPackageName);
data.writeInt32(clientUid);
- remote()->transact(BnCameraService::CONNECT, data, &reply);
+
+ status_t status;
+ status = remote()->transact(BnCameraService::CONNECT, data, &reply);
+ if (status != OK) return status;
if (readExceptionCode(reply)) return -EPROTO;
- status_t status = reply.readInt32();
+ status = reply.readInt32();
if (reply.readInt32() != 0) {
device = interface_cast<ICamera>(reply.readStrongBinder());
}
@@ -198,10 +201,13 @@ public:
data.writeInt32(halVersion);
data.writeString16(clientPackageName);
data.writeInt32(clientUid);
- remote()->transact(BnCameraService::CONNECT_LEGACY, data, &reply);
+
+ status_t status;
+ status = remote()->transact(BnCameraService::CONNECT_LEGACY, data, &reply);
+ if (status != OK) return status;
if (readExceptionCode(reply)) return -EPROTO;
- status_t status = reply.readInt32();
+ status = reply.readInt32();
if (reply.readInt32() != 0) {
device = interface_cast<ICamera>(reply.readStrongBinder());
}
@@ -237,10 +243,13 @@ public:
data.writeInt32(cameraId);
data.writeString16(clientPackageName);
data.writeInt32(clientUid);
- remote()->transact(BnCameraService::CONNECT_DEVICE, data, &reply);
+
+ status_t status;
+ status = remote()->transact(BnCameraService::CONNECT_DEVICE, data, &reply);
+ if (status != OK) return status;
if (readExceptionCode(reply)) return -EPROTO;
- status_t status = reply.readInt32();
+ status = reply.readInt32();
if (reply.readInt32() != 0) {
device = interface_cast<ICameraDeviceUser>(reply.readStrongBinder());
}