本文整理匯總了C++中ALOGE_IF函數的典型用法代碼示例。如果您正苦於以下問題:C++ ALOGE_IF函數的具體用法?C++ ALOGE_IF怎麽用?C++ ALOGE_IF使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ALOGE_IF函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: gralloc_unregister_buffer
int gralloc_unregister_buffer(gralloc_module_t const* module,
buffer_handle_t handle)
{
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;
ALOGE_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;
}
return 0;
}
示例2: ALOGW_IF
status_t StreamOutHalHidl::write(const void *buffer, size_t bytes, size_t *written) {
if (mStream == 0) return NO_INIT;
*written = 0;
if (bytes == 0 && !mDataMQ) {
// Can't determine the size for the MQ buffer. Wait for a non-empty write request.
ALOGW_IF(mCallback.unsafe_get(), "First call to async write with 0 bytes");
return OK;
}
status_t status;
if (!mDataMQ && (status = prepareForWriting(bytes)) != OK) {
return status;
}
return callWriterThread(
WriteCommand::WRITE, "write", static_cast<const uint8_t*>(buffer), bytes,
[&] (const WriteStatus& writeStatus) {
*written = writeStatus.reply.written;
// Diagnostics of the cause of b/35813113.
ALOGE_IF(*written > bytes,
"hal reports more bytes written than asked for: %lld > %lld",
(long long)*written, (long long)bytes);
});
}
示例3: Hwmsen
sensors_poll_context_t::sensors_poll_context_t()
{
mSensors[hwmsen] = new Hwmsen();
mPollFds[hwmsen].fd = mSensors[hwmsen]->getFd();
mPollFds[hwmsen].events = POLLIN;
mPollFds[hwmsen].revents = 0;
mSensors[accel] = new AccelerationSensor();
mPollFds[accel].fd = mSensors[accel]->getFd();
mPollFds[accel].events = POLLIN;
mPollFds[accel].revents = 0;
mSensors[magnetic] = new MagneticSensor();
mPollFds[magnetic].fd = mSensors[magnetic]->getFd();
mPollFds[magnetic].events = POLLIN;
mPollFds[magnetic].revents = 0;
int wakeFds[2];
int result = pipe(wakeFds);
ALOGE_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;
}
示例4: open
int SensorBase::open_fifo_device(){
if (fifo_fd < 0 && fifo_name) {
fifo_fd = open(fifo_name, O_RDONLY);
ALOGE_IF(fifo_fd < 0, "Couldn't open %s (%s)", fifo_name, strerror(errno));
}
return 0;
}
示例5: mlock
void TimeInterpolator::seek(int64_t media_time)
{
Mutex::Autolock mlock(m_mutex);
ALOGV("TimeInterpolator::seek(media_time=%lld)", media_time);
if (m_state == STOPPED || m_state == PAUSED) {
m_pos0 = media_time;
m_read = media_time;
m_queued = 0;
m_t0 = get_system_usecs();
m_Tf = 0;
m_last = media_time;
m_now_last = 0;
} else {
ALOGE_IF(m_state != ROLLING, "TimeInterpolator logic error: "
"state is not rolling in seek()");
m_read = media_time;
m_pos0 = m_read - m_latency;
m_queued = 0;
m_t0 = get_system_usecs();
m_Tf = 1.0;
m_last = m_pos0;
m_now_last = 0;
}
}
示例6: ALOGD
int sensors_poll_context_t::activate(int handle, int enabled)
{
ALOGD( "activate handle =%d, enable = %d",handle, enabled );
int err=0;
int index = handleToDriver(handle);
//
if(ID_ORIENTATION == handle)
{
//ALOGD( "fwq1111" );
((AccelerationSensor*)(mSensors[accel]))->enableNoHALDataAcc(enabled);
((Hwmsen*)(mSensors[hwmsen]))->enableNoHALDataAcc(enabled);
}
if(NULL != mSensors[index] && index >0 )
{
ALOGD( "use new sensor index=%d, mSensors[index](%x)", index, mSensors[index]);
err = mSensors[index]->enable(handle, enabled);
}
if(err || index<0 )
{
ALOGD("use old sensor err(%d),index(%d) go to old hwmsen\n",err,index);
// notify to hwmsen sensor to support old architecture
err = mSensors[hwmsen]->enable(handle, enabled);
}
if (enabled && !err) {
const char wakeMessage(WAKE_MESSAGE);
int result = write(mWritePipeFd, &wakeMessage, 1);
ALOGE_IF(result<0, "error sending wake message (%s)", strerror(errno));
}
return err;
}
示例7: open
int Kxtf9Sensor::setDelay(int32_t handle, int64_t ns)
{
int err = 0;
if (mEnabled) {
if (ns < 0)
return -EINVAL;
unsigned long delay = ns / 1000000;
// ok we need to set our enabled state
int fd = open(KXTF9_DELAY_FILE, O_WRONLY);
if(fd >= 0) {
char buffer[20];
int bytes = sprintf(buffer, "%d\n", delay);
err = write(fd, buffer, bytes);
err = err < 0 ? -errno : 0;
} else {
err = -errno;
}
ALOGE_IF(err < 0, "Error setting delay of kxtf9 accelerometer (%s)", strerror(-err));
}
return err;
}
示例8: teardownWfd
static void teardownWfd(hwc_context_t* ctx) {
// Teardown WFD display
ALOGD_IF(UEVENT_DEBUG,"Received HDMI connection request when WFD is "
"active");
{
Locker::Autolock _l(ctx->mDrawLock);
clear(ctx, HWC_DISPLAY_VIRTUAL);
ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].connected = false;
ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].isActive = false;
}
ctx->mVirtualDisplay->teardown();
/* Need to send hotplug only when connected WFD in proprietary path */
if(ctx->mVirtualonExtActive) {
ALOGE_IF(UEVENT_DEBUG,"%s: Sending EXTERNAL OFFLINE"
"hotplug event for wfd display", __FUNCTION__);
ctx->proc->hotplug(ctx->proc, HWC_DISPLAY_EXTERNAL,
EXTERNAL_OFFLINE);
{
Locker::Autolock _l(ctx->mDrawLock);
ctx->mVirtualonExtActive = false;
}
}
ctx->mWfdSyncLock.lock();
ALOGD_IF(HWC_WFDDISPSYNC_LOG,
"%s: Waiting for wfd-teardown to be signalled",__FUNCTION__);
ctx->mWfdSyncLock.wait();
ALOGD_IF(HWC_WFDDISPSYNC_LOG,
"%s: Teardown signalled. Completed waiting in uevent thread",
__FUNCTION__);
ctx->mWfdSyncLock.unlock();
}
示例9: KionixSensor
sensors_poll_context_t::sensors_poll_context_t()
{
mSensors[accel_kxtj9] = new KionixSensor();
mPollFds[accel_kxtj9].fd = mSensors[accel_kxtj9]->getFd();
mPollFds[accel_kxtj9].events = POLLIN;
mPollFds[accel_kxtj9].revents = 0;
mSensors[light_cm3212] = new LightSensor();
mPollFds[light_cm3212].fd = mSensors[light_cm3212]->getFd();
mPollFds[light_cm3212].events = POLLIN;
mPollFds[light_cm3212].revents = 0;
mSensors[compass_ami30x] = new AmiSensor();
mPollFds[compass_ami30x].fd = mSensors[compass_ami30x]->getFd();
mPollFds[compass_ami30x].events = POLLIN;
mPollFds[compass_ami30x].revents = 0;
mSensors[accel_dmard06] = new Dmard06Sensor();
mPollFds[accel_dmard06].fd = mSensors[accel_dmard06]->getFd();
mPollFds[accel_dmard06].events = POLLIN;
mPollFds[accel_dmard06].revents = 0;
int wakeFds[2];
int result = pipe(wakeFds);
ALOGE_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;
}
示例10: gralloc_free_pmem
int gralloc_free_pmem(alloc_device_t* dev,
struct hwmem_gralloc_buf_handle_t* hnd)
{
if (hnd->flags & PRIV_FLAGS_FRAMEBUFFER) {
// free this buffer
struct hwmem_gralloc_module_t* m = (struct hwmem_gralloc_module_t*)
dev->common.module;
const size_t bufferSize = m->finfo.line_length * m->info.yres;
int index = (hnd->base_addr - m->framebuffer->base_addr) / bufferSize;
m->bufferMask &= ~(1<<index);
} else {
#if HAVE_ANDROID_OS
if (hnd->flags & PRIV_FLAGS_USES_PMEM) {
if (hnd->fd >= 0) {
struct pmem_region sub = { hnd->offset, hnd->size };
int err = ioctl(hnd->fd, PMEM_UNMAP, &sub);
ALOGE_IF(err<0, "PMEM_UNMAP failed (%s), "
"fd=%d, sub.offset=%i, sub.size=%i",
strerror(errno), hnd->fd, hnd->offset, hnd->size);
}
}
#endif // HAVE_ANDROID_OS
terminateBuffer(NULL, hnd); /* NULL is ok here as the parameter is not used by terminateBuffer */
}
close(hnd->fd);
free(hnd);
return 0;
}
示例11: terminateBuffer
static int terminateBuffer(gralloc_module_t const* module,
struct hwmem_gralloc_buf_handle_t* hnd)
{
/*
* 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.
*/
ALOGE_IF(hnd->lockState & LOCK_STATE_READ_MASK,
"[terminate] handle %p still locked (state=%08x)",
hnd, hnd->lockState);
if (hnd->lockState & LOCK_STATE_MAPPED) {
// this buffer was mapped, unmap it now
if ((hnd->flags & PRIV_FLAGS_USES_PMEM) &&
(hnd->pid == getpid())) {
// ... unless it's a "master" pmem buffer, that is a buffer
// mapped in the process it's been allocated.
// (see gralloc_alloc_buffer())
} else {
gralloc_unmap(module, hnd);
}
}
return 0;
}
示例12: terminateBuffer
int terminateBuffer(gralloc_module_t const* module,
private_handle_t* hnd)
{
/*
* 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.
*/
ALOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK,
"[terminate] handle %p still locked (state=%08x)",
hnd, hnd->lockState);
if (hnd->lockState & private_handle_t::LOCK_STATE_MAPPED) {
// this buffer was mapped, unmap it now
if (hnd->flags & (private_handle_t::PRIV_FLAGS_USES_PMEM |
private_handle_t::PRIV_FLAGS_USES_PMEM_ADSP |
private_handle_t::PRIV_FLAGS_USES_ASHMEM)) {
if (hnd->pid != getpid()) {
// ... unless it's a "master" pmem buffer, that is a buffer
// mapped in the process it's been allocated.
// (see gralloc_alloc_buffer())
gralloc_unmap(module, hnd);
}
} else {
LOGE("terminateBuffer: unmapping a non pmem/ashmem buffer flags = 0x%x", hnd->flags);
gralloc_unmap(module, hnd);
}
}
return 0;
}
示例13: mAllocMod
GraphicBufferMapper::GraphicBufferMapper()
: mAllocMod(0)
{
hw_module_t const* module;
int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
ALOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID);
if (err == 0) {
mAllocMod = (gralloc_module_t const *)module;
}
// [MTK] {{{
// 20120918: gralloc extra device for internal purpose
mExtraDev = NULL;
if (err == 0) {
gralloc_extra_open(module, &mExtraDev);
}
char value[PROPERTY_VALUE_MAX];
property_get("debug.gbuf.callstack", value, "0");
mIsDumpCallStack = atoi(value);
if (true == mIsDumpCallStack) {
XLOGI("!!! dump GraphicBufferMapper callstack for pid:%d !!!", getpid());
}
// [MTK] }}}
}
示例14: Lsm303dlhGSensor
sensors_poll_context_t::sensors_poll_context_t()
{
mSensors[lsm303dlh_acc] = new Lsm303dlhGSensor();
mPollFds[lsm303dlh_acc].fd = mSensors[lsm303dlh_acc]->getFd();
mPollFds[lsm303dlh_acc].events = POLLIN;
mPollFds[lsm303dlh_acc].revents = 0;
mSensors[lsm303dlh_mag] = new Lsm303dlhMagSensor();
mPollFds[lsm303dlh_mag].fd = mSensors[lsm303dlh_mag]->getFd();
mPollFds[lsm303dlh_mag].events = POLLIN;
mPollFds[lsm303dlh_mag].revents = 0;
mSensors[isl29023_als] = new LightSensor();
mPollFds[isl29023_als].fd = mSensors[isl29023_als]->getFd();
mPollFds[isl29023_als].events = POLLIN;
mPollFds[isl29023_als].revents = 0;
mSensors[mpu3050] = new MPLSensor();
mPollFds[mpu3050].fd = mSensors[mpu3050]->getFd();
mPollFds[mpu3050].events = POLLIN;
mPollFds[mpu3050].revents = 0;
int wakeFds[2];
int result = pipe(wakeFds);
ALOGE_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: ALOGE_IF
bool GenericPipe::init()
{
ALOGE_IF(DEBUG_OVERLAY, "GenericPipe init");
mRotDownscaleOpt = false;
int fbNum = Overlay::getFbForDpy(mDpy);
if( fbNum < 0 ) {
ALOGE("%s: Invalid FB for the display: %d",__FUNCTION__, mDpy);
return false;
}
ALOGD_IF(DEBUG_OVERLAY,"%s: mFbNum:%d",__FUNCTION__, fbNum);
if(!mCtrlData.ctrl.init(fbNum)) {
ALOGE("GenericPipe failed to init ctrl");
return false;
}
if(!mCtrlData.data.init(fbNum)) {
ALOGE("GenericPipe failed to init data");
return false;
}
return true;
}