本文整理汇总了C++中LOGE_IF函数的典型用法代码示例。如果您正苦于以下问题:C++ LOGE_IF函数的具体用法?C++ LOGE_IF怎么用?C++ LOGE_IF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOGE_IF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: out_standby_stream_locked
static int out_standby_stream_locked(struct astream_out *out)
{
int ret = 0;
int attempts = MAX_WRITE_COMPLETION_ATTEMPTS;
if (out->standby || !out->data)
return 0;
out->standby = true;
/* wait for write completion if needed */
while (out->write_busy && attempts--) {
ret = pthread_cond_timeout_np(&out->write_cond,
&out->lock,
BUF_WRITE_COMPLETION_TIMEOUT_MS);
LOGE_IF(ret != 0, "out_standby_stream_locked() wait cond error %d", ret);
}
LOGE_IF(attempts == 0, "out_standby_stream_locked() a2dp_write() would not stop!!!");
LOGV_IF(!out->bt_enabled, "Standby skip stop: enabled %d", out->bt_enabled);
if (out->bt_enabled) {
ret = a2dp_stop(out->data);
}
release_wake_lock(A2DP_WAKE_LOCK_NAME);
return ret;
}
示例2: OVASSERT
bool OverlayImpl<P0, P1, P2>::reconfigure(const utils::ReconfArgs& args)
{
OVASSERT(mPipe0 && mPipe1 && mPipe2,
"%s: Pipes are null p0=%p p1=%p p2=%p",
__FUNCTION__, mPipe0, mPipe1, mPipe2);
switch(args.reconf) {
case utils::RECONFIG_ON:
{
LOGE_IF(DEBUG_OVERLAY, "%s reconfig is on", __FUNCTION__);
// reconfig the buffers here
utils::PlayInfo play;
if(!mReconf.setupBuf(args, play)) {
LOGE("%s failed to reconf setupargs", __FUNCTION__);
return false;
}
// regular setXXX interface calls here
utils::ReconfArgs reargs(args);
reargs.play = play;
utils::PipeArgs parg0(mPipe0->getArgs());
parg0 = reargs;
utils::PipeArgs parg1(mPipe1->getArgs());
parg1 = reargs;
utils::PipeArgs parg2(mPipe2->getArgs());
parg2 = reargs;
utils::PipeArgs pargs[utils::MAX_PIPES] = {parg0, parg1, parg2};
if(!this->setSource(pargs)) {
LOGE("%s failed to setCrop", __FUNCTION__);
return false;
}
if(!this->setCrop(reargs.crop)) {
LOGE("%s failed to setCrop", __FUNCTION__);
return false;
}
if(!this->setPosition(reargs.pos)) {
LOGE("%s failed to setPosition", __FUNCTION__);
return false;
}
utils::Params param(utils::OVERLAY_TRANSFORM, reargs.orientation);
if(!this->setParameter(param)) {
LOGE("%s failed to setParameter", __FUNCTION__);
return false;
}
if(!this->commit()){
LOGE("%s failed to commit", __FUNCTION__);
return false;
}
break;
}
case utils::RECONFIG_OFF:
LOGE_IF(DEBUG_OVERLAY, "%s reconfig is off", __FUNCTION__);
mReconf.reset();
break;
default:
OVASSERT(false, "%s unknown reconfig state %d",
__FUNCTION__, args.reconf);
return false;
}
return true;
}
示例3: BASE
FramebufferNativeWindow::FramebufferNativeWindow()
: BASE(), fbDev(0), grDev(0), mUpdateOnDemand(false)
{
hw_module_t const* module;
if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module) == 0) {
int stride;
int err;
err = framebuffer_open(module, &fbDev);
LOGE_IF(err, "couldn't open framebuffer HAL (%s)", strerror(-err));
err = gralloc_open(module, &grDev);
LOGE_IF(err, "couldn't open gralloc HAL (%s)", strerror(-err));
// bail out if we can't initialize the modules
if (!fbDev || !grDev)
return;
mUpdateOnDemand = (fbDev->setUpdateRect != 0);
// initialize the buffer FIFO
mNumBuffers = 2;
mNumFreeBuffers = 2;
mBufferHead = mNumBuffers-1;
buffers[0] = new NativeBuffer(
fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB);
buffers[1] = new NativeBuffer(
fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB);
err = grDev->alloc(grDev,
fbDev->width, fbDev->height, fbDev->format,
GRALLOC_USAGE_HW_FB, &buffers[0]->handle, &buffers[0]->stride);
LOGE_IF(err, "fb buffer 0 allocation failed w=%d, h=%d, err=%s",
fbDev->width, fbDev->height, strerror(-err));
err = grDev->alloc(grDev,
fbDev->width, fbDev->height, fbDev->format,
GRALLOC_USAGE_HW_FB, &buffers[1]->handle, &buffers[1]->stride);
LOGE_IF(err, "fb buffer 1 allocation failed w=%d, h=%d, err=%s",
fbDev->width, fbDev->height, strerror(-err));
const_cast<uint32_t&>(android_native_window_t::flags) = fbDev->flags;
const_cast<float&>(android_native_window_t::xdpi) = fbDev->xdpi;
const_cast<float&>(android_native_window_t::ydpi) = fbDev->ydpi;
const_cast<int&>(android_native_window_t::minSwapInterval) =
fbDev->minSwapInterval;
const_cast<int&>(android_native_window_t::maxSwapInterval) =
fbDev->maxSwapInterval;
} else {
LOGE("Couldn't get gralloc module");
}
android_native_window_t::setSwapInterval = setSwapInterval;
android_native_window_t::dequeueBuffer = dequeueBuffer;
android_native_window_t::lockBuffer = lockBuffer;
android_native_window_t::queueBuffer = queueBuffer;
android_native_window_t::query = query;
android_native_window_t::perform = perform;
}
示例4: _l
void SensorService::cleanupConnection(SensorEventConnection* c)
{
Mutex::Autolock _l(mLock);
const wp<SensorEventConnection> connection(c);
size_t size = mActiveSensors.size();
LOGD_IF(DEBUG_CONNECTIONS, "%d active sensors", size);
for (size_t i=0 ; i<size ; ) {
int handle = mActiveSensors.keyAt(i);
if (c->hasSensor(handle)) {
LOGD_IF(DEBUG_CONNECTIONS, "%i: disabling handle=0x%08x", i, handle);
SensorInterface* sensor = mSensorMap.valueFor( handle );
LOGE_IF(!sensor, "mSensorMap[handle=0x%08x] is null!", handle);
if (sensor) {
sensor->activate(c, false);
}
}
SensorRecord* rec = mActiveSensors.valueAt(i);
LOGE_IF(!rec, "mActiveSensors[%d] is null (handle=0x%08x)!", i, handle);
LOGD_IF(DEBUG_CONNECTIONS,
"removing connection %p for sensor[%d].handle=0x%08x",
c, i, handle);
if (rec && rec->removeConnection(connection)) {
LOGD_IF(DEBUG_CONNECTIONS, "... and it was the last connection");
mActiveSensors.removeItemsAt(i, 1);
mActiveVirtualSensors.removeItem(handle);
delete rec;
size--;
} else {
i++;
}
}
mActiveConnections.remove(connection);
}
示例5: memset
void V4L2Camera::Uninit ()
{
int ret;
memset(&videoIn->buf,0,sizeof(videoIn->buf));
videoIn->buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
videoIn->buf.memory = V4L2_MEMORY_MMAP;
/* Dequeue everything */
int DQcount = nQueued - nDequeued;
for (int i = 0; i < DQcount-1; i++) {
ret = ioctl(fd, VIDIOC_DQBUF, &videoIn->buf);
LOGE_IF(ret < 0, "Uninit: VIDIOC_DQBUF Failed");
}
nQueued = 0;
nDequeued = 0;
/* Unmap buffers */
for (int i = 0; i < NB_BUFFER; i++)
if (videoIn->mem[i] != NULL) {
ret = munmap(videoIn->mem[i], videoIn->buf.length);
LOGE_IF(ret < 0, "Uninit: Unmap failed");
videoIn->mem[i] = NULL;
}
if (videoIn->tmpBuffer)
free(videoIn->tmpBuffer);
videoIn->tmpBuffer = NULL;
}
示例6: D
int sensors_poll_context_t::pollEvents(sensors_event_t* data, int count)
{
D("Entered : count = %d", count);
int nbEvents = 0;
int n = 0;
do {
// see if we have some leftover from the last poll()
for (int i=0 ; count && i<numSensorDrivers ; i++) {
SensorBase* const sensor(mSensors[i]);
if ((mPollFds[i].revents & POLLIN) || (sensor->hasPendingEvents())) {
int nb = sensor->readEvents(data, count); // num of evens received.
D("nb = %d.", nb);
#if defined(CALIBRATION_SUPPORT)
if(i == mma)
{
data->acceleration.x -= gAccelCaliData[0] * ACCELERATION_RATIO_ANDROID_TO_HW;
data->acceleration.y -= gAccelCaliData[1] * ACCELERATION_RATIO_ANDROID_TO_HW;
data->acceleration.z -= gAccelCaliData[2] * ACCELERATION_RATIO_ANDROID_TO_HW;
}
#endif
if (nb < count) {
// no more data for this sensor
mPollFds[i].revents = 0;
}
count -= nb;
nbEvents += nb;
data += nb;
D("count = %d, nbEvents = %d, data = 0x%p.", count, nbEvents, data);
}
}
if (count) {
// we still have some room, so try to see if we can get
// some events immediately or just wait if we don't have
// anything to return
n = poll(mPollFds, numFds, nbEvents ? 0 : -1);
if (n<0) {
LOGE("poll() failed (%s)", strerror(errno));
return -errno;
}
if (mPollFds[wake].revents & POLLIN) {
char msg;
int result = read(mPollFds[wake].fd, &msg, 1);
LOGE_IF(result<0, "error reading from wake pipe (%s)", strerror(errno));
LOGE_IF(msg != WAKE_MESSAGE, "unknown message on wake queue (0x%02x)", int(msg));
mPollFds[wake].revents = 0;
}
}
// if we have events and space, go read them
D("n =0x%x, count = 0x%x.", n, count);
} while (n && count);
D("to return : nbEvents = %d", nbEvents);
return nbEvents;
}
示例7: get_cblk
static volatile surface_flinger_cblk_t const * get_cblk()
{
if (gServerCblk == 0) {
sp<ISurfaceComposer> sm(getComposerService());
Mutex::Autolock _l(gLock);
if (gServerCblk == 0) {
gServerCblkMemory = sm->getCblk();
LOGE_IF(gServerCblkMemory==0, "Can't get server control block");
gServerCblk = (surface_flinger_cblk_t *)gServerCblkMemory->getBase();
LOGE_IF(gServerCblk==0, "Can't get server control block address");
}
}
return gServerCblk;
}
示例8: remote
void BpMemoryHeap::assertReallyMapped() const
{
if (mHeapId == -1) {
// remote call without mLock held, worse case scenario, we end up
// calling transact() from multiple threads, but that's not a problem,
// only mmap below must be in the critical section.
Parcel data, reply;
data.writeInterfaceToken(IMemoryHeap::getInterfaceDescriptor());
status_t err = remote()->transact(HEAP_ID, data, &reply);
int parcel_fd = reply.readFileDescriptor();
ssize_t size = reply.readInt32();
uint32_t flags = reply.readInt32();
LOGE_IF(err, "binder=%p transaction failed fd=%d, size=%ld, err=%d (%s)",
asBinder().get(), parcel_fd, size, err, strerror(-err));
int fd = dup( parcel_fd );
LOGE_IF(fd==-1, "cannot dup fd=%d, size=%ld, err=%d (%s)",
parcel_fd, size, err, strerror(errno));
int access = PROT_READ;
if (!(flags & READ_ONLY)) {
access |= PROT_WRITE;
}
Mutex::Autolock _l(mLock);
if (mHeapId == -1) {
mRealHeap = true;
mBase = mmap(0, size, access, MAP_SHARED, fd, 0);
if (mBase == MAP_FAILED) {
LOGE("cannot map BpMemoryHeap (binder=%p), size=%ld, fd=%d (%s)",
asBinder().get(), size, fd, strerror(errno));
close(fd);
} else {
if (flags & MAP_ONCE) {
//LOGD("pinning heap (binder=%p, size=%d, fd=%d",
// asBinder().get(), size, fd);
pin_heap();
}
mSize = size;
mFlags = flags;
android_atomic_write(fd, &mHeapId);
}
}
}
}
示例9: LOGD_IF
int CABL::Notify(uint32_t notification_type) {
int32_t ret = 0;
LOGD_IF(mDebug, "Starting %s ", __func__);
pthread_mutex_lock(&mCABLLock);
if (mHistStatus == 0 && (notification_type == NOTIFY_TYPE_BL_UPDATE || notification_type == NOTIFY_TYPE_UPDATE)) {
uint32_t level = get_backlight_level();
if (level <= mOEMParams.bl_min_level) {
LOGE_IF(mDebug, "New BL level %d lower than min level %u,"
" Skip this update for calc",
level, mOEMParams.bl_min_level);
if (mPrevNotify == NOTIFY_TYPE_SUSPEND)
ret = -1;
goto exit_early;
}
if (eStatus == CABL_OFF) {
pthread_mutex_unlock(&mCABLLock);
return ret;
}
LOGD_IF(mDebug, "Start notification received, start histogram");
ret = startHistogram();
if (0 == ret) {
mHistStatus = 1;
pthread_cond_signal(&mCABLCond);
}
} else if (mHistStatus == 1 &&
(notification_type == NOTIFY_TYPE_SUSPEND ||
notification_type == NOTIFY_TYPE_NO_UPDATE)) {
LOGD_IF(mDebug, "Stop notification received, stop histogram");
if(!stopHistogram(mHistStatus))
mHistStatus = 0;
if (notification_type == NOTIFY_TYPE_SUSPEND)
abl_reset_history();
}
if (notification_type == NOTIFY_TYPE_BL_UPDATE) {
if (mRefresher) {
mRefresher->Control(1);
LOGE_IF(mDebug, "Calling refresh()");
mRefresher->Refresh(1, 16);
mRefresher->Control(0);
}
}
exit_early:
mPrevNotify = notification_type;
pthread_mutex_unlock(&mCABLLock);
return ret;
}
示例10: LOGV
int SecCamera::setFlashMode(const char* strFlashMode)
{
_v4l2Params.flash_mode = _v4l2Cam->enumFlashMode(strFlashMode);
LOGV("setting flash-mode set to %s...", strFlashMode);
switch (_v4l2Params.flash_mode) {
case FLASH_MODE_TORCH:
return 0;
case FLASH_MODE_ON:
case FLASH_MODE_AUTO:
break;
case FLASH_MODE_OFF:
default:
break;
}
if (!_isPreviewOn)
return 0;
int ret = _v4l2Cam->setCtrl(V4L2_CID_CAMERA_FLASH_MODE,
_v4l2Params.flash_mode);
LOGE_IF(0 > ret, "%s:Failed to set flash-mode, %s!! ret=%d",
__func__, strFlashMode, ret);
return 0 > ret ? -1 : 0;
}
示例11: LOGE_IF
void BootAnimation::onFirstRef() {
status_t err = mSession->linkToComposerDeath(this);
LOGE_IF(err, "linkToComposerDeath failed (%s) ", strerror(-err));
if (err == NO_ERROR) {
run("BootAnimation", PRIORITY_DISPLAY);
}
}
示例12: open
int SensorBase::open_device() {
if (dev_fd<0 && dev_name) {
dev_fd = open(dev_name, O_RDONLY);
LOGE_IF(dev_fd<0, "Couldn't open %s (%s)", dev_name, strerror(errno));
}
return 0;
}
示例13: LOGE
status_t QemuClient::doQuery(QemuQuery* query)
{
/* Make sure that query has been successfuly constructed. */
if (query->mQueryDeliveryStatus != NO_ERROR) {
LOGE("%s: Query is invalid", __FUNCTION__);
return query->mQueryDeliveryStatus;
}
LOGQ("Send query '%s'", query->mQuery);
/* Send the query. */
status_t res = sendMessage(query->mQuery, strlen(query->mQuery) + 1);
if (res == NO_ERROR) {
/* Read the response. */
res = receiveMessage(reinterpret_cast<void**>(&query->mReplyBuffer),
&query->mReplySize);
if (res == NO_ERROR) {
LOGQ("Response to query '%s': Status = '%.2s', %d bytes in response",
query->mQuery, query->mReplyBuffer, query->mReplySize);
} else {
LOGE("%s Response to query '%s' has failed: %s",
__FUNCTION__, query->mQuery, strerror(res));
}
} else {
LOGE("%s: Send query '%s' failed: %s",
__FUNCTION__, query->mQuery, strerror(res));
}
/* Complete the query, and return its completion handling status. */
const status_t res1 = query->completeQuery(res);
LOGE_IF(res1 != NO_ERROR && res1 != res,
"%s: Error %d in query '%s' completion",
__FUNCTION__, res1, query->mQuery);
return res1;
}
示例14: LightSensor
sensors_poll_context_t::sensors_poll_context_t()
{
mSensors[light] = new LightSensor();
mPollFds[light].fd = mSensors[light]->getFd();
mPollFds[light].events = POLLIN;
mPollFds[light].revents = 0;
mSensors[proximity] = new ProximitySensor();
mPollFds[proximity].fd = mSensors[proximity]->getFd();
mPollFds[proximity].events = POLLIN;
mPollFds[proximity].revents = 0;
mSensors[akm] = new AkmSensor();
mPollFds[akm].fd = mSensors[akm]->getFd();
mPollFds[akm].events = POLLIN;
mPollFds[akm].revents = 0;
int wakeFds[2];
int result = pipe(wakeFds);
LOGE_IF(result<0, "error creating wake pipe (%s)", strerror(errno));
fcntl(wakeFds[0], F_SETFL, O_NONBLOCK);
fcntl(wakeFds[1], F_SETFL, O_NONBLOCK);
mWritePipeFd = wakeFds[1];
mPollFds[wake].fd = wakeFds[0];
mPollFds[wake].events = POLLIN;
mPollFds[wake].revents = 0;
}
示例15: gralloc_unregister_buffer
int gralloc_unregister_buffer(gralloc_module_t const* module,
buffer_handle_t handle)
{
DEBUG_ENTER();
if (private_handle_t::validate(handle) < 0)
return -EINVAL;
/*
* If the buffer has been mapped during a lock operation, it's time
* to un-map it. It's an error to be here with a locked buffer.
* NOTE: the framebuffer is handled differently and is never unmapped.
*/
private_handle_t* hnd = (private_handle_t*)handle;
LOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK,
"[unregister] handle %p still locked (state=%08x)",
hnd, hnd->lockState);
// never unmap buffers that were created in this process
if (hnd->pid != getpid()) {
if (hnd->lockState & private_handle_t::LOCK_STATE_MAPPED) {
gralloc_unmap(module, handle);
}
hnd->base = 0;
hnd->lockState = 0;
hnd->writeOwner = 0;
}
DEBUG_LEAVE();
return 0;
}