Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit babeaa82 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9657362 from 26b34d62 to udc-release

Change-Id: Ib95426aaa8188af9367b247747fa34ce6747d0cc
parents 2ba5dcc4 26b34d62
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -85,7 +85,9 @@ public:
    }
    }
};
};


int main(int argc, const char* argv[]) {
int main(int argc, char* argv[]) {
    android::base::InitLogging(argv, android::base::StderrLogger, android::base::DefaultAborter);

    LOG_ALWAYS_FATAL_IF(argc != 3, "Invalid number of arguments: %d", argc);
    LOG_ALWAYS_FATAL_IF(argc != 3, "Invalid number of arguments: %d", argc);
    base::unique_fd writeEnd(atoi(argv[1]));
    base::unique_fd writeEnd(atoi(argv[1]));
    base::unique_fd readEnd(atoi(argv[2]));
    base::unique_fd readEnd(atoi(argv[2]));
+21 −15
Original line number Original line Diff line number Diff line
@@ -555,10 +555,10 @@ status_t InputPublisher::publishKeyEvent(uint32_t seq, int32_t eventId, int32_t
        ATRACE_NAME(message.c_str());
        ATRACE_NAME(message.c_str());
    }
    }
    ALOGD_IF(debugTransportPublisher(),
    ALOGD_IF(debugTransportPublisher(),
             "channel '%s' publisher ~ %s: seq=%u, deviceId=%d, source=%s, "
             "channel '%s' publisher ~ %s: seq=%u, id=%d, deviceId=%d, source=%s, "
             "action=%s, flags=0x%x, keyCode=%s, scanCode=%d, metaState=0x%x, repeatCount=%d,"
             "action=%s, flags=0x%x, keyCode=%s, scanCode=%d, metaState=0x%x, repeatCount=%d,"
             "downTime=%" PRId64 ", eventTime=%" PRId64,
             "downTime=%" PRId64 ", eventTime=%" PRId64,
             mChannel->getName().c_str(), __func__, seq, deviceId,
             mChannel->getName().c_str(), __func__, seq, eventId, deviceId,
             inputEventSourceToString(source).c_str(), KeyEvent::actionToString(action), flags,
             inputEventSourceToString(source).c_str(), KeyEvent::actionToString(action), flags,
             KeyEvent::getLabel(keyCode), scanCode, metaState, repeatCount, downTime, eventTime);
             KeyEvent::getLabel(keyCode), scanCode, metaState, repeatCount, downTime, eventTime);


@@ -608,13 +608,13 @@ status_t InputPublisher::publishMotionEvent(
    if (debugTransportPublisher()) {
    if (debugTransportPublisher()) {
        std::string transformString;
        std::string transformString;
        transform.dump(transformString, "transform", "        ");
        transform.dump(transformString, "transform", "        ");
        ALOGD("channel '%s' publisher ~ %s: seq=%u, deviceId=%d, source=%s, "
        ALOGD("channel '%s' publisher ~ %s: seq=%u, id=%d, deviceId=%d, source=%s, "
              "displayId=%" PRId32 ", "
              "displayId=%" PRId32 ", "
              "action=%s, actionButton=0x%08x, flags=0x%x, edgeFlags=0x%x, "
              "action=%s, actionButton=0x%08x, flags=0x%x, edgeFlags=0x%x, "
              "metaState=0x%x, buttonState=0x%x, classification=%s,"
              "metaState=0x%x, buttonState=0x%x, classification=%s,"
              "xPrecision=%f, yPrecision=%f, downTime=%" PRId64 ", eventTime=%" PRId64 ", "
              "xPrecision=%f, yPrecision=%f, downTime=%" PRId64 ", eventTime=%" PRId64 ", "
              "pointerCount=%" PRIu32 " \n%s",
              "pointerCount=%" PRIu32 " \n%s",
              mChannel->getName().c_str(), __func__, seq, deviceId,
              mChannel->getName().c_str(), __func__, seq, eventId, deviceId,
              inputEventSourceToString(source).c_str(), displayId,
              inputEventSourceToString(source).c_str(), displayId,
              MotionEvent::actionToString(action).c_str(), actionButton, flags, edgeFlags,
              MotionEvent::actionToString(action).c_str(), actionButton, flags, edgeFlags,
              metaState, buttonState, motionClassificationToString(classification), xPrecision,
              metaState, buttonState, motionClassificationToString(classification), xPrecision,
@@ -680,8 +680,8 @@ status_t InputPublisher::publishFocusEvent(uint32_t seq, int32_t eventId, bool h
                                           mChannel->getName().c_str(), toString(hasFocus));
                                           mChannel->getName().c_str(), toString(hasFocus));
        ATRACE_NAME(message.c_str());
        ATRACE_NAME(message.c_str());
    }
    }
    ALOGD_IF(debugTransportPublisher(), "channel '%s' publisher ~ %s: seq=%u, hasFocus=%s",
    ALOGD_IF(debugTransportPublisher(), "channel '%s' publisher ~ %s: seq=%u, id=%d, hasFocus=%s",
             mChannel->getName().c_str(), __func__, seq, toString(hasFocus));
             mChannel->getName().c_str(), __func__, seq, eventId, toString(hasFocus));


    InputMessage msg;
    InputMessage msg;
    msg.header.type = InputMessage::Type::FOCUS;
    msg.header.type = InputMessage::Type::FOCUS;
@@ -700,8 +700,8 @@ status_t InputPublisher::publishCaptureEvent(uint32_t seq, int32_t eventId,
        ATRACE_NAME(message.c_str());
        ATRACE_NAME(message.c_str());
    }
    }
    ALOGD_IF(debugTransportPublisher(),
    ALOGD_IF(debugTransportPublisher(),
             "channel '%s' publisher ~ %s: seq=%u, pointerCaptureEnabled=%s",
             "channel '%s' publisher ~ %s: seq=%u, id=%d, pointerCaptureEnabled=%s",
             mChannel->getName().c_str(), __func__, seq, toString(pointerCaptureEnabled));
             mChannel->getName().c_str(), __func__, seq, eventId, toString(pointerCaptureEnabled));


    InputMessage msg;
    InputMessage msg;
    msg.header.type = InputMessage::Type::CAPTURE;
    msg.header.type = InputMessage::Type::CAPTURE;
@@ -720,8 +720,8 @@ status_t InputPublisher::publishDragEvent(uint32_t seq, int32_t eventId, float x
        ATRACE_NAME(message.c_str());
        ATRACE_NAME(message.c_str());
    }
    }
    ALOGD_IF(debugTransportPublisher(),
    ALOGD_IF(debugTransportPublisher(),
             "channel '%s' publisher ~ %s: seq=%u, x=%f, y=%f, isExiting=%s",
             "channel '%s' publisher ~ %s: seq=%u, id=%d, x=%f, y=%f, isExiting=%s",
             mChannel->getName().c_str(), __func__, seq, x, y, toString(isExiting));
             mChannel->getName().c_str(), __func__, seq, eventId, x, y, toString(isExiting));


    InputMessage msg;
    InputMessage msg;
    msg.header.type = InputMessage::Type::DRAG;
    msg.header.type = InputMessage::Type::DRAG;
@@ -740,8 +740,9 @@ status_t InputPublisher::publishTouchModeEvent(uint32_t seq, int32_t eventId, bo
                             mChannel->getName().c_str(), toString(isInTouchMode));
                             mChannel->getName().c_str(), toString(isInTouchMode));
        ATRACE_NAME(message.c_str());
        ATRACE_NAME(message.c_str());
    }
    }
    ALOGD_IF(debugTransportPublisher(), "channel '%s' publisher ~ %s: seq=%u, isInTouchMode=%s",
    ALOGD_IF(debugTransportPublisher(),
             mChannel->getName().c_str(), __func__, seq, toString(isInTouchMode));
             "channel '%s' publisher ~ %s: seq=%u, id=%d, isInTouchMode=%s",
             mChannel->getName().c_str(), __func__, seq, eventId, toString(isInTouchMode));


    InputMessage msg;
    InputMessage msg;
    msg.header.type = InputMessage::Type::TOUCH_MODE;
    msg.header.type = InputMessage::Type::TOUCH_MODE;
