android Jelly Bean版本如何将camera service修改为强占式
1. 修改CameraService.cpp (frameworks/av/services/camera/libcameraservice/)
文件的connect()方法,将
原来的
Mutex::Autolock lock(mServiceLock);
if (mClient[cameraId] != 0) {
client = mClient[cameraId].promote();
if (client != 0) {
if (cameraClient->asBinder() == client->getCameraClient()->asBinder()) {
LOG1("CameraService::connect X (pid %d) (the same client)",
callingPid);
return client;
} else {
ALOGW("CameraService::connect X (pid %d) rejected (existing client).",
callingPid);
return NULL;
}
}
mClient[cameraId].clear();
}
修改为:
if (mClient[cameraId] != 0) {
client = mClient[cameraId].promote();
if (client != 0) {
LOG1("CameraService::connect X (pid %d) disconnect the old client", callingPid);
client->disconnect();
}
mClient[cameraId].clear();
}
Mutex::Autolock lock(mServiceLock);
2. 修改CameraClient.cpp(frameworks/av/services/camera/libcameraservice/)
文件的disconnect()方法:
将原来的:
if (callingPid != mClientPid && callingPid != mServicePid) {
ALOGW("different client - don‘t disconnect");
return;
}
修改为:
if (callingPid != mClientPid && callingPid != mServicePid) {
ALOGW("different client but preemptive camera service! ");
//return;
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。