Loading services/inputflinger/reader/InputReader.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -196,9 +196,8 @@ void InputReader::loopOnce() { if (mNextTimeout != LLONG_MAX) { nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); if (now >= mNextTimeout) { if (debugRawEvents()) { ALOGD("Timeout expired, latency=%0.3fms", (now - mNextTimeout) * 0.000001f); } ALOGD_IF(debugRawEvents(), "Timeout expired, latency=%0.3fms", (now - mNextTimeout) * 0.000001f); mNextTimeout = LLONG_MAX; mPendingArgs += timeoutExpiredLocked(now); } Loading Loading @@ -263,9 +262,7 @@ std::list<NotifyArgs> InputReader::processEventsLocked(const RawEvent* rawEvents } batchSize += 1; } if (debugRawEvents()) { ALOGD("BatchSize: %zu Count: %zu", batchSize, count); } ALOGD_IF(debugRawEvents(), "BatchSize: %zu Count: %zu", batchSize, count); out += processEventsForDeviceLocked(deviceId, rawEvent, batchSize); } else { switch (rawEvent->type) { Loading services/inputflinger/reader/controller/PeripheralController.cpp +17 −30 Original line number Diff line number Diff line Loading @@ -78,10 +78,8 @@ std::optional<std::int32_t> PeripheralController::Light::getRawLightBrightness(i if (rawMaxBrightness != MAX_BRIGHTNESS) { brightness = brightness * ratio; } if (DEBUG_LIGHT_DETAILS) { ALOGD("getRawLightBrightness rawLightId %d brightness 0x%x ratio %.2f", rawLightId, brightness, ratio); } ALOGD_IF(DEBUG_LIGHT_DETAILS, "getRawLightBrightness rawLightId %d brightness 0x%x ratio %.2f", rawLightId, brightness, ratio); return brightness; } Loading @@ -97,10 +95,8 @@ void PeripheralController::Light::setRawLightBrightness(int32_t rawLightId, int3 if (rawMaxBrightness != MAX_BRIGHTNESS) { brightness = ceil(brightness / ratio); } if (DEBUG_LIGHT_DETAILS) { ALOGD("setRawLightBrightness rawLightId %d brightness 0x%x ratio %.2f", rawLightId, brightness, ratio); } ALOGD_IF(DEBUG_LIGHT_DETAILS, "setRawLightBrightness rawLightId %d brightness 0x%x ratio %.2f", rawLightId, brightness, ratio); context.setLightBrightness(rawLightId, brightness); } Loading Loading @@ -453,10 +449,9 @@ void PeripheralController::configureLights() { if (rawInfo->flags.test(InputLightClass::GLOBAL)) { rawGlobalId = rawId; } if (DEBUG_LIGHT_DETAILS) { ALOGD("Light rawId %d name %s max %d flags %s \n", rawInfo->id, rawInfo->name.c_str(), rawInfo->maxBrightness.value_or(MAX_BRIGHTNESS), rawInfo->flags.string().c_str()); } ALOGD_IF(DEBUG_LIGHT_DETAILS, "Light rawId %d name %s max %d flags %s\n", rawInfo->id, rawInfo->name.c_str(), rawInfo->maxBrightness.value_or(MAX_BRIGHTNESS), rawInfo->flags.string().c_str()); } // Construct a player ID light Loading @@ -473,10 +468,8 @@ void PeripheralController::configureLights() { } // Construct a RGB light for composed RGB light if (hasRedLed && hasGreenLed && hasBlueLed) { if (DEBUG_LIGHT_DETAILS) { ALOGD("Rgb light ids [%d, %d, %d] \n", rawRgbIds.at(LightColor::RED), ALOGD_IF(DEBUG_LIGHT_DETAILS, "Rgb light ids [%d, %d, %d]\n", rawRgbIds.at(LightColor::RED), rawRgbIds.at(LightColor::GREEN), rawRgbIds.at(LightColor::BLUE)); } bool isKeyboardBacklight = keyboardBacklightIds.find(rawRgbIds.at(LightColor::RED)) != keyboardBacklightIds.end() && keyboardBacklightIds.find(rawRgbIds.at(LightColor::GREEN)) != Loading Loading @@ -518,9 +511,8 @@ void PeripheralController::configureLights() { // If the node is multi-color led, construct a MULTI_COLOR light if (rawInfo.flags.test(InputLightClass::MULTI_INDEX) && rawInfo.flags.test(InputLightClass::MULTI_INTENSITY)) { if (DEBUG_LIGHT_DETAILS) { ALOGD("Multicolor light Id %d name %s \n", rawInfo.id, rawInfo.name.c_str()); } ALOGD_IF(DEBUG_LIGHT_DETAILS, "Multicolor light Id %d name %s\n", rawInfo.id, rawInfo.name.c_str()); std::unique_ptr<Light> light = std::make_unique<MultiColorLight>(getDeviceContext(), rawInfo.name, ++mNextId, type, rawInfo.id); Loading @@ -528,9 +520,8 @@ void PeripheralController::configureLights() { continue; } // Construct a Mono LED light if (DEBUG_LIGHT_DETAILS) { ALOGD("Mono light Id %d name %s \n", rawInfo.id, rawInfo.name.c_str()); } ALOGD_IF(DEBUG_LIGHT_DETAILS, "Mono light Id %d name %s\n", rawInfo.id, rawInfo.name.c_str()); std::unique_ptr<Light> light = std::make_unique<MonoLight>(getDeviceContext(), rawInfo.name, ++mNextId, type, rawInfo.id); Loading @@ -552,10 +543,8 @@ bool PeripheralController::setLightColor(int32_t lightId, int32_t color) { return false; } auto& light = it->second; if (DEBUG_LIGHT_DETAILS) { ALOGD("setLightColor lightId %d type %s color 0x%x", lightId, ALOGD_IF(DEBUG_LIGHT_DETAILS, "setLightColor lightId %d type %s color 0x%x", lightId, ftl::enum_string(light->type).c_str(), color); } return light->setLightColor(color); } Loading @@ -566,10 +555,8 @@ std::optional<int32_t> PeripheralController::getLightColor(int32_t lightId) { } auto& light = it->second; std::optional<int32_t> color = light->getLightColor(); if (DEBUG_LIGHT_DETAILS) { ALOGD("getLightColor lightId %d type %s color 0x%x", lightId, ALOGD_IF(DEBUG_LIGHT_DETAILS, "getLightColor lightId %d type %s color 0x%x", lightId, ftl::enum_string(light->type).c_str(), color.value_or(0)); } return color; } Loading services/inputflinger/reader/mapper/MultiTouchInputMapper.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -79,19 +79,17 @@ void MultiTouchInputMapper::syncTouch(nsecs_t when, RawState* outState) { if (id) { outState->rawPointerData.canceledIdBits.markBit(id.value()); } if (DEBUG_POINTERS) { ALOGI("Stop processing slot %zu for it received a palm event from device %s", ALOGI_IF(DEBUG_POINTERS, "Stop processing slot %zu for it received a palm event from device %s", inIndex, getDeviceName().c_str()); } continue; } if (outCount >= MAX_POINTERS) { if (DEBUG_POINTERS) { ALOGD("MultiTouch device %s emitted more than maximum of %zu pointers; " "ignoring the rest.", ALOGD_IF(DEBUG_POINTERS, "MultiTouch device %s emitted more than maximum of %zu pointers; ignoring the " "rest.", getDeviceName().c_str(), MAX_POINTERS); } break; // too many fingers! } Loading services/inputflinger/reader/mapper/SensorInputMapper.cpp +11 −18 Original line number Diff line number Diff line Loading @@ -235,9 +235,8 @@ void SensorInputMapper::processHardWareTimestamp(nsecs_t evTime, int32_t mscTime // else calculate difference between previous and current MSC_TIMESTAMP if (mPrevMscTime == 0) { mHardwareTimestamp = evTime; if (DEBUG_SENSOR_EVENT_DETAILS) { ALOGD("Initialize hardware timestamp = %" PRId64, mHardwareTimestamp); } ALOGD_IF(DEBUG_SENSOR_EVENT_DETAILS, "Initialize hardware timestamp = %" PRId64, mHardwareTimestamp); } else { // Calculate the difference between current msc_timestamp and // previous msc_timestamp, including when msc_timestamp wraps around. Loading Loading @@ -330,11 +329,10 @@ void SensorInputMapper::flushSensor(InputDeviceSensorType sensorType) { bool SensorInputMapper::enableSensor(InputDeviceSensorType sensorType, std::chrono::microseconds samplingPeriod, std::chrono::microseconds maxBatchReportLatency) { if (DEBUG_SENSOR_EVENT_DETAILS) { ALOGD("Enable Sensor %s samplingPeriod %lld maxBatchReportLatency %lld", ALOGD_IF(DEBUG_SENSOR_EVENT_DETAILS, "Enable Sensor %s samplingPeriod %lld maxBatchReportLatency %lld", ftl::enum_string(sensorType).c_str(), samplingPeriod.count(), maxBatchReportLatency.count()); } if (!setSensorEnabled(sensorType, /*enabled=*/true)) { return false; Loading @@ -355,9 +353,7 @@ bool SensorInputMapper::enableSensor(InputDeviceSensorType sensorType, } void SensorInputMapper::disableSensor(InputDeviceSensorType sensorType) { if (DEBUG_SENSOR_EVENT_DETAILS) { ALOGD("Disable Sensor %s", ftl::enum_string(sensorType).c_str()); } ALOGD_IF(DEBUG_SENSOR_EVENT_DETAILS, "Disable Sensor %s", ftl::enum_string(sensorType).c_str()); if (!setSensorEnabled(sensorType, /*enabled=*/false)) { return; Loading Loading @@ -389,15 +385,12 @@ std::list<NotifyArgs> SensorInputMapper::sync(nsecs_t when, bool force) { } nsecs_t timestamp = mHasHardwareTimestamp ? mHardwareTimestamp : when; if (DEBUG_SENSOR_EVENT_DETAILS) { ALOGD("Sensor %s timestamp %" PRIu64 " values [%f %f %f]", ALOGD_IF(DEBUG_SENSOR_EVENT_DETAILS, "Sensor %s timestamp %" PRIu64 " values [%f %f %f]", ftl::enum_string(sensorType).c_str(), timestamp, values[0], values[1], values[2]); } if (sensor.lastSampleTimeNs.has_value() && timestamp - sensor.lastSampleTimeNs.value() < sensor.samplingPeriod.count()) { if (DEBUG_SENSOR_EVENT_DETAILS) { ALOGD("Sensor %s Skip a sample.", ftl::enum_string(sensorType).c_str()); } ALOGD_IF(DEBUG_SENSOR_EVENT_DETAILS, "Sensor %s Skip a sample.", ftl::enum_string(sensorType).c_str()); } else { // Convert to Android unit convertFromLinuxToAndroid(values, sensorType); Loading services/inputflinger/reader/mapper/VibratorInputMapper.cpp +9 −24 Original line number Diff line number Diff line Loading @@ -43,10 +43,8 @@ std::list<NotifyArgs> VibratorInputMapper::process(const RawEvent& rawEvent) { std::list<NotifyArgs> VibratorInputMapper::vibrate(const VibrationSequence& sequence, ssize_t repeat, int32_t token) { if (DEBUG_VIBRATOR) { ALOGD("vibrate: deviceId=%d, pattern=[%s], repeat=%zd, token=%d", getDeviceId(), sequence.toString().c_str(), repeat, token); } ALOGD_IF(DEBUG_VIBRATOR, "vibrate: deviceId=%d, pattern=[%s], repeat=%zd, token=%d", getDeviceId(), sequence.toString().c_str(), repeat, token); std::list<NotifyArgs> out; mVibrating = true; Loading @@ -63,9 +61,7 @@ std::list<NotifyArgs> VibratorInputMapper::vibrate(const VibrationSequence& sequ } std::list<NotifyArgs> VibratorInputMapper::cancelVibrate(int32_t token) { if (DEBUG_VIBRATOR) { ALOGD("cancelVibrate: deviceId=%d, token=%d", getDeviceId(), token); } ALOGD_IF(DEBUG_VIBRATOR, "cancelVibrate: deviceId=%d, token=%d", getDeviceId(), token); std::list<NotifyArgs> out; if (mVibrating && mToken == token) { Loading Loading @@ -95,9 +91,7 @@ std::list<NotifyArgs> VibratorInputMapper::timeoutExpired(nsecs_t when) { } std::list<NotifyArgs> VibratorInputMapper::nextStep() { if (DEBUG_VIBRATOR) { ALOGD("nextStep: index=%d, vibrate deviceId=%d", (int)mIndex, getDeviceId()); } ALOGD_IF(DEBUG_VIBRATOR, "nextStep: index=%d, vibrate deviceId=%d", (int)mIndex, getDeviceId()); std::list<NotifyArgs> out; mIndex += 1; if (size_t(mIndex) >= mSequence.pattern.size()) { Loading @@ -111,16 +105,11 @@ std::list<NotifyArgs> VibratorInputMapper::nextStep() { const VibrationElement& element = mSequence.pattern[mIndex]; if (element.isOn()) { if (DEBUG_VIBRATOR) { std::string description = element.toString(); ALOGD("nextStep: sending vibrate deviceId=%d, element=%s", getDeviceId(), description.c_str()); } ALOGD_IF(DEBUG_VIBRATOR, "nextStep: sending vibrate deviceId=%d, element=%s", getDeviceId(), element.toString().c_str()); getDeviceContext().vibrate(element); } else { if (DEBUG_VIBRATOR) { ALOGD("nextStep: sending cancel vibrate deviceId=%d", getDeviceId()); } ALOGD_IF(DEBUG_VIBRATOR, "nextStep: sending cancel vibrate deviceId=%d", getDeviceId()); getDeviceContext().cancelVibrate(); } nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); Loading @@ -128,17 +117,13 @@ std::list<NotifyArgs> VibratorInputMapper::nextStep() { std::chrono::duration_cast<std::chrono::nanoseconds>(element.duration); mNextStepTime = now + duration.count(); getContext()->requestTimeoutAtTime(mNextStepTime); if (DEBUG_VIBRATOR) { ALOGD("nextStep: scheduled timeout in %lldms", element.duration.count()); } ALOGD_IF(DEBUG_VIBRATOR, "nextStep: scheduled timeout in %lldms", element.duration.count()); return out; } NotifyVibratorStateArgs VibratorInputMapper::stopVibrating() { mVibrating = false; if (DEBUG_VIBRATOR) { ALOGD("stopVibrating: sending cancel vibrate deviceId=%d", getDeviceId()); } ALOGD_IF(DEBUG_VIBRATOR, "stopVibrating: sending cancel vibrate deviceId=%d", getDeviceId()); getDeviceContext().cancelVibrate(); // Request InputReader to notify InputManagerService for vibration complete. Loading Loading
services/inputflinger/reader/InputReader.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -196,9 +196,8 @@ void InputReader::loopOnce() { if (mNextTimeout != LLONG_MAX) { nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); if (now >= mNextTimeout) { if (debugRawEvents()) { ALOGD("Timeout expired, latency=%0.3fms", (now - mNextTimeout) * 0.000001f); } ALOGD_IF(debugRawEvents(), "Timeout expired, latency=%0.3fms", (now - mNextTimeout) * 0.000001f); mNextTimeout = LLONG_MAX; mPendingArgs += timeoutExpiredLocked(now); } Loading Loading @@ -263,9 +262,7 @@ std::list<NotifyArgs> InputReader::processEventsLocked(const RawEvent* rawEvents } batchSize += 1; } if (debugRawEvents()) { ALOGD("BatchSize: %zu Count: %zu", batchSize, count); } ALOGD_IF(debugRawEvents(), "BatchSize: %zu Count: %zu", batchSize, count); out += processEventsForDeviceLocked(deviceId, rawEvent, batchSize); } else { switch (rawEvent->type) { Loading
services/inputflinger/reader/controller/PeripheralController.cpp +17 −30 Original line number Diff line number Diff line Loading @@ -78,10 +78,8 @@ std::optional<std::int32_t> PeripheralController::Light::getRawLightBrightness(i if (rawMaxBrightness != MAX_BRIGHTNESS) { brightness = brightness * ratio; } if (DEBUG_LIGHT_DETAILS) { ALOGD("getRawLightBrightness rawLightId %d brightness 0x%x ratio %.2f", rawLightId, brightness, ratio); } ALOGD_IF(DEBUG_LIGHT_DETAILS, "getRawLightBrightness rawLightId %d brightness 0x%x ratio %.2f", rawLightId, brightness, ratio); return brightness; } Loading @@ -97,10 +95,8 @@ void PeripheralController::Light::setRawLightBrightness(int32_t rawLightId, int3 if (rawMaxBrightness != MAX_BRIGHTNESS) { brightness = ceil(brightness / ratio); } if (DEBUG_LIGHT_DETAILS) { ALOGD("setRawLightBrightness rawLightId %d brightness 0x%x ratio %.2f", rawLightId, brightness, ratio); } ALOGD_IF(DEBUG_LIGHT_DETAILS, "setRawLightBrightness rawLightId %d brightness 0x%x ratio %.2f", rawLightId, brightness, ratio); context.setLightBrightness(rawLightId, brightness); } Loading Loading @@ -453,10 +449,9 @@ void PeripheralController::configureLights() { if (rawInfo->flags.test(InputLightClass::GLOBAL)) { rawGlobalId = rawId; } if (DEBUG_LIGHT_DETAILS) { ALOGD("Light rawId %d name %s max %d flags %s \n", rawInfo->id, rawInfo->name.c_str(), rawInfo->maxBrightness.value_or(MAX_BRIGHTNESS), rawInfo->flags.string().c_str()); } ALOGD_IF(DEBUG_LIGHT_DETAILS, "Light rawId %d name %s max %d flags %s\n", rawInfo->id, rawInfo->name.c_str(), rawInfo->maxBrightness.value_or(MAX_BRIGHTNESS), rawInfo->flags.string().c_str()); } // Construct a player ID light Loading @@ -473,10 +468,8 @@ void PeripheralController::configureLights() { } // Construct a RGB light for composed RGB light if (hasRedLed && hasGreenLed && hasBlueLed) { if (DEBUG_LIGHT_DETAILS) { ALOGD("Rgb light ids [%d, %d, %d] \n", rawRgbIds.at(LightColor::RED), ALOGD_IF(DEBUG_LIGHT_DETAILS, "Rgb light ids [%d, %d, %d]\n", rawRgbIds.at(LightColor::RED), rawRgbIds.at(LightColor::GREEN), rawRgbIds.at(LightColor::BLUE)); } bool isKeyboardBacklight = keyboardBacklightIds.find(rawRgbIds.at(LightColor::RED)) != keyboardBacklightIds.end() && keyboardBacklightIds.find(rawRgbIds.at(LightColor::GREEN)) != Loading Loading @@ -518,9 +511,8 @@ void PeripheralController::configureLights() { // If the node is multi-color led, construct a MULTI_COLOR light if (rawInfo.flags.test(InputLightClass::MULTI_INDEX) && rawInfo.flags.test(InputLightClass::MULTI_INTENSITY)) { if (DEBUG_LIGHT_DETAILS) { ALOGD("Multicolor light Id %d name %s \n", rawInfo.id, rawInfo.name.c_str()); } ALOGD_IF(DEBUG_LIGHT_DETAILS, "Multicolor light Id %d name %s\n", rawInfo.id, rawInfo.name.c_str()); std::unique_ptr<Light> light = std::make_unique<MultiColorLight>(getDeviceContext(), rawInfo.name, ++mNextId, type, rawInfo.id); Loading @@ -528,9 +520,8 @@ void PeripheralController::configureLights() { continue; } // Construct a Mono LED light if (DEBUG_LIGHT_DETAILS) { ALOGD("Mono light Id %d name %s \n", rawInfo.id, rawInfo.name.c_str()); } ALOGD_IF(DEBUG_LIGHT_DETAILS, "Mono light Id %d name %s\n", rawInfo.id, rawInfo.name.c_str()); std::unique_ptr<Light> light = std::make_unique<MonoLight>(getDeviceContext(), rawInfo.name, ++mNextId, type, rawInfo.id); Loading @@ -552,10 +543,8 @@ bool PeripheralController::setLightColor(int32_t lightId, int32_t color) { return false; } auto& light = it->second; if (DEBUG_LIGHT_DETAILS) { ALOGD("setLightColor lightId %d type %s color 0x%x", lightId, ALOGD_IF(DEBUG_LIGHT_DETAILS, "setLightColor lightId %d type %s color 0x%x", lightId, ftl::enum_string(light->type).c_str(), color); } return light->setLightColor(color); } Loading @@ -566,10 +555,8 @@ std::optional<int32_t> PeripheralController::getLightColor(int32_t lightId) { } auto& light = it->second; std::optional<int32_t> color = light->getLightColor(); if (DEBUG_LIGHT_DETAILS) { ALOGD("getLightColor lightId %d type %s color 0x%x", lightId, ALOGD_IF(DEBUG_LIGHT_DETAILS, "getLightColor lightId %d type %s color 0x%x", lightId, ftl::enum_string(light->type).c_str(), color.value_or(0)); } return color; } Loading
services/inputflinger/reader/mapper/MultiTouchInputMapper.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -79,19 +79,17 @@ void MultiTouchInputMapper::syncTouch(nsecs_t when, RawState* outState) { if (id) { outState->rawPointerData.canceledIdBits.markBit(id.value()); } if (DEBUG_POINTERS) { ALOGI("Stop processing slot %zu for it received a palm event from device %s", ALOGI_IF(DEBUG_POINTERS, "Stop processing slot %zu for it received a palm event from device %s", inIndex, getDeviceName().c_str()); } continue; } if (outCount >= MAX_POINTERS) { if (DEBUG_POINTERS) { ALOGD("MultiTouch device %s emitted more than maximum of %zu pointers; " "ignoring the rest.", ALOGD_IF(DEBUG_POINTERS, "MultiTouch device %s emitted more than maximum of %zu pointers; ignoring the " "rest.", getDeviceName().c_str(), MAX_POINTERS); } break; // too many fingers! } Loading
services/inputflinger/reader/mapper/SensorInputMapper.cpp +11 −18 Original line number Diff line number Diff line Loading @@ -235,9 +235,8 @@ void SensorInputMapper::processHardWareTimestamp(nsecs_t evTime, int32_t mscTime // else calculate difference between previous and current MSC_TIMESTAMP if (mPrevMscTime == 0) { mHardwareTimestamp = evTime; if (DEBUG_SENSOR_EVENT_DETAILS) { ALOGD("Initialize hardware timestamp = %" PRId64, mHardwareTimestamp); } ALOGD_IF(DEBUG_SENSOR_EVENT_DETAILS, "Initialize hardware timestamp = %" PRId64, mHardwareTimestamp); } else { // Calculate the difference between current msc_timestamp and // previous msc_timestamp, including when msc_timestamp wraps around. Loading Loading @@ -330,11 +329,10 @@ void SensorInputMapper::flushSensor(InputDeviceSensorType sensorType) { bool SensorInputMapper::enableSensor(InputDeviceSensorType sensorType, std::chrono::microseconds samplingPeriod, std::chrono::microseconds maxBatchReportLatency) { if (DEBUG_SENSOR_EVENT_DETAILS) { ALOGD("Enable Sensor %s samplingPeriod %lld maxBatchReportLatency %lld", ALOGD_IF(DEBUG_SENSOR_EVENT_DETAILS, "Enable Sensor %s samplingPeriod %lld maxBatchReportLatency %lld", ftl::enum_string(sensorType).c_str(), samplingPeriod.count(), maxBatchReportLatency.count()); } if (!setSensorEnabled(sensorType, /*enabled=*/true)) { return false; Loading @@ -355,9 +353,7 @@ bool SensorInputMapper::enableSensor(InputDeviceSensorType sensorType, } void SensorInputMapper::disableSensor(InputDeviceSensorType sensorType) { if (DEBUG_SENSOR_EVENT_DETAILS) { ALOGD("Disable Sensor %s", ftl::enum_string(sensorType).c_str()); } ALOGD_IF(DEBUG_SENSOR_EVENT_DETAILS, "Disable Sensor %s", ftl::enum_string(sensorType).c_str()); if (!setSensorEnabled(sensorType, /*enabled=*/false)) { return; Loading Loading @@ -389,15 +385,12 @@ std::list<NotifyArgs> SensorInputMapper::sync(nsecs_t when, bool force) { } nsecs_t timestamp = mHasHardwareTimestamp ? mHardwareTimestamp : when; if (DEBUG_SENSOR_EVENT_DETAILS) { ALOGD("Sensor %s timestamp %" PRIu64 " values [%f %f %f]", ALOGD_IF(DEBUG_SENSOR_EVENT_DETAILS, "Sensor %s timestamp %" PRIu64 " values [%f %f %f]", ftl::enum_string(sensorType).c_str(), timestamp, values[0], values[1], values[2]); } if (sensor.lastSampleTimeNs.has_value() && timestamp - sensor.lastSampleTimeNs.value() < sensor.samplingPeriod.count()) { if (DEBUG_SENSOR_EVENT_DETAILS) { ALOGD("Sensor %s Skip a sample.", ftl::enum_string(sensorType).c_str()); } ALOGD_IF(DEBUG_SENSOR_EVENT_DETAILS, "Sensor %s Skip a sample.", ftl::enum_string(sensorType).c_str()); } else { // Convert to Android unit convertFromLinuxToAndroid(values, sensorType); Loading
services/inputflinger/reader/mapper/VibratorInputMapper.cpp +9 −24 Original line number Diff line number Diff line Loading @@ -43,10 +43,8 @@ std::list<NotifyArgs> VibratorInputMapper::process(const RawEvent& rawEvent) { std::list<NotifyArgs> VibratorInputMapper::vibrate(const VibrationSequence& sequence, ssize_t repeat, int32_t token) { if (DEBUG_VIBRATOR) { ALOGD("vibrate: deviceId=%d, pattern=[%s], repeat=%zd, token=%d", getDeviceId(), sequence.toString().c_str(), repeat, token); } ALOGD_IF(DEBUG_VIBRATOR, "vibrate: deviceId=%d, pattern=[%s], repeat=%zd, token=%d", getDeviceId(), sequence.toString().c_str(), repeat, token); std::list<NotifyArgs> out; mVibrating = true; Loading @@ -63,9 +61,7 @@ std::list<NotifyArgs> VibratorInputMapper::vibrate(const VibrationSequence& sequ } std::list<NotifyArgs> VibratorInputMapper::cancelVibrate(int32_t token) { if (DEBUG_VIBRATOR) { ALOGD("cancelVibrate: deviceId=%d, token=%d", getDeviceId(), token); } ALOGD_IF(DEBUG_VIBRATOR, "cancelVibrate: deviceId=%d, token=%d", getDeviceId(), token); std::list<NotifyArgs> out; if (mVibrating && mToken == token) { Loading Loading @@ -95,9 +91,7 @@ std::list<NotifyArgs> VibratorInputMapper::timeoutExpired(nsecs_t when) { } std::list<NotifyArgs> VibratorInputMapper::nextStep() { if (DEBUG_VIBRATOR) { ALOGD("nextStep: index=%d, vibrate deviceId=%d", (int)mIndex, getDeviceId()); } ALOGD_IF(DEBUG_VIBRATOR, "nextStep: index=%d, vibrate deviceId=%d", (int)mIndex, getDeviceId()); std::list<NotifyArgs> out; mIndex += 1; if (size_t(mIndex) >= mSequence.pattern.size()) { Loading @@ -111,16 +105,11 @@ std::list<NotifyArgs> VibratorInputMapper::nextStep() { const VibrationElement& element = mSequence.pattern[mIndex]; if (element.isOn()) { if (DEBUG_VIBRATOR) { std::string description = element.toString(); ALOGD("nextStep: sending vibrate deviceId=%d, element=%s", getDeviceId(), description.c_str()); } ALOGD_IF(DEBUG_VIBRATOR, "nextStep: sending vibrate deviceId=%d, element=%s", getDeviceId(), element.toString().c_str()); getDeviceContext().vibrate(element); } else { if (DEBUG_VIBRATOR) { ALOGD("nextStep: sending cancel vibrate deviceId=%d", getDeviceId()); } ALOGD_IF(DEBUG_VIBRATOR, "nextStep: sending cancel vibrate deviceId=%d", getDeviceId()); getDeviceContext().cancelVibrate(); } nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); Loading @@ -128,17 +117,13 @@ std::list<NotifyArgs> VibratorInputMapper::nextStep() { std::chrono::duration_cast<std::chrono::nanoseconds>(element.duration); mNextStepTime = now + duration.count(); getContext()->requestTimeoutAtTime(mNextStepTime); if (DEBUG_VIBRATOR) { ALOGD("nextStep: scheduled timeout in %lldms", element.duration.count()); } ALOGD_IF(DEBUG_VIBRATOR, "nextStep: scheduled timeout in %lldms", element.duration.count()); return out; } NotifyVibratorStateArgs VibratorInputMapper::stopVibrating() { mVibrating = false; if (DEBUG_VIBRATOR) { ALOGD("stopVibrating: sending cancel vibrate deviceId=%d", getDeviceId()); } ALOGD_IF(DEBUG_VIBRATOR, "stopVibrating: sending cancel vibrate deviceId=%d", getDeviceId()); getDeviceContext().cancelVibrate(); // Request InputReader to notify InputManagerService for vibration complete. Loading