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

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

Snap for 12667701 from f9854d27 to 25Q1-release

Change-Id: I18cf1a469b6b785b5f0f2ff3d2520798e181e4d5
parents 3e1b75e4 f9854d27
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ public:
    /*oneway*/ virtual status_t playerAttributes(audio_unique_id_t piid, audio_usage_t usage,
                audio_content_type_t content)= 0;
    /*oneway*/ virtual status_t playerEvent(audio_unique_id_t piid, player_state_t event,
                audio_port_handle_t eventId) = 0;
                const std::vector<audio_port_handle_t>& eventIds) = 0;
    /*oneway*/ virtual status_t releasePlayer(audio_unique_id_t piid) = 0;
    virtual audio_unique_id_t trackRecorder(const sp<IBinder>& recorder) = 0;
    /*oneway*/ virtual status_t recorderEvent(audio_unique_id_t riid, recorder_state_t event) = 0;
+37 −3
Original line number Diff line number Diff line
@@ -19,9 +19,12 @@

#include <algorithm>
#include <cctype>
#include <cstdint>
#include <numeric>
#include <optional>
#include <span>
#include <string>
#include <string_view>

#include <ftl/hash.h>
#include <log/log.h>
@@ -194,6 +197,21 @@ std::optional<Edid> parseEdid(const DisplayIdentificationData& edid) {
    const uint16_t productId =
            static_cast<uint16_t>(edid[kProductIdOffset] | (edid[kProductIdOffset + 1] << 8));

    //   Bytes 12-15: display serial number, in little-endian (LSB). This field is
    //   optional and its absence is marked by having all bytes set to 0x00.
    //   Values do not represent ASCII characters.
    constexpr size_t kSerialNumberOffset = 12;
    if (edid.size() < kSerialNumberOffset + sizeof(uint32_t)) {
        ALOGE("Invalid EDID: block zero S/N is truncated.");
        return {};
    }
    const uint32_t blockZeroSerialNumber = edid[kSerialNumberOffset] +
            (edid[kSerialNumberOffset + 1] << 8) + (edid[kSerialNumberOffset + 2] << 16) +
            (edid[kSerialNumberOffset + 3] << 24);
    const auto hashedBlockZeroSNOpt = blockZeroSerialNumber == 0
            ? std::nullopt
            : ftl::stable_hash(std::string_view(std::to_string(blockZeroSerialNumber)));

    constexpr size_t kManufactureWeekOffset = 16;
    if (edid.size() < kManufactureWeekOffset + sizeof(uint8_t)) {
        ALOGE("Invalid EDID: manufacture week is truncated.");
@@ -212,6 +230,15 @@ std::optional<Edid> parseEdid(const DisplayIdentificationData& edid) {
    ALOGW_IF(manufactureOrModelYear <= 0xf,
             "Invalid EDID: model year or manufacture year cannot be in the range [0x0, 0xf].");

    constexpr size_t kMaxHorizontalPhysicalSizeOffset = 21;
    constexpr size_t kMaxVerticalPhysicalSizeOffset = 22;
    if (edid.size() < kMaxVerticalPhysicalSizeOffset + sizeof(uint8_t)) {
        ALOGE("Invalid EDID: display's physical size is truncated.");
        return {};
    }
    ui::Size maxPhysicalSizeInCm(edid[kMaxHorizontalPhysicalSizeOffset],
                                 edid[kMaxVerticalPhysicalSizeOffset]);

    constexpr size_t kDescriptorOffset = 54;
    if (edid.size() < kDescriptorOffset) {
        ALOGE("Invalid EDID: descriptors are missing.");
@@ -222,7 +249,8 @@ std::optional<Edid> parseEdid(const DisplayIdentificationData& edid) {
    view = view.subspan(kDescriptorOffset);

    std::string_view displayName;
    std::string_view serialNumber;
    std::string_view descriptorBlockSerialNumber;
    std::optional<uint64_t> hashedDescriptorBlockSNOpt = std::nullopt;
    std::string_view asciiText;
    ui::Size preferredDTDPixelSize;
    ui::Size preferredDTDPhysicalSize;
@@ -247,7 +275,10 @@ std::optional<Edid> parseEdid(const DisplayIdentificationData& edid) {
                    asciiText = parseEdidText(descriptor);
                    break;
                case 0xff:
                    serialNumber = parseEdidText(descriptor);
                    descriptorBlockSerialNumber = parseEdidText(descriptor);
                    hashedDescriptorBlockSNOpt = descriptorBlockSerialNumber.empty()
                            ? std::nullopt
                            : ftl::stable_hash(descriptorBlockSerialNumber);
                    break;
            }
        } else if (isDetailedTimingDescriptor(view)) {
@@ -288,7 +319,7 @@ std::optional<Edid> parseEdid(const DisplayIdentificationData& edid) {

    if (modelString.empty()) {
        ALOGW("Invalid EDID: falling back to serial number due to missing display name.");
        modelString = serialNumber;
        modelString = descriptorBlockSerialNumber;
    }
    if (modelString.empty()) {
        ALOGW("Invalid EDID: falling back to ASCII text due to missing serial number.");
@@ -341,11 +372,14 @@ std::optional<Edid> parseEdid(const DisplayIdentificationData& edid) {
    return Edid{
            .manufacturerId = manufacturerId,
            .productId = productId,
            .hashedBlockZeroSerialNumberOpt = hashedBlockZeroSNOpt,
            .hashedDescriptorBlockSerialNumberOpt = hashedDescriptorBlockSNOpt,
            .pnpId = *pnpId,
            .modelHash = modelHash,
            .displayName = displayName,
            .manufactureOrModelYear = manufactureOrModelYear,
            .manufactureWeek = manufactureWeek,
            .physicalSizeInCm = maxPhysicalSizeInCm,
            .cea861Block = cea861Block,
            .preferredDetailedTimingDescriptor = preferredDetailedTimingDescriptor,
    };
+3 −0
Original line number Diff line number Diff line
@@ -69,11 +69,14 @@ struct Cea861ExtensionBlock : ExtensionBlock {
struct Edid {
    uint16_t manufacturerId;
    uint16_t productId;
    std::optional<uint64_t> hashedBlockZeroSerialNumberOpt;
    std::optional<uint64_t> hashedDescriptorBlockSerialNumberOpt;
    PnpId pnpId;
    uint32_t modelHash;
    std::string_view displayName;
    uint8_t manufactureOrModelYear;
    uint8_t manufactureWeek;
    ui::Size physicalSizeInCm;
    std::optional<Cea861ExtensionBlock> cea861Block;
    std::optional<DetailedTimingDescriptor> preferredDetailedTimingDescriptor;
};
+34 −4
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ namespace android {
namespace {

const unsigned char kInternalEdid[] =
        "\x00\xff\xff\xff\xff\xff\xff\x00\x4c\xa3\x42\x31\x00\x00\x00\x00"
        "\x00\xff\xff\xff\xff\xff\xff\x00\x4c\xa3\x42\x31\x4e\x61\xbc\x00"
        "\x00\x15\x01\x03\x80\x1a\x10\x78\x0a\xd3\xe5\x95\x5c\x60\x90\x27"
        "\x19\x50\x54\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
        "\x01\x01\x01\x01\x01\x01\x9e\x1b\x00\xa0\x50\x20\x12\x30\x10\x30"
@@ -54,7 +54,7 @@ const unsigned char kExternalEdid[] =

// Extended EDID with timing extension.
const unsigned char kExternalEedid[] =
        "\x00\xff\xff\xff\xff\xff\xff\x00\x4c\x2d\xfe\x08\x00\x00\x00\x00"
        "\x00\xff\xff\xff\xff\xff\xff\x00\x4c\x2d\xfe\x08\xb1\x7f\x39\x05"
        "\x29\x15\x01\x03\x80\x10\x09\x78\x0a\xee\x91\xa3\x54\x4c\x99\x26"
        "\x0f\x50\x54\xbd\xef\x80\x71\x4f\x81\xc0\x81\x00\x81\x80\x95\x00"
        "\xa9\xc0\xb3\x00\x01\x01\x02\x3a\x80\x18\x71\x38\x2d\x40\x58\x2c"
@@ -112,7 +112,7 @@ const unsigned char kHisenseTvEdid[] =
        "\x07";

const unsigned char kCtlDisplayEdid[] =
        "\x00\xff\xff\xff\xff\xff\xff\x00\x0e\x8c\x9d\x24\x00\x00\x00\x00"
        "\x00\xff\xff\xff\xff\xff\xff\x00\x0e\x8c\x9d\x24\x30\x41\xab\x00"
        "\xff\x17\x01\x04\xa5\x34\x1d\x78\x3a\xa7\x25\xa4\x57\x51\xa0\x26"
        "\x10\x50\x54\xbf\xef\x80\xb3\x00\xa9\x40\x95\x00\x81\x40\x81\x80"
        "\x95\x0f\x71\x4f\x90\x40\x02\x3a\x80\x18\x71\x38\x2d\x40\x58\x2c"
@@ -191,8 +191,13 @@ TEST(DisplayIdentificationTest, parseEdid) {
    EXPECT_EQ(hash("121AT11-801"), 626564263);
    EXPECT_TRUE(edid->displayName.empty());
    EXPECT_EQ(12610, edid->productId);
    EXPECT_TRUE(edid->hashedBlockZeroSerialNumberOpt.has_value());
    EXPECT_EQ(ftl::stable_hash("12345678"), edid->hashedBlockZeroSerialNumberOpt.value());
    EXPECT_FALSE(edid->hashedDescriptorBlockSerialNumberOpt.has_value());
    EXPECT_EQ(21, edid->manufactureOrModelYear);
    EXPECT_EQ(0, edid->manufactureWeek);
    EXPECT_EQ(26, edid->physicalSizeInCm.width);
    EXPECT_EQ(16, edid->physicalSizeInCm.height);
    EXPECT_FALSE(edid->cea861Block);
    EXPECT_EQ(1280, edid->preferredDetailedTimingDescriptor->pixelSizeCount.width);
    EXPECT_EQ(800, edid->preferredDetailedTimingDescriptor->pixelSizeCount.height);
@@ -207,8 +212,14 @@ TEST(DisplayIdentificationTest, parseEdid) {
    EXPECT_EQ(hash("HP ZR30w"), 918492362);
    EXPECT_EQ("HP ZR30w", edid->displayName);
    EXPECT_EQ(10348, edid->productId);
    EXPECT_TRUE(edid->hashedBlockZeroSerialNumberOpt.has_value());
    EXPECT_EQ(ftl::stable_hash("16843009"), edid->hashedBlockZeroSerialNumberOpt.value());
    EXPECT_TRUE(edid->hashedDescriptorBlockSerialNumberOpt.has_value());
    EXPECT_EQ(ftl::stable_hash("CN4202137Q"), edid->hashedDescriptorBlockSerialNumberOpt.value());
    EXPECT_EQ(22, edid->manufactureOrModelYear);
    EXPECT_EQ(2, edid->manufactureWeek);
    EXPECT_EQ(64, edid->physicalSizeInCm.width);
    EXPECT_EQ(40, edid->physicalSizeInCm.height);
    EXPECT_FALSE(edid->cea861Block);
    EXPECT_EQ(1280, edid->preferredDetailedTimingDescriptor->pixelSizeCount.width);
    EXPECT_EQ(800, edid->preferredDetailedTimingDescriptor->pixelSizeCount.height);
@@ -223,8 +234,13 @@ TEST(DisplayIdentificationTest, parseEdid) {
    EXPECT_EQ(hash("SAMSUNG"), 1201368132);
    EXPECT_EQ("SAMSUNG", edid->displayName);
    EXPECT_EQ(2302, edid->productId);
    EXPECT_TRUE(edid->hashedBlockZeroSerialNumberOpt.has_value());
    EXPECT_EQ(ftl::stable_hash("87654321"), edid->hashedBlockZeroSerialNumberOpt.value());
    EXPECT_FALSE(edid->hashedDescriptorBlockSerialNumberOpt.has_value());
    EXPECT_EQ(21, edid->manufactureOrModelYear);
    EXPECT_EQ(41, edid->manufactureWeek);
    EXPECT_EQ(16, edid->physicalSizeInCm.width);
    EXPECT_EQ(9, edid->physicalSizeInCm.height);
    ASSERT_TRUE(edid->cea861Block);
    ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock);
    auto physicalAddress = edid->cea861Block->hdmiVendorDataBlock->physicalAddress;
@@ -245,8 +261,13 @@ TEST(DisplayIdentificationTest, parseEdid) {
    EXPECT_EQ(hash("Panasonic-TV"), 3876373262);
    EXPECT_EQ("Panasonic-TV", edid->displayName);
    EXPECT_EQ(41622, edid->productId);
    EXPECT_TRUE(edid->hashedBlockZeroSerialNumberOpt.has_value());
    EXPECT_EQ(ftl::stable_hash("16843009"), edid->hashedBlockZeroSerialNumberOpt.value());
    EXPECT_FALSE(edid->hashedDescriptorBlockSerialNumberOpt.has_value());
    EXPECT_EQ(29, edid->manufactureOrModelYear);
    EXPECT_EQ(0, edid->manufactureWeek);
    EXPECT_EQ(128, edid->physicalSizeInCm.width);
    EXPECT_EQ(72, edid->physicalSizeInCm.height);
    ASSERT_TRUE(edid->cea861Block);
    ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock);
    physicalAddress = edid->cea861Block->hdmiVendorDataBlock->physicalAddress;
@@ -267,8 +288,12 @@ TEST(DisplayIdentificationTest, parseEdid) {
    EXPECT_EQ(hash("Hisense"), 2859844809);
    EXPECT_EQ("Hisense", edid->displayName);
    EXPECT_EQ(0, edid->productId);
    EXPECT_FALSE(edid->hashedBlockZeroSerialNumberOpt.has_value());
    EXPECT_FALSE(edid->hashedDescriptorBlockSerialNumberOpt.has_value());
    EXPECT_EQ(29, edid->manufactureOrModelYear);
    EXPECT_EQ(18, edid->manufactureWeek);
    EXPECT_EQ(0, edid->physicalSizeInCm.width);
    EXPECT_EQ(0, edid->physicalSizeInCm.height);
    ASSERT_TRUE(edid->cea861Block);
    ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock);
    physicalAddress = edid->cea861Block->hdmiVendorDataBlock->physicalAddress;
@@ -289,8 +314,13 @@ TEST(DisplayIdentificationTest, parseEdid) {
    EXPECT_EQ(hash("LP2361"), 1523181158);
    EXPECT_EQ("LP2361", edid->displayName);
    EXPECT_EQ(9373, edid->productId);
    EXPECT_TRUE(edid->hashedBlockZeroSerialNumberOpt.has_value());
    EXPECT_EQ(ftl::stable_hash("11223344"), edid->hashedBlockZeroSerialNumberOpt.value());
    EXPECT_FALSE(edid->hashedDescriptorBlockSerialNumberOpt.has_value());
    EXPECT_EQ(23, edid->manufactureOrModelYear);
    EXPECT_EQ(0xff, edid->manufactureWeek);
    EXPECT_EQ(52, edid->physicalSizeInCm.width);
    EXPECT_EQ(29, edid->physicalSizeInCm.height);
    ASSERT_TRUE(edid->cea861Block);
    EXPECT_FALSE(edid->cea861Block->hdmiVendorDataBlock);
    EXPECT_EQ(1360, edid->preferredDetailedTimingDescriptor->pixelSizeCount.width);
+5 −2
Original line number Diff line number Diff line
@@ -87,12 +87,15 @@ public:
    }

    virtual status_t playerEvent(audio_unique_id_t piid, player_state_t event,
            audio_port_handle_t eventId) {
            const std::vector<audio_port_handle_t>& eventIds) {
        Parcel data, reply;
        data.writeInterfaceToken(IAudioManager::getInterfaceDescriptor());
        data.writeInt32((int32_t) piid);
        data.writeInt32((int32_t) event);
        data.writeInt32((int32_t) eventIds.size());
        for (auto eventId: eventIds) {
            data.writeInt32((int32_t) eventId);
        }
        return remote()->transact(PLAYER_EVENT, data, &reply, IBinder::FLAG_ONEWAY);
    }

Loading