From 8f82ebc72c2eef199ce7b2984adea2a61309cc11 Mon Sep 17 00:00:00 2001 From: Matt Buckley Date: Fri, 7 Apr 2023 23:18:14 +0000 Subject: [PATCH 01/44] Add POWER_EFFICIENCY uclamp max to adpf config Add the "UclampMax_EfficientBase" value to the ADPF config in the powerhint.json to specify efficient core scheduling in the static case, and "UclampMax_EfficientOffset" for the dynamic case, for this device. Bug: 277285195 Test: manual Change-Id: Ibeca70e171d8c15ec73eb57cd8dd7a5bf21eaea5 --- powerhint.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/powerhint.json b/powerhint.json index d68ff49..52d38f9 100644 --- a/powerhint.json +++ b/powerhint.json @@ -1941,6 +1941,8 @@ "UclampMin_Init": 232, "UclampMin_High": 480, "UclampMin_Low": 2, + "UclampMax_EfficientBase": 500, + "UclampMax_EfficientOffset": 200, "SamplingWindow_P": 1, "SamplingWindow_I": 0, "SamplingWindow_D": 1, @@ -1965,6 +1967,8 @@ "UclampMin_Init": 162, "UclampMin_High": 480, "UclampMin_Low": 2, + "UclampMax_EfficientBase": 500, + "UclampMax_EfficientOffset": 200, "SamplingWindow_P": 1, "SamplingWindow_I": 0, "SamplingWindow_D": 1, @@ -1989,6 +1993,8 @@ "UclampMin_Init": 162, "UclampMin_High": 480, "UclampMin_Low": 2, + "UclampMax_EfficientBase": 500, + "UclampMax_EfficientOffset": 200, "SamplingWindow_P": 1, "SamplingWindow_I": 0, "SamplingWindow_D": 1, @@ -2016,6 +2022,8 @@ "UclampMin_Init": 250, "UclampMin_High": 197, "UclampMin_Low": 197, + "UclampMax_EfficientBase": 500, + "UclampMax_EfficientOffset": 200, "ReportingRateLimitNs": 1, "EarlyBoost_On": false, "EarlyBoost_TimeFactor": 0.0, @@ -2040,6 +2048,8 @@ "UclampMin_Init": 250, "UclampMin_High": 53, "UclampMin_Low": 53, + "UclampMax_EfficientBase": 500, + "UclampMax_EfficientOffset": 200, "ReportingRateLimitNs": 1, "EarlyBoost_On": false, "EarlyBoost_TimeFactor": 0.0, @@ -2064,6 +2074,8 @@ "UclampMin_Init": 250, "UclampMin_High": 0, "UclampMin_Low": 0, + "UclampMax_EfficientBase": 500, + "UclampMax_EfficientOffset": 200, "ReportingRateLimitNs": 1, "EarlyBoost_On": false, "EarlyBoost_TimeFactor": 0.0, From e30274d4c9f0f7138a665f3092c99fb767607c95 Mon Sep 17 00:00:00 2001 From: Ankur Bakshi Date: Thu, 15 Feb 2024 02:05:19 +0000 Subject: [PATCH 02/44] Update felix SVN to 44 Bug: 325156176 Change-Id: Id9052a3303fc7c2c1842f3db9b52a2adf1ba164e --- device-felix.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device-felix.mk b/device-felix.mk index 7929017..efea0ce 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -220,7 +220,7 @@ PRODUCT_SOONG_NAMESPACES += \ # Increment the SVN for any official public releases PRODUCT_VENDOR_PROPERTIES += \ - ro.vendor.build.svn=43 + ro.vendor.build.svn=44 # Vibrator HAL PRODUCT_VENDOR_PROPERTIES +=\ From abe266909ec13012f3c6be68f208496826287d08 Mon Sep 17 00:00:00 2001 From: Barry Date: Tue, 5 Mar 2024 09:13:08 +0000 Subject: [PATCH 03/44] BT: set system property for Bluetooth Auto On Set bluetooth.server.automatic_turn_on true for Bluetooth Auto On feature. The feature will be enabled with both system property and flag set. Bug: 328168526 Test: check system property value Change-Id: I9a48c7dd041dc87dae8f1659b3a782b71cb67ccb --- device-felix.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/device-felix.mk b/device-felix.mk index ad942d6..d3969fc 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -146,6 +146,10 @@ PRODUCT_PROPERTY_OVERRIDES += \ persist.bluetooth.a2dp_offload.disabled=false \ persist.bluetooth.a2dp_offload.cap=sbc-aac-aptx-aptxhd-ldac-opus +# Enable Bluetooth AutoOn feature +PRODUCT_PRODUCT_PROPERTIES += \ + bluetooth.server.automatic_turn_on=true + # Bluetooth Tx power caps PRODUCT_COPY_FILES += \ device/google/felix/bluetooth/bluetooth_power_limits_felix_US.csv:$(TARGET_COPY_OUT_VENDOR)/etc/bluetooth_power_limits.csv \ From 85299be2adc9e3dec373dc48f321c4fa1930e260 Mon Sep 17 00:00:00 2001 From: Ravi Jain Date: Mon, 26 Feb 2024 08:42:35 +0000 Subject: [PATCH 04/44] cs40l26: Align Felix Hal with common HAL Pull DSPMemChunk related CLs from common HAL. ag/22087481, ag/22093662 Bug: 322648133 Test: idlcli compose commands Test: adb shell cmd vibrator_manager synced prebaked 1 Test: adb shell idlcli vibrator composePwle -b \ a 0.1 300.0 0.1 30.0 1000 \ a 0.1 30.0 0.1 300.0 500 Test: atest PtsVibratorHalTestSuite \ PtsHapticsTestCases \ VibratorHalCs40l26TestSuite \ VtsHalVibratorManagerTargetTest \ VtsHalVibratorTargetTest \ android.os.cts.VibratorTest \ android.os.cts.VibratorManagerTest \ android.os.cts.VibrationEffectTest \ android.os.cts.VibrationAttributesTest \ android.os.cts.CombinedVibrationTest Change-Id: I32258500ec02c2a8cbfc6d0b37aaea2c83c7c8b4 --- vibrator/cs40l26/Hardware.h | 6 +- vibrator/cs40l26/Vibrator.cpp | 462 ++++++++++++++++++--------------- vibrator/cs40l26/Vibrator.h | 8 +- vibrator/cs40l26/tests/mocks.h | 2 +- 4 files changed, 268 insertions(+), 210 deletions(-) diff --git a/vibrator/cs40l26/Hardware.h b/vibrator/cs40l26/Hardware.h index 22667c9..af8d120 100644 --- a/vibrator/cs40l26/Hardware.h +++ b/vibrator/cs40l26/Hardware.h @@ -184,7 +184,7 @@ class HwApi : public Vibrator::HwApi, private HwApiBase { *haptic_pcm = NULL; return false; } - bool uploadOwtEffect(int fd, uint8_t *owtData, uint32_t numBytes, struct ff_effect *effect, + bool uploadOwtEffect(int fd, const uint8_t *owtData, const uint32_t numBytes, struct ff_effect *effect, uint32_t *outEffectIndex, int *status) override { (*effect).u.periodic.custom_len = numBytes / sizeof(uint16_t); delete[] ((*effect).u.periodic.custom_data); @@ -225,6 +225,10 @@ class HwApi : public Vibrator::HwApi, private HwApiBase { ALOGE("Invalid waveform index for OWT erase: %d", effectIndex); return false; } + if (effect == nullptr || (*effect).empty()) { + ALOGE("Invalid argument effect"); + return false; + } // Turn off the waiting time for SVC init phase to complete since chip // should already under STOP state setMinOnOffInterval(0); diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp index bfb7cf1..2abe72e 100644 --- a/vibrator/cs40l26/Vibrator.cpp +++ b/vibrator/cs40l26/Vibrator.cpp @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #ifndef ARRAY_SIZE @@ -85,7 +87,7 @@ static constexpr uint8_t PWLE_AMP_REG_BIT = 0x2; static constexpr float PWLE_LEVEL_MIN = 0.0; static constexpr float PWLE_LEVEL_MAX = 1.0; -static constexpr float CS40L26_PWLE_LEVEL_MIX = -1.0; +static constexpr float CS40L26_PWLE_LEVEL_MIN = -1.0; static constexpr float CS40L26_PWLE_LEVEL_MAX = 0.9995118; static constexpr float PWLE_FREQUENCY_RESOLUTION_HZ = 1.00; static constexpr float PWLE_FREQUENCY_MIN_HZ = 1.00; @@ -157,79 +159,210 @@ enum vibe_state { VIBE_STATE_ASP, }; -static int min(int x, int y) { - return x < y ? x : y; -} +class DspMemChunk { + private: + std::unique_ptr head; + size_t bytes = 0; + uint8_t waveformType; + uint8_t *_current; + const uint8_t *_max; + uint32_t _cache = 0; + int _cachebits = 0; -static int floatToUint16(float input, uint16_t *output, float scale, float min, float max) { - if (input < min || input > max) - return -ERANGE; + bool isEnd() const { return _current == _max; } + int min(int x, int y) { return x < y ? x : y; } - *output = roundf(input * scale); - return 0; -} + int write(int nbits, uint32_t val) { + int nwrite, i; -struct dspmem_chunk { - uint8_t *head; - uint8_t *current; - uint8_t *max; - int bytes; + nwrite = min(24 - _cachebits, nbits); + _cache <<= nwrite; + _cache |= val >> (nbits - nwrite); + _cachebits += nwrite; + nbits -= nwrite; - uint32_t cache; - int cachebits; -}; + if (_cachebits == 24) { + if (isEnd()) + return -ENOSPC; -static dspmem_chunk *dspmem_chunk_create(void *data, int size) { - auto ch = new dspmem_chunk{ - .head = reinterpret_cast(data), - .current = reinterpret_cast(data), - .max = reinterpret_cast(data) + size, - }; + _cache &= 0xFFFFFF; + for (i = 0; i < sizeof(_cache); i++, _cache <<= 8) + *_current++ = (_cache & 0xFF000000) >> 24; - return ch; -} + bytes += sizeof(_cache); + _cachebits = 0; + } -static bool dspmem_chunk_end(struct dspmem_chunk *ch) { - return ch->current == ch->max; -} + if (nbits) + return write(nbits, val); -static int dspmem_chunk_bytes(struct dspmem_chunk *ch) { - return ch->bytes; -} - -static int dspmem_chunk_write(struct dspmem_chunk *ch, int nbits, uint32_t val) { - int nwrite, i; - - nwrite = min(24 - ch->cachebits, nbits); - ch->cache <<= nwrite; - ch->cache |= val >> (nbits - nwrite); - ch->cachebits += nwrite; - nbits -= nwrite; - - if (ch->cachebits == 24) { - if (dspmem_chunk_end(ch)) - return -ENOSPC; - - ch->cache &= 0xFFFFFF; - for (i = 0; i < sizeof(ch->cache); i++, ch->cache <<= 8) - *ch->current++ = (ch->cache & 0xFF000000) >> 24; - - ch->bytes += sizeof(ch->cache); - ch->cachebits = 0; + return 0; } - if (nbits) - return dspmem_chunk_write(ch, nbits, val); + int fToU16(float input, uint16_t *output, float scale, float min, float max) { + if (input < min || input > max) + return -ERANGE; - return 0; -} - -static int dspmem_chunk_flush(struct dspmem_chunk *ch) { - if (!ch->cachebits) + *output = roundf(input * scale); return 0; + } - return dspmem_chunk_write(ch, 24 - ch->cachebits, 0); -} + void constructPwleSegment(uint16_t delay, uint16_t amplitude, uint16_t frequency, uint8_t flags, + uint32_t vbemfTarget = 0) { + write(16, delay); + write(12, amplitude); + write(12, frequency); + /* feature flags to control the chirp, CLAB braking, back EMF amplitude regulation */ + write(8, (flags | 1) << 4); + if (flags & PWLE_AMP_REG_BIT) { + write(24, vbemfTarget); /* target back EMF voltage */ + } + } + + public: + uint8_t *front() const { return head.get(); } + uint8_t type() const { return waveformType; } + size_t size() const { return bytes; } + + DspMemChunk(uint8_t type, size_t size) : head(new uint8_t[size]{0x00}) { + waveformType = type; + _current = head.get(); + _max = _current + size; + + if (waveformType == WAVEFORM_COMPOSE) { + write(8, 0); /* Padding */ + write(8, 0); /* nsections placeholder */ + write(8, 0); /* repeat */ + } else if (waveformType == WAVEFORM_PWLE) { + write(24, 0); /* Waveform length placeholder */ + write(8, 0); /* Repeat */ + write(12, 0); /* Wait time between repeats */ + write(8, 0); /* nsections placeholder */ + } else { + ALOGE("%s: Invalid type: %u", __func__, waveformType); + } + } + + int flush() { + if (!_cachebits) + return 0; + + return write(24 - _cachebits, 0); + } + + int constructComposeSegment(uint32_t effectVolLevel, uint32_t effectIndex, uint8_t repeat, + uint8_t flags, uint16_t nextEffectDelay) { + if (waveformType != WAVEFORM_COMPOSE) { + ALOGE("%s: Invalid type: %d", __func__, waveformType); + return -EDOM; + } + if (effectVolLevel > 100 || effectIndex > WAVEFORM_MAX_PHYSICAL_INDEX) { + ALOGE("%s: Invalid argument: %u, %u", __func__, effectVolLevel, effectIndex); + return -EINVAL; + } + write(8, effectVolLevel); /* amplitude */ + write(8, effectIndex); /* index */ + write(8, repeat); /* repeat */ + write(8, flags); /* flags */ + write(16, nextEffectDelay); /* delay */ + return 0; + } + + int constructActiveSegment(int duration, float amplitude, float frequency, bool chirp) { + uint16_t delay = 0; + uint16_t amp = 0; + uint16_t freq = 0; + uint8_t flags = 0x0; + if (waveformType != WAVEFORM_PWLE) { + ALOGE("%s: Invalid type: %d", __func__, waveformType); + return -EDOM; + } + if ((fToU16(duration, &delay, 4, 0.0f, COMPOSE_PWLE_PRIMITIVE_DURATION_MAX_MS) < 0) || + (fToU16(amplitude, &, 2048, CS40L26_PWLE_LEVEL_MIN, CS40L26_PWLE_LEVEL_MAX) < 0) || + (fToU16(frequency, &freq, 4, PWLE_FREQUENCY_MIN_HZ, PWLE_FREQUENCY_MAX_HZ) < 0)) { + ALOGE("%s: Invalid argument: %d, %f, %f", __func__, duration, amplitude, frequency); + return -ERANGE; + } + if (chirp) { + flags |= PWLE_CHIRP_BIT; + } + constructPwleSegment(delay, amp, freq, flags, 0 /*ignored*/); + return 0; + } + + int constructBrakingSegment(int duration, Braking brakingType) { + uint16_t delay = 0; + uint16_t freq = 0; + uint8_t flags = 0x00; + if (waveformType != WAVEFORM_PWLE) { + ALOGE("%s: Invalid type: %d", __func__, waveformType); + return -EDOM; + } + if (fToU16(duration, &delay, 4, 0.0f, COMPOSE_PWLE_PRIMITIVE_DURATION_MAX_MS) < 0) { + ALOGE("%s: Invalid argument: %d", __func__, duration); + return -ERANGE; + } + fToU16(PWLE_FREQUENCY_MIN_HZ, &freq, 4, PWLE_FREQUENCY_MIN_HZ, PWLE_FREQUENCY_MAX_HZ); + if (static_cast::type>(brakingType)) { + flags |= PWLE_BRAKE_BIT; + } + + constructPwleSegment(delay, 0 /*ignored*/, freq, flags, 0 /*ignored*/); + return 0; + } + + int updateWLength(uint32_t totalDuration) { + uint8_t *f = front(); + if (f == nullptr) { + ALOGE("%s: head does not exist!", __func__); + return -ENOMEM; + } + if (waveformType != WAVEFORM_PWLE) { + ALOGE("%s: Invalid type: %d", __func__, waveformType); + return -EDOM; + } + if (totalDuration > 0x7FFFF) { + ALOGE("%s: Invalid argument: %u", __func__, totalDuration); + return -EINVAL; + } + totalDuration *= 8; /* Unit: 0.125 ms (since wlength played @ 8kHz). */ + totalDuration |= + WT_LEN_CALCD; /* Bit 23 is for WT_LEN_CALCD; Bit 22 is for WT_INDEFINITE. */ + *(f + 0) = (totalDuration >> 24) & 0xFF; + *(f + 1) = (totalDuration >> 16) & 0xFF; + *(f + 2) = (totalDuration >> 8) & 0xFF; + *(f + 3) = totalDuration & 0xFF; + return 0; + } + + int updateNSection(int segmentIdx) { + uint8_t *f = front(); + if (f == nullptr) { + ALOGE("%s: head does not exist!", __func__); + return -ENOMEM; + } + + if (waveformType == WAVEFORM_COMPOSE) { + if (segmentIdx > COMPOSE_SIZE_MAX + 1 /*1st effect may have a delay*/) { + ALOGE("%s: Invalid argument: %d", __func__, segmentIdx); + return -EINVAL; + } + *(f + 2) = (0xFF & segmentIdx); + } else if (waveformType == WAVEFORM_PWLE) { + if (segmentIdx > COMPOSE_PWLE_SIZE_MAX_DEFAULT) { + ALOGE("%s: Invalid argument: %d", __func__, segmentIdx); + return -EINVAL; + } + *(f + 7) |= (0xF0 & segmentIdx) >> 4; /* Bit 4 to 7 */ + *(f + 9) |= (0x0F & segmentIdx) << 4; /* Bit 3 to 0 */ + } else { + ALOGE("%s: Invalid type: %d", __func__, waveformType); + return -EDOM; + } + + return 0; + } +}; Vibrator::Vibrator(std::unique_ptr hwApiDefault, std::unique_ptr hwCalDefault, std::unique_ptr hwApiDual, std::unique_ptr hwCalDual, @@ -718,9 +851,6 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector &composi uint16_t nextEffectDelay; uint16_t totalDuration = 0; - auto ch = dspmem_chunk_create(new uint8_t[FF_CUSTOM_DATA_LEN_MAX_COMP]{0x00}, - FF_CUSTOM_DATA_LEN_MAX_COMP); - if (composite.size() > COMPOSE_SIZE_MAX || composite.empty()) { return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } @@ -736,15 +866,13 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector &composi size = composite.size(); } - dspmem_chunk_write(ch, 8, 0); /* Padding */ - dspmem_chunk_write(ch, 8, (uint8_t)(0xFF & size)); /* nsections */ - dspmem_chunk_write(ch, 8, 0); /* repeat */ - uint8_t header_count = dspmem_chunk_bytes(ch); + DspMemChunk ch(WAVEFORM_COMPOSE, FF_CUSTOM_DATA_LEN_MAX_COMP); + const uint8_t header_count = ch.size(); /* Insert 1 section for a wait before the first effect. */ if (nextEffectDelay) { - dspmem_chunk_write(ch, 32, 0); /* amplitude, index, repeat & flags */ - dspmem_chunk_write(ch, 16, (uint16_t)(0xFFFF & nextEffectDelay)); /* delay */ + ch.constructComposeSegment(0 /*amplitude*/, 0 /*index*/, 0 /*repeat*/, 0 /*flags*/, + nextEffectDelay /*delay*/); } for (uint32_t i_curr = 0, i_next = 1; i_curr < composite.size(); i_curr++, i_next++) { @@ -791,14 +919,16 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector &composi return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } - dspmem_chunk_write(ch, 8, (uint8_t)(0xFF & effectVolLevel)); /* amplitude */ - dspmem_chunk_write(ch, 8, (uint8_t)(0xFF & effectIndex)); /* index */ - dspmem_chunk_write(ch, 8, 0); /* repeat */ - dspmem_chunk_write(ch, 8, 0); /* flags */ - dspmem_chunk_write(ch, 16, (uint16_t)(0xFFFF & nextEffectDelay)); /* delay */ + ch.constructComposeSegment(effectVolLevel, effectIndex, 0 /*repeat*/, 0 /*flags*/, + nextEffectDelay /*delay*/); } - dspmem_chunk_flush(ch); - if (header_count == dspmem_chunk_bytes(ch)) { + + ch.flush(); + if (ch.updateNSection(size) < 0) { + ALOGE("%s: Failed to update the section count", __func__); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (header_count == ch.size()) { return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } else { // Composition duration should be 0 to allow firmware to play the whole effect @@ -806,12 +936,12 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector &composi if (mIsDual) { mFfEffectsDual[WAVEFORM_COMPOSE].replay.length = 0; } - return performEffect(WAVEFORM_MAX_INDEX /*ignored*/, VOLTAGE_SCALE_MAX /*ignored*/, ch, + return performEffect(WAVEFORM_MAX_INDEX /*ignored*/, VOLTAGE_SCALE_MAX /*ignored*/, &ch, callback); } } -ndk::ScopedAStatus Vibrator::on(uint32_t timeoutMs, uint32_t effectIndex, dspmem_chunk *ch, +ndk::ScopedAStatus Vibrator::on(uint32_t timeoutMs, uint32_t effectIndex, const DspMemChunk *ch, const std::shared_ptr &callback) { ndk::ScopedAStatus status = ndk::ScopedAStatus::ok(); @@ -826,28 +956,28 @@ ndk::ScopedAStatus Vibrator::on(uint32_t timeoutMs, uint32_t effectIndex, dspmem if (ch) { /* Upload OWT effect. */ - if (ch->head == nullptr) { + if (ch->front() == nullptr) { ALOGE("Invalid OWT bank"); - delete ch; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } - bool isPwle = (*reinterpret_cast(ch->head) != 0x0000); - effectIndex = isPwle ? WAVEFORM_PWLE : WAVEFORM_COMPOSE; + + if (ch->type() != WAVEFORM_PWLE && ch->type() != WAVEFORM_COMPOSE) { + ALOGE("Invalid OWT type"); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + effectIndex = ch->type(); uint32_t freeBytes; mHwApiDef->getOwtFreeSpace(&freeBytes); - if (dspmem_chunk_bytes(ch) > freeBytes) { - ALOGE("Invalid OWT length: Effect %d: %d > %d!", effectIndex, dspmem_chunk_bytes(ch), - freeBytes); - delete ch; + if (ch->size() > freeBytes) { + ALOGE("Invalid OWT length: Effect %d: %zu > %d!", effectIndex, ch->size(), freeBytes); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } if (mIsDual) { mHwApiDual->getOwtFreeSpace(&freeBytes); - if (dspmem_chunk_bytes(ch) > freeBytes) { + if (ch-> size() > freeBytes) { ALOGE("Invalid OWT length in flip: Effect %d: %d > %d!", effectIndex, - dspmem_chunk_bytes(ch), freeBytes); - delete ch; + ch-> size(), freeBytes); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } } @@ -860,20 +990,17 @@ ndk::ScopedAStatus Vibrator::on(uint32_t timeoutMs, uint32_t effectIndex, dspmem ALOGD("Not dual haptics HAL and GPIO status fail"); } - if (!mHwApiDef->uploadOwtEffect(mInputFd, ch->head, dspmem_chunk_bytes(ch), - &mFfEffects[effectIndex], &effectIndex, &errorStatus)) { - delete ch; + if (!mHwApiDef->uploadOwtEffect(mInputFd, ch->front(), ch->size(), &mFfEffects[effectIndex], + &effectIndex, &errorStatus)) { ALOGE("Invalid uploadOwtEffect"); return ndk::ScopedAStatus::fromExceptionCode(errorStatus); } - if (mIsDual && !mHwApiDual->uploadOwtEffect(mInputFdDual, ch->head, dspmem_chunk_bytes(ch), + if (mIsDual && !mHwApiDual->uploadOwtEffect(mInputFdDual, ch->front(), ch->size(), &mFfEffectsDual[effectIndex], &effectIndex, &errorStatus)) { - delete ch; ALOGE("Invalid uploadOwtEffect in flip"); return ndk::ScopedAStatus::fromExceptionCode(errorStatus); } - delete ch; } else if (effectIndex == WAVEFORM_SHORT_VIBRATION_EFFECT_INDEX || effectIndex == WAVEFORM_LONG_VIBRATION_EFFECT_INDEX) { @@ -1090,69 +1217,6 @@ static void incrementIndex(int *index) { *index += 1; } -static void constructPwleSegment(dspmem_chunk *ch, uint16_t delay, uint16_t amplitude, - uint16_t frequency, uint8_t flags, uint32_t vbemfTarget = 0) { - dspmem_chunk_write(ch, 16, delay); - dspmem_chunk_write(ch, 12, amplitude); - dspmem_chunk_write(ch, 12, frequency); - /* feature flags to control the chirp, CLAB braking, back EMF amplitude regulation */ - dspmem_chunk_write(ch, 8, (flags | 1) << 4); - if (flags & PWLE_AMP_REG_BIT) { - dspmem_chunk_write(ch, 24, vbemfTarget); /* target back EMF voltage */ - } -} - -static int constructActiveSegment(dspmem_chunk *ch, int duration, float amplitude, float frequency, - bool chirp) { - uint16_t delay = 0; - uint16_t amp = 0; - uint16_t freq = 0; - uint8_t flags = 0x0; - if ((floatToUint16(duration, &delay, 4, 0.0f, COMPOSE_PWLE_PRIMITIVE_DURATION_MAX_MS) < 0) || - (floatToUint16(amplitude, &, 2048, CS40L26_PWLE_LEVEL_MIX, CS40L26_PWLE_LEVEL_MAX) < - 0) || - (floatToUint16(frequency, &freq, 4, PWLE_FREQUENCY_MIN_HZ, PWLE_FREQUENCY_MAX_HZ) < 0)) { - ALOGE("Invalid argument: %d, %f, %f", duration, amplitude, frequency); - return -ERANGE; - } - if (chirp) { - flags |= PWLE_CHIRP_BIT; - } - constructPwleSegment(ch, delay, amp, freq, flags, 0 /*ignored*/); - return 0; -} - -static int constructBrakingSegment(dspmem_chunk *ch, int duration, Braking brakingType) { - uint16_t delay = 0; - uint16_t freq = 0; - uint8_t flags = 0x00; - if (floatToUint16(duration, &delay, 4, 0.0f, COMPOSE_PWLE_PRIMITIVE_DURATION_MAX_MS) < 0) { - ALOGE("Invalid argument: %d", duration); - return -ERANGE; - } - floatToUint16(PWLE_FREQUENCY_MIN_HZ, &freq, 4, PWLE_FREQUENCY_MIN_HZ, PWLE_FREQUENCY_MAX_HZ); - if (static_cast::type>(brakingType)) { - flags |= PWLE_BRAKE_BIT; - } - - constructPwleSegment(ch, delay, 0 /*ignored*/, freq, flags, 0 /*ignored*/); - return 0; -} - -static void updateWLength(dspmem_chunk *ch, uint32_t totalDuration) { - totalDuration *= 8; /* Unit: 0.125 ms (since wlength played @ 8kHz). */ - totalDuration |= WT_LEN_CALCD; /* Bit 23 is for WT_LEN_CALCD; Bit 22 is for WT_INDEFINITE. */ - *(ch->head + 0) = (totalDuration >> 24) & 0xFF; - *(ch->head + 1) = (totalDuration >> 16) & 0xFF; - *(ch->head + 2) = (totalDuration >> 8) & 0xFF; - *(ch->head + 3) = totalDuration & 0xFF; -} - -static void updateNSection(dspmem_chunk *ch, int segmentIdx) { - *(ch->head + 7) |= (0xF0 & segmentIdx) >> 4; /* Bit 4 to 7 */ - *(ch->head + 9) |= (0x0F & segmentIdx) << 4; /* Bit 3 to 0 */ -} - ndk::ScopedAStatus Vibrator::composePwle(const std::vector &composite, const std::shared_ptr &callback) { ATRACE_NAME("Vibrator::composePwle"); @@ -1177,15 +1241,9 @@ ndk::ScopedAStatus Vibrator::composePwle(const std::vector &compo float prevEndAmplitude; float prevEndFrequency; resetPreviousEndAmplitudeEndFrequency(&prevEndAmplitude, &prevEndFrequency); - auto ch = dspmem_chunk_create(new uint8_t[FF_CUSTOM_DATA_LEN_MAX_PWLE]{0x00}, - FF_CUSTOM_DATA_LEN_MAX_PWLE); + DspMemChunk ch(WAVEFORM_PWLE, FF_CUSTOM_DATA_LEN_MAX_PWLE); bool chirp = false; - dspmem_chunk_write(ch, 24, 0x000000); /* Waveform length placeholder */ - dspmem_chunk_write(ch, 8, 0); /* Repeat */ - dspmem_chunk_write(ch, 12, 0); /* Wait time between repeats */ - dspmem_chunk_write(ch, 8, 0x00); /* nsections placeholder */ - for (auto &e : composite) { switch (e.getTag()) { case PrimitivePwle::active: { @@ -1215,8 +1273,8 @@ ndk::ScopedAStatus Vibrator::composePwle(const std::vector &compo if (!((active.startAmplitude == prevEndAmplitude) && (active.startFrequency == prevEndFrequency))) { - if (constructActiveSegment(ch, 0, active.startAmplitude, active.startFrequency, - false) < 0) { + if (ch.constructActiveSegment(0, active.startAmplitude, active.startFrequency, + false) < 0) { return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } incrementIndex(&segmentIdx); @@ -1225,8 +1283,8 @@ ndk::ScopedAStatus Vibrator::composePwle(const std::vector &compo if (active.startFrequency != active.endFrequency) { chirp = true; } - if (constructActiveSegment(ch, active.duration, active.endAmplitude, - active.endFrequency, chirp) < 0) { + if (ch.constructActiveSegment(active.duration, active.endAmplitude, + active.endFrequency, chirp) < 0) { return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } incrementIndex(&segmentIdx); @@ -1249,12 +1307,12 @@ ndk::ScopedAStatus Vibrator::composePwle(const std::vector &compo return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } - if (constructBrakingSegment(ch, 0, braking.braking) < 0) { + if (ch.constructBrakingSegment(0, braking.braking) < 0) { return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } incrementIndex(&segmentIdx); - if (constructBrakingSegment(ch, braking.duration, braking.braking) < 0) { + if (ch.constructBrakingSegment(braking.duration, braking.braking) < 0) { return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } incrementIndex(&segmentIdx); @@ -1270,7 +1328,7 @@ ndk::ScopedAStatus Vibrator::composePwle(const std::vector &compo return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } } - dspmem_chunk_flush(ch); + ch.flush(); /* Update wlength */ totalDuration += MAX_COLD_START_LATENCY_MS; @@ -1278,12 +1336,19 @@ ndk::ScopedAStatus Vibrator::composePwle(const std::vector &compo ALOGE("Total duration is too long (%d)!", totalDuration); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } - updateWLength(ch, totalDuration); + + if (ch.updateWLength(totalDuration) < 0) { + ALOGE("%s: Failed to update the waveform length length", __func__); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } /* Update nsections */ - updateNSection(ch, segmentIdx); + if (ch.updateNSection(segmentIdx) < 0) { + ALOGE("%s: Failed to update the section count", __func__); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } - return performEffect(WAVEFORM_MAX_INDEX /*ignored*/, VOLTAGE_SCALE_MAX /*ignored*/, ch, + return performEffect(WAVEFORM_MAX_INDEX /*ignored*/, VOLTAGE_SCALE_MAX /*ignored*/, &ch, callback); } @@ -1460,7 +1525,7 @@ ndk::ScopedAStatus Vibrator::getSimpleDetails(Effect effect, EffectStrength stre } ndk::ScopedAStatus Vibrator::getCompoundDetails(Effect effect, EffectStrength strength, - uint32_t *outTimeMs, dspmem_chunk *outCh) { + uint32_t *outTimeMs, DspMemChunk *outCh) { ndk::ScopedAStatus status; uint32_t timeMs = 0; uint32_t thisEffectIndex; @@ -1468,23 +1533,14 @@ ndk::ScopedAStatus Vibrator::getCompoundDetails(Effect effect, EffectStrength st uint32_t thisVolLevel; switch (effect) { case Effect::DOUBLE_CLICK: - dspmem_chunk_write(outCh, 8, 0); /* Padding */ - dspmem_chunk_write(outCh, 8, 2); /* nsections */ - dspmem_chunk_write(outCh, 8, 0); /* repeat */ - status = getSimpleDetails(Effect::CLICK, strength, &thisEffectIndex, &thisTimeMs, &thisVolLevel); if (!status.isOk()) { return status; } timeMs += thisTimeMs; - - dspmem_chunk_write(outCh, 8, (uint8_t)(0xFF & thisVolLevel)); /* amplitude */ - dspmem_chunk_write(outCh, 8, (uint8_t)(0xFF & thisEffectIndex)); /* index */ - dspmem_chunk_write(outCh, 8, 0); /* repeat */ - dspmem_chunk_write(outCh, 8, 0); /* flags */ - dspmem_chunk_write(outCh, 16, - (uint16_t)(0xFFFF & WAVEFORM_DOUBLE_CLICK_SILENCE_MS)); /* delay */ + outCh->constructComposeSegment(thisVolLevel, thisEffectIndex, 0 /*repeat*/, 0 /*flags*/, + WAVEFORM_DOUBLE_CLICK_SILENCE_MS); timeMs += WAVEFORM_DOUBLE_CLICK_SILENCE_MS + MAX_PAUSE_TIMING_ERROR_MS; @@ -1495,12 +1551,13 @@ ndk::ScopedAStatus Vibrator::getCompoundDetails(Effect effect, EffectStrength st } timeMs += thisTimeMs; - dspmem_chunk_write(outCh, 8, (uint8_t)(0xFF & thisVolLevel)); /* amplitude */ - dspmem_chunk_write(outCh, 8, (uint8_t)(0xFF & thisEffectIndex)); /* index */ - dspmem_chunk_write(outCh, 8, 0); /* repeat */ - dspmem_chunk_write(outCh, 8, 0); /* flags */ - dspmem_chunk_write(outCh, 16, 0); /* delay */ - dspmem_chunk_flush(outCh); + outCh->constructComposeSegment(thisVolLevel, thisEffectIndex, 0 /*repeat*/, 0 /*flags*/, + 0 /*delay*/); + outCh->flush(); + if (outCh->updateNSection(2) < 0) { + ALOGE("%s: Failed to update the section count", __func__); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } break; default: @@ -1568,7 +1625,7 @@ ndk::ScopedAStatus Vibrator::performEffect(Effect effect, EffectStrength strengt uint32_t effectIndex; uint32_t timeMs = 0; uint32_t volLevel; - dspmem_chunk *ch = nullptr; + std::optional maybeCh; switch (effect) { case Effect::TEXTURE_TICK: // fall-through @@ -1580,28 +1637,25 @@ ndk::ScopedAStatus Vibrator::performEffect(Effect effect, EffectStrength strengt status = getSimpleDetails(effect, strength, &effectIndex, &timeMs, &volLevel); break; case Effect::DOUBLE_CLICK: - ch = dspmem_chunk_create(new uint8_t[FF_CUSTOM_DATA_LEN_MAX_COMP]{0x00}, - FF_CUSTOM_DATA_LEN_MAX_COMP); - status = getCompoundDetails(effect, strength, &timeMs, ch); + maybeCh.emplace(WAVEFORM_COMPOSE, FF_CUSTOM_DATA_LEN_MAX_COMP); + status = getCompoundDetails(effect, strength, &timeMs, &*maybeCh); volLevel = VOLTAGE_SCALE_MAX; break; default: status = ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); break; } - if (!status.isOk()) { - goto exit; + if (status.isOk()) { + DspMemChunk *ch = maybeCh ? &*maybeCh : nullptr; + status = performEffect(effectIndex, volLevel, ch, callback); } - status = performEffect(effectIndex, volLevel, ch, callback); - -exit: *outTimeMs = timeMs; return status; } ndk::ScopedAStatus Vibrator::performEffect(uint32_t effectIndex, uint32_t volLevel, - dspmem_chunk *ch, + const DspMemChunk *ch, const std::shared_ptr &callback) { setEffectAmplitude(volLevel, VOLTAGE_SCALE_MAX); diff --git a/vibrator/cs40l26/Vibrator.h b/vibrator/cs40l26/Vibrator.h index 5b1ff90..06bd6e5 100644 --- a/vibrator/cs40l26/Vibrator.h +++ b/vibrator/cs40l26/Vibrator.h @@ -89,7 +89,7 @@ class Vibrator : public BnVibrator { virtual bool setHapticPcmAmp(struct pcm **haptic_pcm, bool enable, int card, int device) = 0; // Set OWT waveform for compose or compose PWLE request - virtual bool uploadOwtEffect(int fd, uint8_t *owtData, uint32_t numBytes, + virtual bool uploadOwtEffect(int fd, const uint8_t *owtData, const uint32_t numBytes, struct ff_effect *effect, uint32_t *outEffectIndex, int *status) = 0; // Erase OWT waveform @@ -178,7 +178,7 @@ class Vibrator : public BnVibrator { static constexpr uint32_t MIN_ON_OFF_INTERVAL_US = 8500; // SVC initialization time private: - ndk::ScopedAStatus on(uint32_t timeoutMs, uint32_t effectIndex, struct dspmem_chunk *ch, + ndk::ScopedAStatus on(uint32_t timeoutMs, uint32_t effectIndex, const class DspMemChunk *ch, const std::shared_ptr &callback); // set 'amplitude' based on an arbitrary scale determined by 'maximum' ndk::ScopedAStatus setEffectAmplitude(float amplitude, float maximum); @@ -189,13 +189,13 @@ class Vibrator : public BnVibrator { uint32_t *outVolLevel); // 'compound' effects are those composed by stringing multiple 'simple' effects ndk::ScopedAStatus getCompoundDetails(Effect effect, EffectStrength strength, - uint32_t *outTimeMs, struct dspmem_chunk *outCh); + uint32_t *outTimeMs, class DspMemChunk *outCh); ndk::ScopedAStatus getPrimitiveDetails(CompositePrimitive primitive, uint32_t *outEffectIndex); ndk::ScopedAStatus performEffect(Effect effect, EffectStrength strength, const std::shared_ptr &callback, int32_t *outTimeMs); ndk::ScopedAStatus performEffect(uint32_t effectIndex, uint32_t volLevel, - struct dspmem_chunk *ch, + const class DspMemChunk *ch, const std::shared_ptr &callback); ndk::ScopedAStatus setPwle(const std::string &pwleQueue); bool isUnderExternalControl(); diff --git a/vibrator/cs40l26/tests/mocks.h b/vibrator/cs40l26/tests/mocks.h index c85b0b5..641aba8 100644 --- a/vibrator/cs40l26/tests/mocks.h +++ b/vibrator/cs40l26/tests/mocks.h @@ -51,7 +51,7 @@ class MockApi : public ::aidl::android::hardware::vibrator::Vibrator::HwApi { MOCK_METHOD2(getHapticAlsaDevice, bool(int *card, int *device)); MOCK_METHOD4(setHapticPcmAmp, bool(struct pcm **haptic_pcm, bool enable, int card, int device)); MOCK_METHOD6(uploadOwtEffect, - bool(int fd, uint8_t *owtData, uint32_t numBytes, struct ff_effect *effect, + bool(int fd, const uint8_t *owtData, const uint32_t numBytes, struct ff_effect *effect, uint32_t *outEffectIndex, int *status)); MOCK_METHOD3(eraseOwtEffect, bool(int fd, int8_t effectIndex, std::vector *effect)); MOCK_METHOD1(debug, void(int fd)); From abb540718bb58da443eb970b65e63de85704eef1 Mon Sep 17 00:00:00 2001 From: Ankur Bakshi Date: Thu, 15 Feb 2024 02:08:07 +0000 Subject: [PATCH 05/44] Update felix SVN to 45 Bug: 325156176 Change-Id: I5ebc65fcd00c7d5c593f8a56c8ccdfd424551005 --- device-felix.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device-felix.mk b/device-felix.mk index d09faf6..05f3fa8 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -224,7 +224,7 @@ PRODUCT_SOONG_NAMESPACES += \ # Increment the SVN for any official public releases PRODUCT_VENDOR_PROPERTIES += \ - ro.vendor.build.svn=44 + ro.vendor.build.svn=45 # Vibrator HAL PRODUCT_VENDOR_PROPERTIES +=\ From 9e9a886bbbfe15203cd6274838796469192d9fda Mon Sep 17 00:00:00 2001 From: Sam Paradis Date: Thu, 1 Feb 2024 00:57:26 +0000 Subject: [PATCH 06/44] Change FACE_UNLOCK_BOOST to Maximize CPU Frequency This is part of an optimization that limits the length and prevelance of this power hint. Strict, ultra-agression minimizes power and latency versus always-on mid aggression. Bug: 297964952 Change-Id: I6d6f3b6c8990bbe3c04575a60797a2aefa898172 --- powerhint.json | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/powerhint.json b/powerhint.json index 20cd066..34dcaed 100644 --- a/powerhint.json +++ b/powerhint.json @@ -2112,25 +2112,19 @@ { "PowerHint": "FACE_UNLOCK_BOOST", "Node": "CPUBigClusterMaxFreq", - "Duration": 1000, + "Duration": 500, "Value": "9999999" }, { "PowerHint": "FACE_UNLOCK_BOOST", - "Node": "CPU_LITTLE_TSKIN_BYPASS", - "Duration": 1000, - "Value": "1" - }, - { - "PowerHint": "FACE_UNLOCK_BOOST", - "Node": "CPU_MID_TSKIN_BYPASS", - "Duration": 1000, - "Value": "1" + "Node": "CPUBigClusterMinFreq", + "Duration": 500, + "Value": "1826000" }, { "PowerHint": "FACE_UNLOCK_BOOST", "Node": "CPU_BIG_TSKIN_BYPASS", - "Duration": 1000, + "Duration": 500, "Value": "1" }, { From 31bee4ad9db2f0931435f1a4e4662d940a0d2404 Mon Sep 17 00:00:00 2001 From: Melvin Huang Date: Tue, 12 Mar 2024 13:33:09 +0800 Subject: [PATCH 07/44] F10: Update BQR Event Mask property value Bug: 327514325 Test: Build Pass Change-Id: I9f0a3e27099eab86bf39733bf2f137418cde9156 --- bluetooth/bt_vendor_overlay.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bluetooth/bt_vendor_overlay.conf b/bluetooth/bt_vendor_overlay.conf index 5685ae7..b7b419b 100644 --- a/bluetooth/bt_vendor_overlay.conf +++ b/bluetooth/bt_vendor_overlay.conf @@ -3,4 +3,7 @@ # Uart port name UartPort = /dev/ttySAC18 +# Update BQR Event Mask property value +BqrEventMaskValueUpdate = 262238 + BtOpusEnabled = true From 011bda50b8542eb48cad8707ff0bbd45ed4b91f5 Mon Sep 17 00:00:00 2001 From: Sam Paradis Date: Thu, 1 Feb 2024 00:57:26 +0000 Subject: [PATCH 08/44] Change FACE_UNLOCK_BOOST to Maximize CPU Frequency This is part of an optimization that limits the length and prevelance of this power hint. Strict, ultra-agression minimizes power and latency versus always-on mid aggression. Bug: 297964952 Change-Id: I6d6f3b6c8990bbe3c04575a60797a2aefa898172 --- powerhint.json | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/powerhint.json b/powerhint.json index 20cd066..34dcaed 100644 --- a/powerhint.json +++ b/powerhint.json @@ -2112,25 +2112,19 @@ { "PowerHint": "FACE_UNLOCK_BOOST", "Node": "CPUBigClusterMaxFreq", - "Duration": 1000, + "Duration": 500, "Value": "9999999" }, { "PowerHint": "FACE_UNLOCK_BOOST", - "Node": "CPU_LITTLE_TSKIN_BYPASS", - "Duration": 1000, - "Value": "1" - }, - { - "PowerHint": "FACE_UNLOCK_BOOST", - "Node": "CPU_MID_TSKIN_BYPASS", - "Duration": 1000, - "Value": "1" + "Node": "CPUBigClusterMinFreq", + "Duration": 500, + "Value": "1826000" }, { "PowerHint": "FACE_UNLOCK_BOOST", "Node": "CPU_BIG_TSKIN_BYPASS", - "Duration": 1000, + "Duration": 500, "Value": "1" }, { From bc701d8d613ee962e0a2702a527dd5955e8e38eb Mon Sep 17 00:00:00 2001 From: Ankur Bakshi Date: Thu, 15 Feb 2024 02:09:11 +0000 Subject: [PATCH 09/44] Update felix SVN to 46 Bug: 325156176 Change-Id: I84212cd2b6e36d162d6f6624a21f393e0ec0d070 --- device-felix.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device-felix.mk b/device-felix.mk index 05f3fa8..a3c4935 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -224,7 +224,7 @@ PRODUCT_SOONG_NAMESPACES += \ # Increment the SVN for any official public releases PRODUCT_VENDOR_PROPERTIES += \ - ro.vendor.build.svn=45 + ro.vendor.build.svn=46 # Vibrator HAL PRODUCT_VENDOR_PROPERTIES +=\ From eda8074af288751f494dd9c47498f2fcdd8a5e79 Mon Sep 17 00:00:00 2001 From: Nina Chen Date: Fri, 8 Mar 2024 19:59:39 +0800 Subject: [PATCH 10/44] Change the rule to specify kernel directory with release configurations Bug: 326879772 Change-Id: I6e93b76380f4a71b28009319d914f325d04d8796 Signed-off-by: Nina Chen --- device-felix.mk | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/device-felix.mk b/device-felix.mk index d09faf6..b1e603c 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -17,8 +17,6 @@ # Restrict the visibility of Android.bp files to improve build analysis time $(call inherit-product-if-exists, vendor/google/products/sources_pixel.mk) -TARGET_KERNEL_DIR ?= device/google/felix-kernel -TARGET_BOARD_KERNEL_HEADERS := device/google/felix-kernel/kernel-headers TARGET_RECOVERY_DEFAULT_ROTATION := ROTATION_RIGHT ifdef RELEASE_GOOGLE_FELIX_KERNEL_VERSION @@ -26,8 +24,12 @@ TARGET_LINUX_KERNEL_VERSION := $(RELEASE_GOOGLE_FELIX_KERNEL_VERSION) endif ifdef RELEASE_GOOGLE_FELIX_KERNEL_DIR -TARGET_KERNEL_DIR := $(RELEASE_GOOGLE_FELIX_KERNEL_DIR) -TARGET_BOARD_KERNEL_HEADERS := $(RELEASE_GOOGLE_FELIX_KERNEL_DIR)/kernel-headers +# Keeps flexibility for kasan and ufs builds +TARGET_KERNEL_DIR ?= $(RELEASE_GOOGLE_FELIX_KERNEL_DIR) +TARGET_BOARD_KERNEL_HEADERS ?= $(RELEASE_GOOGLE_FELIX_KERNEL_DIR)/kernel-headers +else +TARGET_KERNEL_DIR ?= device/google/felix-kernel +TARGET_BOARD_KERNEL_HEADERS ?= device/google/felix-kernel/kernel-headers endif $(call inherit-product-if-exists, vendor/google_devices/felix/prebuilts/device-vendor-felix.mk) From 0771df9996399b0dedc54365019ee465293cf386 Mon Sep 17 00:00:00 2001 From: Ankur Bakshi Date: Wed, 6 Mar 2024 00:28:13 +0000 Subject: [PATCH 11/44] Update felix SVN to 47 Bug: 325156176 Change-Id: I80ca14c7073707ef69dd3feef8f7731afbe09582 --- device-felix.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device-felix.mk b/device-felix.mk index a3c4935..b568e6a 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -224,7 +224,7 @@ PRODUCT_SOONG_NAMESPACES += \ # Increment the SVN for any official public releases PRODUCT_VENDOR_PROPERTIES += \ - ro.vendor.build.svn=46 + ro.vendor.build.svn=47 # Vibrator HAL PRODUCT_VENDOR_PROPERTIES +=\ From 10a4784c6bb9897ac1295bab2a0744f5a2483e8d Mon Sep 17 00:00:00 2001 From: Cyan_Hsieh Date: Thu, 21 Mar 2024 18:24:36 +0800 Subject: [PATCH 12/44] Branch bootloader prebuilts for 24Q3 release Bug: 326002225 Change-Id: I692d1ffbd7f3ae425a84fce55c4bc537f0e2c4d8 --- device-felix.mk | 4 +++- felix/BoardConfig.mk | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/device-felix.mk b/device-felix.mk index 09e147f..c868b1f 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -272,8 +272,10 @@ PRODUCT_PACKAGES += \ PRODUCT_SOONG_NAMESPACES += vendor/google_devices/felix/prebuilts ifneq (,$(filter AP1%,$(RELEASE_PLATFORM_VERSION))) PRODUCT_SOONG_NAMESPACES += vendor/google_devices/felix/prebuilts/trusty/24Q1 -else ifneq (,$(filter AP2% AP3%,$(RELEASE_PLATFORM_VERSION))) +else ifneq (,$(filter AP2%,$(RELEASE_PLATFORM_VERSION))) PRODUCT_SOONG_NAMESPACES += vendor/google_devices/felix/prebuilts/trusty/24Q2 +else ifneq (,$(filter AP3%,$(RELEASE_PLATFORM_VERSION))) +PRODUCT_SOONG_NAMESPACES += vendor/google_devices/felix/prebuilts/trusty/24Q3 else PRODUCT_SOONG_NAMESPACES += vendor/google_devices/felix/prebuilts/trusty/trunk endif diff --git a/felix/BoardConfig.mk b/felix/BoardConfig.mk index a1ed5db..9ca6580 100644 --- a/felix/BoardConfig.mk +++ b/felix/BoardConfig.mk @@ -23,8 +23,10 @@ BOARD_KERNEL_CMDLINE += swiotlb=noforce RELEASE_GOOGLE_PRODUCT_RADIO_DIR := $(RELEASE_GOOGLE_FELIX_RADIO_DIR) ifneq (,$(filter AP1%,$(RELEASE_PLATFORM_VERSION))) RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/24Q1 -else ifneq (,$(filter AP2% AP3%,$(RELEASE_PLATFORM_VERSION))) +else ifneq (,$(filter AP2%,$(RELEASE_PLATFORM_VERSION))) RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/24Q2 +else ifneq (,$(filter AP3%,$(RELEASE_PLATFORM_VERSION))) +RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/24Q3 else RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/trunk endif From 662666134fbc1977fb83a555ffaa5c7c816d62e0 Mon Sep 17 00:00:00 2001 From: Ankur Bakshi Date: Thu, 21 Mar 2024 21:45:27 +0000 Subject: [PATCH 13/44] Update felix SVN to 48 Bug: 325156176 Change-Id: Ifd4c3df67510d9f7cf5a88b9269614572b5eb0bc --- device-felix.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device-felix.mk b/device-felix.mk index b568e6a..e6266fe 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -224,7 +224,7 @@ PRODUCT_SOONG_NAMESPACES += \ # Increment the SVN for any official public releases PRODUCT_VENDOR_PROPERTIES += \ - ro.vendor.build.svn=47 + ro.vendor.build.svn=48 # Vibrator HAL PRODUCT_VENDOR_PROPERTIES +=\ From 75d87040c7284b0d0ef2f20e5edd2e2d384d943c Mon Sep 17 00:00:00 2001 From: Ravi Jain Date: Thu, 21 Mar 2024 15:16:14 +0000 Subject: [PATCH 14/44] cs40l26: Align Felix Hal with common HAL Pull ag/22589260 to replace new/delete by using vector from the common HAL. Bug: 322648133 Test: idlcli compose commands Test: adb shell cmd vibrator_manager synced prebaked 1 Test: adb shell idlcli vibrator compose 0 8 1.0; \ sleep 1; adb shell idlcli vibrator compose 0 7 1.0; Test: atest PtsVibratorHalTestSuite \ PtsHapticsTestCases \ VibratorHalCs40l26TestSuitePrivate \ VtsHalVibratorManagerTargetTest \ VtsHalVibratorTargetTest \ android.os.cts.VibratorTest \ android.os.cts.VibratorManagerTest \ android.os.cts.VibrationEffectTest \ android.os.cts.VibrationAttributesTest \ android.os.cts.CombinedVibrationTest Change-Id: Ia6e9111c47f27089521f05a68b538bbefb235d6b --- vibrator/cs40l26/Hardware.h | 25 +++++++++++++++++-------- vibrator/cs40l26/Vibrator.cpp | 28 +++++++++++++++++++++------- vibrator/cs40l26/Vibrator.h | 2 ++ 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/vibrator/cs40l26/Hardware.h b/vibrator/cs40l26/Hardware.h index af8d120..69cf9ae 100644 --- a/vibrator/cs40l26/Hardware.h +++ b/vibrator/cs40l26/Hardware.h @@ -104,18 +104,25 @@ class HwApi : public Vibrator::HwApi, private HwApiBase { .code = FF_GAIN, .value = value, }; + if (value > 100) { + ALOGE("Invalid gain"); + return false; + } if (write(fd, (const void *)&gain, sizeof(gain)) != sizeof(gain)) { return false; } return true; } bool setFFEffect(int fd, struct ff_effect *effect, uint16_t timeoutMs) override { + if (effect == nullptr) { + ALOGE("Invalid ff_effect"); + return false; + } if (ioctl(fd, EVIOCSFF, effect) < 0) { ALOGE("setFFEffect fail"); return false; - } else { - return true; } + return true; } bool setFFPlay(int fd, int8_t index, bool value) override { struct input_event play = { @@ -186,14 +193,17 @@ class HwApi : public Vibrator::HwApi, private HwApiBase { } bool uploadOwtEffect(int fd, const uint8_t *owtData, const uint32_t numBytes, struct ff_effect *effect, uint32_t *outEffectIndex, int *status) override { - (*effect).u.periodic.custom_len = numBytes / sizeof(uint16_t); - delete[] ((*effect).u.periodic.custom_data); - (*effect).u.periodic.custom_data = new int16_t[(*effect).u.periodic.custom_len]{0x0000}; - if ((*effect).u.periodic.custom_data == nullptr) { - ALOGE("Failed to allocate memory for custom data\n"); + if (owtData == nullptr || effect == nullptr || outEffectIndex == nullptr) { + ALOGE("Invalid argument owtData, ff_effect or outEffectIndex"); *status = EX_NULL_POINTER; return false; } + if (status == nullptr) { + ALOGE("Invalid argument status"); + return false; + } + + (*effect).u.periodic.custom_len = numBytes / sizeof(uint16_t); memcpy((*effect).u.periodic.custom_data, owtData, numBytes); if ((*effect).id != -1) { @@ -204,7 +214,6 @@ class HwApi : public Vibrator::HwApi, private HwApiBase { (*effect).id = -1; if (ioctl(fd, EVIOCSFF, effect) < 0) { ALOGE("Failed to upload effect %d (%d): %s", *outEffectIndex, errno, strerror(errno)); - delete[] ((*effect).u.periodic.custom_data); *status = EX_ILLEGAL_STATE; return false; } diff --git a/vibrator/cs40l26/Vibrator.cpp b/vibrator/cs40l26/Vibrator.cpp index 2abe72e..b3ce88e 100644 --- a/vibrator/cs40l26/Vibrator.cpp +++ b/vibrator/cs40l26/Vibrator.cpp @@ -44,7 +44,6 @@ namespace aidl { namespace android { namespace hardware { namespace vibrator { -static constexpr uint8_t FF_CUSTOM_DATA_LEN = 2; static constexpr uint16_t FF_CUSTOM_DATA_LEN_MAX_COMP = 2044; // (COMPOSE_SIZE_MAX + 1) * 8 + 4 static constexpr uint16_t FF_CUSTOM_DATA_LEN_MAX_PWLE = 2302; @@ -488,19 +487,23 @@ Vibrator::Vibrator(std::unique_ptr hwApiDefault, std::unique_ptr h mEffectDurations = { 1000, 100, 12, 1000, 300, 130, 150, 500, 100, 5, 12, 1000, 1000, 1000, }; /* 11+3 waveforms. The duration must < UINT16_MAX */ + mEffectCustomData.reserve(WAVEFORM_MAX_INDEX); uint8_t effectIndex; + uint16_t numBytes = 0; for (effectIndex = 0; effectIndex < WAVEFORM_MAX_INDEX; effectIndex++) { if (effectIndex < WAVEFORM_MAX_PHYSICAL_INDEX) { /* Initialize physical waveforms. */ + mEffectCustomData.push_back({RAM_WVFRM_BANK, effectIndex}); mFfEffects[effectIndex] = { .type = FF_PERIODIC, .id = -1, // Length == 0 to allow firmware control of the duration .replay.length = 0, .u.periodic.waveform = FF_CUSTOM, - .u.periodic.custom_data = new int16_t[2]{RAM_WVFRM_BANK, effectIndex}, - .u.periodic.custom_len = FF_CUSTOM_DATA_LEN, + .u.periodic.custom_data = mEffectCustomData[effectIndex].data(), + .u.periodic.custom_len = + static_cast(mEffectCustomData[effectIndex].size()), }; // Bypass the waveform update due to different input name if ((strstr(inputEventName, "cs40l26") != nullptr) || @@ -518,12 +521,16 @@ Vibrator::Vibrator(std::unique_ptr hwApiDefault, std::unique_ptr h } } else { /* Initiate placeholders for OWT effects. */ + numBytes = effectIndex == WAVEFORM_COMPOSE ? FF_CUSTOM_DATA_LEN_MAX_COMP + : FF_CUSTOM_DATA_LEN_MAX_PWLE; + std::vector tempVec(numBytes, 0); + mEffectCustomData.push_back(std::move(tempVec)); mFfEffects[effectIndex] = { .type = FF_PERIODIC, .id = -1, .replay.length = 0, .u.periodic.waveform = FF_CUSTOM, - .u.periodic.custom_data = nullptr, + .u.periodic.custom_data = mEffectCustomData[effectIndex].data(), .u.periodic.custom_len = 0, }; } @@ -532,18 +539,21 @@ Vibrator::Vibrator(std::unique_ptr hwApiDefault, std::unique_ptr h // ====================HAL internal effect table== Flip ================================== if (mIsDual) { mFfEffectsDual.resize(WAVEFORM_MAX_INDEX); + mEffectCustomDataDual.reserve(WAVEFORM_MAX_INDEX); for (effectIndex = 0; effectIndex < WAVEFORM_MAX_INDEX; effectIndex++) { if (effectIndex < WAVEFORM_MAX_PHYSICAL_INDEX) { /* Initialize physical waveforms. */ + mEffectCustomDataDual.push_back({RAM_WVFRM_BANK, effectIndex}); mFfEffectsDual[effectIndex] = { .type = FF_PERIODIC, .id = -1, // Length == 0 to allow firmware control of the duration .replay.length = 0, .u.periodic.waveform = FF_CUSTOM, - .u.periodic.custom_data = new int16_t[2]{RAM_WVFRM_BANK, effectIndex}, - .u.periodic.custom_len = FF_CUSTOM_DATA_LEN, + .u.periodic.custom_data = mEffectCustomDataDual[effectIndex].data(), + .u.periodic.custom_len = + static_cast(mEffectCustomDataDual[effectIndex].size()), }; // Bypass the waveform update due to different input name if ((strstr(inputEventName, "cs40l26") != nullptr) || @@ -563,12 +573,16 @@ Vibrator::Vibrator(std::unique_ptr hwApiDefault, std::unique_ptr h } } else { /* Initiate placeholders for OWT effects. */ + numBytes = effectIndex == WAVEFORM_COMPOSE ? FF_CUSTOM_DATA_LEN_MAX_COMP + : FF_CUSTOM_DATA_LEN_MAX_PWLE; + std::vector tempVec(numBytes, 0); + mEffectCustomDataDual.push_back(std::move(tempVec)); mFfEffectsDual[effectIndex] = { .type = FF_PERIODIC, .id = -1, .replay.length = 0, .u.periodic.waveform = FF_CUSTOM, - .u.periodic.custom_data = nullptr, + .u.periodic.custom_data = mEffectCustomDataDual[effectIndex].data(), .u.periodic.custom_len = 0, }; } diff --git a/vibrator/cs40l26/Vibrator.h b/vibrator/cs40l26/Vibrator.h index 06bd6e5..8f89713 100644 --- a/vibrator/cs40l26/Vibrator.h +++ b/vibrator/cs40l26/Vibrator.h @@ -218,6 +218,8 @@ class Vibrator : public BnVibrator { std::vector mFfEffects; std::vector mFfEffectsDual; std::vector mEffectDurations; + std::vector> mEffectCustomData; + std::vector> mEffectCustomDataDual; std::future mAsyncHandle; ::android::base::unique_fd mInputFd; ::android::base::unique_fd mInputFdDual; From 5f25b6c426cb1e968a530c973fa6ff3abe7635b8 Mon Sep 17 00:00:00 2001 From: Frank Yu Date: Tue, 26 Mar 2024 08:04:55 +0000 Subject: [PATCH 15/44] Fix wrong unit in mipi table for F10. Test: Manual test with MDS apps. The result display mipi frequency is expected. Bug: 331336468 Change-Id: I72ec2519ea345716b5430da5b8cc6a845123d399 --- .../felix_display_secondary_mipi_coex_table.csv | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/felix/radio/felix_display_secondary_mipi_coex_table.csv b/felix/radio/felix_display_secondary_mipi_coex_table.csv index e28cbcc..8394e1c 100644 --- a/felix/radio/felix_display_secondary_mipi_coex_table.csv +++ b/felix/radio/felix_display_secondary_mipi_coex_table.csv @@ -1,7 +1,7 @@ -730000,670000 +365000,335000 -1810000,1835000,670000 -720000,740000,670000 -0,710000,730000 -750000,1800000,730000 -1845000,50000000,730000 +1810000,1835000,335000 +720000,740000,335000 +0,710000,365000 +750000,1800000,365000 +1845000,50000000,365000 From f4e79e0825e6520e1d801f8b238ee87d22003341 Mon Sep 17 00:00:00 2001 From: Ankur Bakshi Date: Thu, 28 Mar 2024 15:34:45 +0000 Subject: [PATCH 16/44] Update felix SVN to 49 Bug: 330382848 Change-Id: I4adff31a3d552c862fab43cba73c0cb074904be8 --- device-felix.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device-felix.mk b/device-felix.mk index e6266fe..a338199 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -224,7 +224,7 @@ PRODUCT_SOONG_NAMESPACES += \ # Increment the SVN for any official public releases PRODUCT_VENDOR_PROPERTIES += \ - ro.vendor.build.svn=48 + ro.vendor.build.svn=49 # Vibrator HAL PRODUCT_VENDOR_PROPERTIES +=\ From d33926ec064589d884cc5156e652ea9a1f1a2e81 Mon Sep 17 00:00:00 2001 From: cweichun Date: Thu, 28 Mar 2024 23:53:11 +0000 Subject: [PATCH 17/44] felix: upgrade IDisplay to V11 Bug: 307787644 Test: build pass Change-Id: Iba924e74c72d2d8f857a47068d702d4197f56ce8 --- device_framework_matrix_product_felix.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device_framework_matrix_product_felix.xml b/device_framework_matrix_product_felix.xml index 90ef723..31dd4c3 100644 --- a/device_framework_matrix_product_felix.xml +++ b/device_framework_matrix_product_felix.xml @@ -1,7 +1,7 @@ com.google.hardware.pixel.display - 10 + 11 IDisplay secondary From 8bed816740b9c12ea2ea25e10ee44530578e2086 Mon Sep 17 00:00:00 2001 From: Jimmy Shiu Date: Thu, 14 Mar 2024 16:04:14 +0000 Subject: [PATCH 18/44] powerhint: set uclampmin_init value for applying CPU Load boost Bug: 329483662 Test: Manual Test Change-Id: I9e3afbeb455391ab1493f184bbf27f3c8e6c8e5a --- powerhint.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/powerhint.json b/powerhint.json index 34dcaed..e5d7a04 100644 --- a/powerhint.json +++ b/powerhint.json @@ -2195,7 +2195,7 @@ "PID_Do": 500.0, "PID_Du": 0.0, "UclampMin_On": true, - "UclampMin_Init": 232, + "UclampMin_Init": 480, "UclampMin_High": 480, "UclampMin_Low": 2, "SamplingWindow_P": 1, @@ -2219,7 +2219,7 @@ "PID_Do": 500.0, "PID_Du": 0.0, "UclampMin_On": true, - "UclampMin_Init": 162, + "UclampMin_Init": 480, "UclampMin_High": 480, "UclampMin_Low": 2, "SamplingWindow_P": 1, @@ -2243,7 +2243,7 @@ "PID_Do": 500.0, "PID_Du": 0.0, "UclampMin_On": true, - "UclampMin_Init": 162, + "UclampMin_Init": 480, "UclampMin_High": 480, "UclampMin_Low": 2, "SamplingWindow_P": 1, From 73220aeecf69ad2c7a04be657263379aa4406b24 Mon Sep 17 00:00:00 2001 From: Ankur Bakshi Date: Wed, 3 Apr 2024 23:17:02 +0000 Subject: [PATCH 19/44] Update felix SVN to 50 Bug: 330382848 Change-Id: Ic4cb9fec016661b45d7af9a1075e5912bd435b9e --- device-felix.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device-felix.mk b/device-felix.mk index a338199..dfcf0ab 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -224,7 +224,7 @@ PRODUCT_SOONG_NAMESPACES += \ # Increment the SVN for any official public releases PRODUCT_VENDOR_PROPERTIES += \ - ro.vendor.build.svn=49 + ro.vendor.build.svn=50 # Vibrator HAL PRODUCT_VENDOR_PROPERTIES +=\ From 1ab55d56bc3948f02d69ce0b2fa9c4bc1ffba22d Mon Sep 17 00:00:00 2001 From: Jimmy Shiu Date: Wed, 10 Apr 2024 07:10:37 +0000 Subject: [PATCH 20/44] powerhint: set ADPF CPU_LOAD_UP CPU_LOAD_RESET values Bug: 329483662 Test: Manual Test Change-Id: I9b748e2fb6110cac3d8589da2f3bb6d89a619ed3 --- powerhint.json | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/powerhint.json b/powerhint.json index e5d7a04..078beb9 100644 --- a/powerhint.json +++ b/powerhint.json @@ -2195,15 +2195,15 @@ "PID_Do": 500.0, "PID_Du": 0.0, "UclampMin_On": true, - "UclampMin_Init": 480, + "UclampMin_Init": 232, + "UclampMin_LoadUp": 480, + "UclampMin_LoadReset": 480, "UclampMin_High": 480, "UclampMin_Low": 2, "SamplingWindow_P": 1, "SamplingWindow_I": 0, "SamplingWindow_D": 1, "ReportingRateLimitNs": 83333330, - "EarlyBoost_On": false, - "EarlyBoost_TimeFactor": 0.0, "TargetTimeFactor": 1.0, "StaleTimeFactor": 15.0 }, @@ -2219,15 +2219,15 @@ "PID_Do": 500.0, "PID_Du": 0.0, "UclampMin_On": true, - "UclampMin_Init": 480, + "UclampMin_Init": 162, + "UclampMin_LoadUp": 480, + "UclampMin_LoadReset": 480, "UclampMin_High": 480, "UclampMin_Low": 2, "SamplingWindow_P": 1, "SamplingWindow_I": 0, "SamplingWindow_D": 1, "ReportingRateLimitNs": 111111110, - "EarlyBoost_On": false, - "EarlyBoost_TimeFactor": 0.0, "TargetTimeFactor": 1.0, "StaleTimeFactor": 15.0 }, @@ -2243,15 +2243,15 @@ "PID_Do": 500.0, "PID_Du": 0.0, "UclampMin_On": true, - "UclampMin_Init": 480, + "UclampMin_Init": 162, + "UclampMin_LoadUp": 480, + "UclampMin_LoadReset": 480, "UclampMin_High": 480, "UclampMin_Low": 2, "SamplingWindow_P": 1, "SamplingWindow_I": 0, "SamplingWindow_D": 1, "ReportingRateLimitNs": 166666660, - "EarlyBoost_On": false, - "EarlyBoost_TimeFactor": 0.0, "TargetTimeFactor": 1.0, "StaleTimeFactor": 15.0 }, @@ -2274,8 +2274,6 @@ "UclampMin_High": 197, "UclampMin_Low": 197, "ReportingRateLimitNs": 1, - "EarlyBoost_On": false, - "EarlyBoost_TimeFactor": 0.0, "TargetTimeFactor": 1.0, "StaleTimeFactor": 5.0 }, @@ -2298,8 +2296,6 @@ "UclampMin_High": 53, "UclampMin_Low": 53, "ReportingRateLimitNs": 1, - "EarlyBoost_On": false, - "EarlyBoost_TimeFactor": 0.0, "TargetTimeFactor": 1.0, "StaleTimeFactor": 5.0 }, @@ -2322,8 +2318,6 @@ "UclampMin_High": 0, "UclampMin_Low": 0, "ReportingRateLimitNs": 1, - "EarlyBoost_On": false, - "EarlyBoost_TimeFactor": 0.0, "TargetTimeFactor": 1.0, "StaleTimeFactor": 5.0 } From 7088cc28d6e6f26b4a68e2593641bf602c4afdd7 Mon Sep 17 00:00:00 2001 From: Barry Date: Thu, 11 Apr 2024 14:56:26 +0000 Subject: [PATCH 21/44] [Bluetooth] Disable BT auto on feature Set bluetooth.server.automatic_turn_on false for disable Bluetooth Auto On feature Bug: 333830114 Test: make Change-Id: I18365504a4f7c9f16b5b20842e15a6248770bdab --- device-felix.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device-felix.mk b/device-felix.mk index 64d5ca6..809e753 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -150,7 +150,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ # Enable Bluetooth AutoOn feature PRODUCT_PRODUCT_PROPERTIES += \ - bluetooth.server.automatic_turn_on=true + bluetooth.server.automatic_turn_on=false # Bluetooth Tx power caps PRODUCT_COPY_FILES += \ From 9f7ed821c85defdd815fbe80a293bbe76eb1184e Mon Sep 17 00:00:00 2001 From: Cyan_Hsieh Date: Tue, 2 Apr 2024 16:47:02 +0800 Subject: [PATCH 22/44] Switch default kernel directory and change build flag naming Bug: 309749142 Change-Id: I1be08e889dfa60d6a24acac7f71f21b0241221b1 --- device-felix.mk | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/device-felix.mk b/device-felix.mk index 69ec36f..b829226 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -19,18 +19,10 @@ $(call inherit-product-if-exists, vendor/google/products/sources_pixel.mk) TARGET_RECOVERY_DEFAULT_ROTATION := ROTATION_RIGHT -ifdef RELEASE_GOOGLE_FELIX_KERNEL_VERSION -TARGET_LINUX_KERNEL_VERSION := $(RELEASE_GOOGLE_FELIX_KERNEL_VERSION) -endif - -ifdef RELEASE_GOOGLE_FELIX_KERNEL_DIR +TARGET_LINUX_KERNEL_VERSION := $(RELEASE_KERNEL_FELIX_VERSION) # Keeps flexibility for kasan and ufs builds -TARGET_KERNEL_DIR ?= $(RELEASE_GOOGLE_FELIX_KERNEL_DIR) -TARGET_BOARD_KERNEL_HEADERS ?= $(RELEASE_GOOGLE_FELIX_KERNEL_DIR)/kernel-headers -else -TARGET_KERNEL_DIR ?= device/google/felix-kernel -TARGET_BOARD_KERNEL_HEADERS ?= device/google/felix-kernel/kernel-headers -endif +TARGET_KERNEL_DIR ?= $(RELEASE_KERNEL_FELIX_DIR) +TARGET_BOARD_KERNEL_HEADERS ?= $(RELEASE_KERNEL_FELIX_DIR)/kernel-headers $(call inherit-product-if-exists, vendor/google_devices/felix/prebuilts/device-vendor-felix.mk) $(call inherit-product-if-exists, vendor/google_devices/gs201/prebuilts/device-vendor.mk) From 29b72d3928df54ae2772ad4131bda15f54dffcbc Mon Sep 17 00:00:00 2001 From: isaacchiou Date: Tue, 9 Apr 2024 16:02:00 +0000 Subject: [PATCH 23/44] wifi: disable FW roaming when in idle mode When device is idle, disable FW roaming (LOW RSSI roam, high band roam) to save power Bug: 321639511 Test: Manual Change-Id: Iab34c0fdda533a33d1a9f38429a809091df5dd57 --- rro_overlays/WifiOverlay/res/values/config.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rro_overlays/WifiOverlay/res/values/config.xml b/rro_overlays/WifiOverlay/res/values/config.xml index 8079614..989a868 100644 --- a/rro_overlays/WifiOverlay/res/values/config.xml +++ b/rro_overlays/WifiOverlay/res/values/config.xml @@ -175,4 +175,10 @@ If equals to 0, it means there's no limit on the max number of channels to include per network.--> 3 + + true + From 7c40f4f50be220aca06078b41c3e21725065f9c4 Mon Sep 17 00:00:00 2001 From: Poomarin Phloyphisut Date: Wed, 17 Apr 2024 04:11:05 +0000 Subject: [PATCH 24/44] [USB Audio AIDL] Add mixer path for "usb-device-microphones" Bug: 329147872 Test: Local test Change-Id: Ib6794b13c755f00c2c5918f418fe1a62bbe0da98 --- audio/felix/aidl_config/mixer_paths_aidl.xml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/audio/felix/aidl_config/mixer_paths_aidl.xml b/audio/felix/aidl_config/mixer_paths_aidl.xml index d44e685..d71c0bf 100644 --- a/audio/felix/aidl_config/mixer_paths_aidl.xml +++ b/audio/felix/aidl_config/mixer_paths_aidl.xml @@ -1344,7 +1344,7 @@ - + @@ -1354,6 +1354,15 @@ + + + + + + + + + From dc242dcbda277a18b4bb26e6695b87a3ee21c703 Mon Sep 17 00:00:00 2001 From: Cyan_Hsieh Date: Thu, 18 Apr 2024 16:02:34 +0800 Subject: [PATCH 25/44] Switch bootloader directory to control by build flag Bug: 333834221 Change-Id: If900f24f9f171a27f81fed59c4712bf536c84734 --- device-felix.mk | 9 --------- felix/BoardConfig.mk | 12 +++--------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/device-felix.mk b/device-felix.mk index b829226..10711d0 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -262,15 +262,6 @@ PRODUCT_PACKAGES += \ # Trusty liboemcrypto.so PRODUCT_SOONG_NAMESPACES += vendor/google_devices/felix/prebuilts -ifneq (,$(filter AP1%,$(RELEASE_PLATFORM_VERSION))) -PRODUCT_SOONG_NAMESPACES += vendor/google_devices/felix/prebuilts/trusty/24Q1 -else ifneq (,$(filter AP2%,$(RELEASE_PLATFORM_VERSION))) -PRODUCT_SOONG_NAMESPACES += vendor/google_devices/felix/prebuilts/trusty/24Q2 -else ifneq (,$(filter AP3%,$(RELEASE_PLATFORM_VERSION))) -PRODUCT_SOONG_NAMESPACES += vendor/google_devices/felix/prebuilts/trusty/24Q3 -else -PRODUCT_SOONG_NAMESPACES += vendor/google_devices/felix/prebuilts/trusty/trunk -endif # Set zram size PRODUCT_VENDOR_PROPERTIES += \ diff --git a/felix/BoardConfig.mk b/felix/BoardConfig.mk index 9ca6580..3b54231 100644 --- a/felix/BoardConfig.mk +++ b/felix/BoardConfig.mk @@ -21,15 +21,9 @@ USES_DEVICE_GOOGLE_FELIX := true BOARD_KERNEL_CMDLINE += swiotlb=noforce RELEASE_GOOGLE_PRODUCT_RADIO_DIR := $(RELEASE_GOOGLE_FELIX_RADIO_DIR) -ifneq (,$(filter AP1%,$(RELEASE_PLATFORM_VERSION))) -RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/24Q1 -else ifneq (,$(filter AP2%,$(RELEASE_PLATFORM_VERSION))) -RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/24Q2 -else ifneq (,$(filter AP3%,$(RELEASE_PLATFORM_VERSION))) -RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/24Q3 -else -RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/trunk -endif +RELEASE_GOOGLE_BOOTLOADER_FELIX_DIR ?= trunk # Keep this for pdk TODO: b/327119000 +RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/$(RELEASE_GOOGLE_BOOTLOADER_FELIX_DIR) +$(call soong_config_set,bootloader,prebuilt_dir,$(RELEASE_GOOGLE_BOOTLOADER_FELIX_DIR)) # Enable load module in parallel BOARD_BOOTCONFIG += androidboot.load_modules_parallel=true From c1da63bc66405420a7b079535f262a75c87ed35d Mon Sep 17 00:00:00 2001 From: Chris Paulo Date: Thu, 18 Apr 2024 16:23:39 -0700 Subject: [PATCH 26/44] felix/vibrator: Add removecapo flag reference for it to show up in aconfig Bug: 335547922 Test: adb shell device_config list | egrep -i 'remove_capo' Change-Id: I1f6dca0f0dc61fa4bc2db85a1fc55f56ce7146af Signed-off-by: Chris Paulo --- vibrator/cs40l26/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/vibrator/cs40l26/Android.bp b/vibrator/cs40l26/Android.bp index 9ac51d1..bd5047a 100644 --- a/vibrator/cs40l26/Android.bp +++ b/vibrator/cs40l26/Android.bp @@ -60,6 +60,7 @@ cc_library { srcs: [ "Vibrator.cpp", ], + shared_libs: ["//hardware/google/pixel:PixelVibratorFlagsL26"], export_include_dirs: ["."], vendor_available: true, visibility: [":__subpackages__"], From b830ea62b3a8f210b05c9d366fc0b94cf5c68a28 Mon Sep 17 00:00:00 2001 From: Cutter Coryell Date: Mon, 1 Apr 2024 12:08:29 -0700 Subject: [PATCH 27/44] Turn off ML in system back gesture Bug: b/332343111 Fixes: b/332343111 Test: atest BackAnimationControllerTest BackNavigationControllerTests OnBackInvokedDispatcherTest Change-Id: I3de429ed6d9972355dae4edd2fd03b15859d0f4b --- .../frameworks/base/packages/SystemUI/res/values/config.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/felix/overlay/frameworks/base/packages/SystemUI/res/values/config.xml b/felix/overlay/frameworks/base/packages/SystemUI/res/values/config.xml index 9d91e32..5a97b1d 100644 --- a/felix/overlay/frameworks/base/packages/SystemUI/res/values/config.xml +++ b/felix/overlay/frameworks/base/packages/SystemUI/res/values/config.xml @@ -148,5 +148,8 @@ 4 : DEVICE_POSTURE_FLIPPED --> 1 + + + false From e222c307125a3c038eb3c5376453c70d9c47040c Mon Sep 17 00:00:00 2001 From: Ankur Bakshi Date: Wed, 24 Apr 2024 19:47:53 +0000 Subject: [PATCH 28/44] Update felix SVN to 51 Bug: 336526332 Change-Id: I0b4bea1a97004139cc18129eeeab302aa557ca05 --- device-felix.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device-felix.mk b/device-felix.mk index dfcf0ab..1b69924 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -224,7 +224,7 @@ PRODUCT_SOONG_NAMESPACES += \ # Increment the SVN for any official public releases PRODUCT_VENDOR_PROPERTIES += \ - ro.vendor.build.svn=50 + ro.vendor.build.svn=51 # Vibrator HAL PRODUCT_VENDOR_PROPERTIES +=\ From 499a0fb8e03892d031e2f721ff69890adbe49f4b Mon Sep 17 00:00:00 2001 From: Ankur Bakshi Date: Thu, 25 Apr 2024 03:46:07 +0000 Subject: [PATCH 29/44] Update felix SVN to 52 Bug: 336526332 Change-Id: I29b92d74abee7982022151fb53ef23634fd707f8 --- device-felix.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device-felix.mk b/device-felix.mk index 1b69924..94a95d5 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -224,7 +224,7 @@ PRODUCT_SOONG_NAMESPACES += \ # Increment the SVN for any official public releases PRODUCT_VENDOR_PROPERTIES += \ - ro.vendor.build.svn=51 + ro.vendor.build.svn=52 # Vibrator HAL PRODUCT_VENDOR_PROPERTIES +=\ From b1c645d05f31bfdaf29ae598ad4903a65675a47e Mon Sep 17 00:00:00 2001 From: Thomas Girardier Date: Thu, 25 Apr 2024 16:21:17 +0000 Subject: [PATCH 30/44] Revert "[Bluetooth] Disable BT auto on feature" Revert submission 26919210-BTAUTOOFF4389 Reason for revert: Auto On has been approved for 24Q3 Reverted changes: /q/submissionid:26919210-BTAUTOOFF4389 Change-Id: I6954cbe2e9dcbed7ee450b73fceb3025e149d349 --- device-felix.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device-felix.mk b/device-felix.mk index 809e753..64d5ca6 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -150,7 +150,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ # Enable Bluetooth AutoOn feature PRODUCT_PRODUCT_PROPERTIES += \ - bluetooth.server.automatic_turn_on=false + bluetooth.server.automatic_turn_on=true # Bluetooth Tx power caps PRODUCT_COPY_FILES += \ From 4ce0287a438168b5ac7c64f016245a02732238c0 Mon Sep 17 00:00:00 2001 From: Hao Dong Date: Wed, 24 Apr 2024 05:27:26 +0000 Subject: [PATCH 31/44] Rename style from AuthCredential to AuthNonBioCredential. Bug: 335199602 Test: N/A Change-Id: Ief716415b2dbe330e69835a31f323a012a39af1c --- .../base/packages/SystemUI/res/values-sw600dp-land/styles.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/felix/overlay/frameworks/base/packages/SystemUI/res/values-sw600dp-land/styles.xml b/felix/overlay/frameworks/base/packages/SystemUI/res/values-sw600dp-land/styles.xml index b104587..b14ff4f 100644 --- a/felix/overlay/frameworks/base/packages/SystemUI/res/values-sw600dp-land/styles.xml +++ b/felix/overlay/frameworks/base/packages/SystemUI/res/values-sw600dp-land/styles.xml @@ -16,7 +16,7 @@ -