|
|
|
@ -1554,6 +1554,24 @@ Status CameraService::setTorchMode(const String16& cameraId, bool enabled,
|
|
|
|
|
|
|
|
|
|
Status CameraService::notifySystemEvent(int32_t eventId,
|
|
|
|
|
const std::vector<int32_t>& args) {
|
|
|
|
|
const int pid = getCallingPid();
|
|
|
|
|
const int selfPid = getpid();
|
|
|
|
|
|
|
|
|
|
// Permission checks
|
|
|
|
|
if (pid != selfPid) {
|
|
|
|
|
// Ensure we're being called by system_server, or similar process with
|
|
|
|
|
// permissions to notify the camera service about system events
|
|
|
|
|
if (!checkCallingPermission(
|
|
|
|
|
String16("android.permission.CAMERA_SEND_SYSTEM_EVENTS"))) {
|
|
|
|
|
const int uid = getCallingUid();
|
|
|
|
|
ALOGE("Permission Denial: cannot send updates to camera service about system"
|
|
|
|
|
" events from pid=%d, uid=%d", pid, uid);
|
|
|
|
|
return STATUS_ERROR_FMT(ERROR_PERMISSION_DENIED,
|
|
|
|
|
"No permission to send updates to camera service about system events"
|
|
|
|
|
" from pid=%d, uid=%d", pid, uid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ATRACE_CALL();
|
|
|
|
|
|
|
|
|
|
switch(eventId) {
|
|
|
|
@ -1955,8 +1973,6 @@ void CameraService::logServiceError(const char* msg, int errorCode) {
|
|
|
|
|
status_t CameraService::onTransact(uint32_t code, const Parcel& data, Parcel* reply,
|
|
|
|
|
uint32_t flags) {
|
|
|
|
|
|
|
|
|
|
const int pid = getCallingPid();
|
|
|
|
|
const int selfPid = getpid();
|
|
|
|
|
|
|
|
|
|
// Permission checks
|
|
|
|
|
switch (code) {
|
|
|
|
@ -1984,20 +2000,6 @@ status_t CameraService::onTransact(uint32_t code, const Parcel& data, Parcel* re
|
|
|
|
|
}
|
|
|
|
|
return NO_ERROR;
|
|
|
|
|
}
|
|
|
|
|
case BnCameraService::NOTIFYSYSTEMEVENT: {
|
|
|
|
|
if (pid != selfPid) {
|
|
|
|
|
// Ensure we're being called by system_server, or similar process with
|
|
|
|
|
// permissions to notify the camera service about system events
|
|
|
|
|
if (!checkCallingPermission(
|
|
|
|
|
String16("android.permission.CAMERA_SEND_SYSTEM_EVENTS"))) {
|
|
|
|
|
const int uid = getCallingUid();
|
|
|
|
|
ALOGE("Permission Denial: cannot send updates to camera service about system"
|
|
|
|
|
" events from pid=%d, uid=%d", pid, uid);
|
|
|
|
|
return PERMISSION_DENIED;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return BnCameraService::onTransact(code, data, reply, flags);
|
|
|
|
|