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

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

Snap for 11853201 from 9679086f to 24Q3-release

Change-Id: I7fed17226aa4c002b021170fc9dca17cd18e8534
parents 490fbb60 9679086f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -58,6 +58,12 @@ void CmdFuzzer::process(const uint8_t* data, size_t size) {
        while (mFDP->remaining_bytes() > 0) {
            size_t sizestr = mFDP->ConsumeIntegralInRange<size_t>(1, mFDP->remaining_bytes());
            string argument = mFDP->ConsumeBytesAsString(sizestr);
            /**
             * Filtering out strings based on "-w" argument. Since it leads to timeout.
             */
            if(strcmp(argument.c_str(), "-w") == 0) {
                continue;
            }
            arguments.emplace_back(argument);
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -723,7 +723,7 @@ TEST_F(SafeInterfaceTest, TestIncrementNoCopyNoMove) {
    ASSERT_EQ(a.getValue() + 1, aPlusOne.getValue());
}

TEST_F(SafeInterfaceTest, TestIncremementParcelableVector) {
TEST_F(SafeInterfaceTest, TestIncrementParcelableVector) {
    const std::vector<TestParcelable> a{TestParcelable{1}, TestParcelable{2}};
    std::vector<TestParcelable> aPlusOne;
    status_t result = mSafeInterfaceTest->increment(a, &aPlusOne);
+0 −3
Original line number Diff line number Diff line
@@ -183,7 +183,6 @@ private:
    static AStatsManager_PullAtomCallbackReturn pullAtomCallback(int32_t atomTag,
                                                                 AStatsEventList* outEventList,
                                                                 void* cookie) {
        ALOGI("Received pull request for touchpad usage atom");
        LOG_ALWAYS_FATAL_IF(atomTag != android::util::TOUCHPAD_USAGE);
        MetricsAccumulator& accumulator = MetricsAccumulator::getInstance();
        accumulator.produceAtomsAndReset(*outEventList);
@@ -191,14 +190,12 @@ private:
    }

    void produceAtomsAndReset(AStatsEventList& outEventList) {
        ALOGI("Acquiring lock for touchpad usage metrics...");
        std::scoped_lock lock(mLock);
        produceAtomsLocked(outEventList);
        resetCountersLocked();
    }

    void produceAtomsLocked(AStatsEventList& outEventList) const REQUIRES(mLock) {
        ALOGI("Producing touchpad usage atoms for %zu counters", mCounters.size());
        for (auto& [id, counters] : mCounters) {
            auto [busId, vendorId, productId, versionId] = id;
            addAStatsEvent(&outEventList, android::util::TOUCHPAD_USAGE, vendorId, productId,
+25 −14
Original line number Diff line number Diff line
@@ -37,6 +37,18 @@ void Daltonizer::setMode(ColorBlindnessMode mode) {
    }
}

void Daltonizer::setLevel(int32_t level) {
    if (level < 0 || level > 10) {
        return;
    }

    float newLevel = level / 10.0f;
    if (std::fabs(mLevel - newLevel) > 0.09f) {
        mDirty = true;
    }
    mLevel = newLevel;
}

const mat4& Daltonizer::operator()() {
    if (mDirty) {
        mDirty = false;
@@ -117,25 +129,24 @@ void Daltonizer::update() {
    // a color blind user and "spread" this error onto the healthy cones.
    // The matrices below perform this last step and have been chosen arbitrarily.

    // The amount of correction can be adjusted here.

    // Scale 0 represents no change (mColorTransform is identical matrix).
    // error spread for protanopia
    const mat4 errp(    1.0, 0.7, 0.7, 0,
                        0.0, 1.0, 0.0, 0,
                        0.0, 0.0, 1.0, 0,
                          0,   0,   0, 1);
    const mat4 errp(1.0, mLevel, mLevel, 0.0,
                    0.0,    1.0,    0.0, 0.0,
                    0.0,    0.0,    1.0, 0.0,
                    0.0,    0.0,    0.0, 1.0);

    // error spread for deuteranopia
    const mat4 errd(    1.0, 0.0, 0.0, 0,
                        0.7, 1.0, 0.7, 0,
                        0.0, 0.0, 1.0, 0,
                          0,   0,   0, 1);
    const mat4 errd(   1.0, 0.0,    0.0, 0.0,
                    mLevel, 1.0, mLevel, 0.0,
                       0.0, 0.0,    1.0, 0.0,
                       0.0, 0.0,    0.0, 1.0);

    // error spread for tritanopia
    const mat4 errt(    1.0, 0.0, 0.0, 0,
                        0.0, 1.0, 0.0, 0,
                        0.7, 0.7, 1.0, 0,
                          0,   0,   0, 1);
    const mat4 errt(   1.0,    0.0, 0.0, 0.0,
                       0.0,    1.0, 0.0, 0.0,
                    mLevel, mLevel, 1.0, 0.0,
                       0.0,    0.0, 0.0, 1.0);

    // And the magic happens here...
    // We construct the matrix that will perform the whole correction.
+10 −0
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@

namespace android {

// Forward declare test class
class DaltonizerTest;

enum class ColorBlindnessType {
    None,               // Disables the Daltonizer
    Protanomaly,        // L (red) cone deficient
@@ -37,10 +40,15 @@ class Daltonizer {
public:
    void setType(ColorBlindnessType type);
    void setMode(ColorBlindnessMode mode);
    // sets level for correction saturation, [0-10].
    void setLevel(int32_t level);

    // returns the color transform to apply in the shader
    const mat4& operator()();

    // For testing.
    friend class DaltonizerTest;

private:
    void update();

@@ -48,6 +56,8 @@ private:
    ColorBlindnessMode mMode = ColorBlindnessMode::Simulation;
    bool mDirty = true;
    mat4 mColorTransform;
    // level of error spreading, [0.0-1.0].
    float mLevel = 0.7f;
};

} /* namespace android */
Loading