@@ -752,15 +753,18 @@ status_t InputPublisher::publishTouchModeEvent(uint32_t seq, int32_t eventId, bo
}
}


android::base::Result<InputPublisher::ConsumerResponse> InputPublisher::receiveConsumerResponse() {
android::base::Result<InputPublisher::ConsumerResponse> InputPublisher::receiveConsumerResponse() {
    ALOGD_IF(debugTransportPublisher(), "channel '%s' publisher ~ %s", mChannel->getName().c_str(),
             __func__);

    InputMessage msg;
    InputMessage msg;
    status_t result = mChannel->receiveMessage(&msg);
    status_t result = mChannel->receiveMessage(&msg);
    if (result) {
    if (result) {
        ALOGD_IF(debugTransportPublisher(), "channel '%s' publisher ~ %s: %s",
                 mChannel->getName().c_str(), __func__, strerror(result));
        return android::base::Error(result);
        return android::base::Error(result);
    }
    }
    if (msg.header.type == InputMessage::Type::FINISHED) {
    if (msg.header.type == InputMessage::Type::FINISHED) {
        ALOGD_IF(debugTransportPublisher(),
                 "channel '%s' publisher ~ %s: finished: seq=%u, handled=%s",
                 mChannel->getName().c_str(), __func__, msg.header.seq,
                 toString(msg.body.finished.handled));
        return Finished{
        return Finished{
                .seq = msg.header.seq,
                .seq = msg.header.seq,
                .handled = msg.body.finished.handled,
                .handled = msg.body.finished.handled,
@@ -769,6 +773,8 @@ android::base::Result<InputPublisher::ConsumerResponse> InputPublisher::receiveC
    }
    }


    if (msg.header.type == InputMessage::Type::TIMELINE) {
    if (msg.header.type == InputMessage::Type::TIMELINE) {
        ALOGD_IF(debugTransportPublisher(), "channel '%s' publisher ~ %s: timeline: id=%d",
                 mChannel->getName().c_str(), __func__, msg.body.timeline.eventId);
        return Timeline{
        return Timeline{
                .inputEventId = msg.body.timeline.eventId,
                .inputEventId = msg.body.timeline.eventId,
                .graphicsTimeline = msg.body.timeline.graphicsTimeline,
                .graphicsTimeline = msg.body.timeline.graphicsTimeline,
+26 −20
Original line number Original line Diff line number Diff line
@@ -824,11 +824,24 @@ status_t JpegR::appendRecoveryMap(jr_compressed_ptr compressed_jpeg_image,
    return ERROR_JPEGR_INVALID_NULL_PTR;
    return ERROR_JPEGR_INVALID_NULL_PTR;
  }
  }


  int pos = 0;
  const string nameSpace = "http://ns.adobe.com/xap/1.0/";
  const int nameSpaceLength = nameSpace.size() + 1;  // need to count the null terminator


  const string xmp_primary = generateXmpForPrimaryImage(compressed_recovery_map->length);
  // calculate secondary image length first, because the length will be written into the primary
  // image xmp
  const string xmp_secondary = generateXmpForSecondaryImage(*metadata);
  const string xmp_secondary = generateXmpForSecondaryImage(*metadata);
  const int xmp_secondary_length = 2 /* 2 bytes representing the length of the package */
                                 + nameSpaceLength /* 29 bytes length of name space including \0 */
                                 + xmp_secondary.size(); /* length of xmp packet */
  const int secondary_image_size = 2 /* 2 bytes length of APP1 sign */
                                 + xmp_secondary_length
                                 + compressed_recovery_map->length;
  // primary image
  const string xmp_primary = generateXmpForPrimaryImage(secondary_image_size);
  // same as primary
  const int xmp_primary_length = 2 + nameSpaceLength + xmp_primary.size();


  int pos = 0;
  // Begin primary image
  // Begin primary image
  // Write SOI
  // Write SOI
  JPEGR_CHECK(Write(dest, &photos_editing_formats::image_io::JpegMarker::kStart, 1, pos));
  JPEGR_CHECK(Write(dest, &photos_editing_formats::image_io::JpegMarker::kStart, 1, pos));
@@ -848,12 +861,7 @@ status_t JpegR::appendRecoveryMap(jr_compressed_ptr compressed_jpeg_image,


  // Prepare and write XMP
  // Prepare and write XMP
  {
  {
    const string nameSpace = "http://ns.adobe.com/xap/1.0/\0";
    const int length = xmp_primary_length;
    const int nameSpaceLength = nameSpace.size() + 1;  // need to count the null terminator
    // 2 bytes: representing the length of the package
    // 29 bytes: length of name space "http://ns.adobe.com/xap/1.0/\0",
    // x bytes: length of xmp packet
    const int length = 2 + nameSpaceLength + xmp_primary.size();
    const uint8_t lengthH = ((length >> 8) & 0xff);
    const uint8_t lengthH = ((length >> 8) & 0xff);
    const uint8_t lengthL = (length & 0xff);
    const uint8_t lengthL = (length & 0xff);
    JPEGR_CHECK(Write(dest, &photos_editing_formats::image_io::JpegMarker::kStart, 1, pos));
    JPEGR_CHECK(Write(dest, &photos_editing_formats::image_io::JpegMarker::kStart, 1, pos));
@@ -870,12 +878,15 @@ status_t JpegR::appendRecoveryMap(jr_compressed_ptr compressed_jpeg_image,
      const uint8_t lengthH = ((length >> 8) & 0xff);
      const uint8_t lengthH = ((length >> 8) & 0xff);
      const uint8_t lengthL = (length & 0xff);
      const uint8_t lengthL = (length & 0xff);
      int primary_image_size = pos + length + compressed_jpeg_image->length;
      int primary_image_size = pos + length + compressed_jpeg_image->length;
      int secondary_image_offset = primary_image_size;
      // between APP2 + package size + signature
      int secondary_image_size = xmp_secondary.size() + compressed_recovery_map->length;
      // ff e2 00 58 4d 50 46 00
      sp<DataStruct> mpf = generateMpf(0, /* primary_image_offset */
      // 2 + 2 + 4 = 8 (bytes)
                                       primary_image_size,
      // and ff d8 sign of the secondary image
                                       secondary_image_offset,
      int secondary_image_offset = primary_image_size - pos - 8;
                                       secondary_image_size);
      sp<DataStruct> mpf = generateMpf(primary_image_size,
                                       0, /* primary_image_offset */
                                       secondary_image_size,
                                       secondary_image_offset);
      JPEGR_CHECK(Write(dest, &photos_editing_formats::image_io::JpegMarker::kStart, 1, pos));
      JPEGR_CHECK(Write(dest, &photos_editing_formats::image_io::JpegMarker::kStart, 1, pos));
      JPEGR_CHECK(Write(dest, &photos_editing_formats::image_io::JpegMarker::kAPP2, 1, pos));
      JPEGR_CHECK(Write(dest, &photos_editing_formats::image_io::JpegMarker::kAPP2, 1, pos));
      JPEGR_CHECK(Write(dest, &lengthH, 1, pos));
      JPEGR_CHECK(Write(dest, &lengthH, 1, pos));
@@ -895,12 +906,7 @@ status_t JpegR::appendRecoveryMap(jr_compressed_ptr compressed_jpeg_image,


  // Prepare and write XMP
  // Prepare and write XMP
  {
  {
    const string nameSpace = "http://ns.adobe.com/xap/1.0/\0";
    const int length = xmp_secondary_length;
    const int nameSpaceLength = nameSpace.size() + 1;  // need to count the null terminator
    // 2 bytes: representing the length of the package
    // 29 bytes: length of name space "http://ns.adobe.com/xap/1.0/\0",
    // x bytes: length of xmp packet
    const int length = 2 + nameSpaceLength + xmp_secondary.size();
    const uint8_t lengthH = ((length >> 8) & 0xff);
    const uint8_t lengthH = ((length >> 8) & 0xff);
    const uint8_t lengthL = (length & 0xff);
    const uint8_t lengthL = (length & 0xff);
    JPEGR_CHECK(Write(dest, &photos_editing_formats::image_io::JpegMarker::kStart, 1, pos));
    JPEGR_CHECK(Write(dest, &photos_editing_formats::image_io::JpegMarker::kStart, 1, pos));
+19 −19
Original line number Original line Diff line number Diff line
@@ -4072,14 +4072,15 @@ void InputDispatcher::accelerateMetaShortcuts(const int32_t deviceId, const int3
}
}


void InputDispatcher::notifyKey(const NotifyKeyArgs* args) {
void InputDispatcher::notifyKey(const NotifyKeyArgs* args) {
    if (debugInboundEventDetails()) {
    ALOGD_IF(debugInboundEventDetails(),
        ALOGD("notifyKey - eventTime=%" PRId64 ", deviceId=%d, source=0x%x, displayId=%" PRId32
             "notifyKey - id=%" PRIx32 ", eventTime=%" PRId64
              "policyFlags=0x%x, action=0x%x, "
             ", deviceId=%d, source=%s, displayId=%" PRId32
              "flags=0x%x, keyCode=0x%x, scanCode=0x%x, metaState=0x%x, downTime=%" PRId64,
             "policyFlags=0x%x, action=%s, flags=0x%x, keyCode=%s, scanCode=0x%x, metaState=0x%x, "
              args->eventTime, args->deviceId, args->source, args->displayId, args->policyFlags,
             "downTime=%" PRId64,
              args->action, args->flags, args->keyCode, args->scanCode, args->metaState,
             args->id, args->eventTime, args->deviceId,
              args->downTime);
             inputEventSourceToString(args->source).c_str(), args->displayId, args->policyFlags,
    }
             KeyEvent::actionToString(args->action), args->flags, KeyEvent::getLabel(args->keyCode),
             args->scanCode, args->metaState, args->downTime);
    if (!validateKeyEvent(args->action)) {
    if (!validateKeyEvent(args->action)) {
        return;
        return;
    }
    }
@@ -4151,22 +4152,21 @@ bool InputDispatcher::shouldSendKeyToInputFilterLocked(const NotifyKeyArgs* args


void InputDispatcher::notifyMotion(const NotifyMotionArgs* args) {
void InputDispatcher::notifyMotion(const NotifyMotionArgs* args) {
    if (debugInboundEventDetails()) {
    if (debugInboundEventDetails()) {
        ALOGD("notifyMotion - id=%" PRIx32 " eventTime=%" PRId64 ", deviceId=%d, source=0x%x, "
        ALOGD("notifyMotion - id=%" PRIx32 " eventTime=%" PRId64 ", deviceId=%d, source=%s, "
              "displayId=%" PRId32 ", policyFlags=0x%x, "
              "displayId=%" PRId32 ", policyFlags=0x%x, "
              "action=%s, actionButton=0x%x, flags=0x%x, metaState=0x%x, buttonState=0x%x, "
              "action=%s, actionButton=0x%x, flags=0x%x, metaState=0x%x, buttonState=0x%x, "
              "edgeFlags=0x%x, xPrecision=%f, yPrecision=%f, xCursorPosition=%f, "
              "edgeFlags=0x%x, xPrecision=%f, yPrecision=%f, xCursorPosition=%f, "
              "yCursorPosition=%f, downTime=%" PRId64,
              "yCursorPosition=%f, downTime=%" PRId64,
              args->id, args->eventTime, args->deviceId, args->source, args->displayId,
              args->id, args->eventTime, args->deviceId,
              args->policyFlags, MotionEvent::actionToString(args->action).c_str(),
              inputEventSourceToString(args->source).c_str(), args->displayId, args->policyFlags,
              args->actionButton, args->flags, args->metaState, args->buttonState, args->edgeFlags,
              MotionEvent::actionToString(args->action).c_str(), args->actionButton, args->flags,
              args->xPrecision, args->yPrecision, args->xCursorPosition, args->yCursorPosition,
              args->metaState, args->buttonState, args->edgeFlags, args->xPrecision,
              args->downTime);
              args->yPrecision, args->xCursorPosition, args->yCursorPosition, args->downTime);
        for (uint32_t i = 0; i < args->pointerCount; i++) {
        for (uint32_t i = 0; i < args->pointerCount; i++) {
            ALOGD("  Pointer %d: id=%d, toolType=%d, "
            ALOGD("  Pointer %d: id=%d, toolType=%s, x=%f, y=%f, pressure=%f, size=%f, "
                  "x=%f, y=%f, pressure=%f, size=%f, "
                  "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, orientation=%f",
                  "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, "
                  i, args->pointerProperties[i].id,
                  "orientation=%f",
                  motionToolTypeToString(args->pointerProperties[i].toolType),
                  i, args->pointerProperties[i].id, args->pointerProperties[i].toolType,
                  args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_X),
                  args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_X),
                  args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_Y),
                  args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_Y),
                  args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_PRESSURE),
                  args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_PRESSURE),