Snap for 12605939 from ccd324c4b3
to mainline-tzdata6-release
Change-Id: Ia28243e80e5a4f72743392a1a60e419fbad18a2b
This commit is contained in:
commit
87da764c4d
14 changed files with 167 additions and 102 deletions
|
@ -86,7 +86,7 @@ on early-boot
|
|||
start insmod_sh_felix
|
||||
chown system system /sys/class/power_supply/dualbatt/dbatt_stats
|
||||
|
||||
service insmod_sh_felix /vendor/bin/insmod.sh /vendor/etc/init.insmod.felix.cfg
|
||||
service insmod_sh_felix /vendor/bin/insmod.sh /vendor_dlkm/etc/init.insmod.felix.cfg
|
||||
class main
|
||||
user root
|
||||
group root system
|
||||
|
|
|
@ -60,9 +60,13 @@ PRODUCT_COPY_FILES += \
|
|||
PRODUCT_COPY_FILES += \
|
||||
device/google/felix/conf/init.recovery.device.rc:$(TARGET_COPY_OUT_RECOVERY)/root/init.recovery.felix.rc
|
||||
|
||||
# insmod files
|
||||
# insmod files. Kernel 5.10 prebuilts don't provide these yet, so provide our
|
||||
# own copy if they're not in the prebuilts.
|
||||
# TODO(b/369686096): drop this when 5.10 is gone.
|
||||
ifeq ($(wildcard $(TARGET_KERNEL_DIR)/init.insmod.*.cfg),)
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/google/felix/init.insmod.felix.cfg:$(TARGET_COPY_OUT_VENDOR)/etc/init.insmod.felix.cfg
|
||||
device/google/felix/init.insmod.felix.cfg:$(TARGET_COPY_OUT_VENDOR_DLKM)/etc/init.insmod.felix.cfg
|
||||
endif
|
||||
|
||||
# Camera
|
||||
PRODUCT_COPY_FILES += \
|
||||
|
@ -108,6 +112,12 @@ PRODUCT_PACKAGES += \
|
|||
android.hardware.nfc-service.st \
|
||||
NfcOverlayFelix
|
||||
|
||||
# Shared Modem Platform
|
||||
SHARED_MODEM_PLATFORM_VENDOR := lassen
|
||||
|
||||
# Shared Modem Platform
|
||||
include device/google/gs-common/modem/shared_modem_platform/shared_modem_platform.mk
|
||||
|
||||
# SecureElement
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.secure_element@1.2-service-gto \
|
||||
|
|
|
@ -151,13 +151,17 @@
|
|||
</array>
|
||||
|
||||
<!-- Additional power used when screen is ambient mode -->
|
||||
<item name="ambient.on">32</item>
|
||||
<item name="ambient.on.display0">32</item>
|
||||
<item name="ambient.on.display1">32</item>
|
||||
|
||||
<!-- Additional power used when screen is turned on at minimum brightness -->
|
||||
<item name="screen.on">98</item>
|
||||
<item name="screen.on.display0">98</item>
|
||||
<item name="screen.on.display1">98</item>
|
||||
|
||||
<!-- Additional power used when screen is at maximum brightness, compared to
|
||||
screen at minimum brightness -->
|
||||
<item name="screen.full">470</item>
|
||||
<item name="screen.full.display0">470</item>
|
||||
<item name="screen.full.display1">470</item>
|
||||
|
||||
<!-- Average power used by the camera flash module when on -->
|
||||
<item name="camera.flashlight">240.47</item>
|
||||
|
|
|
@ -135,7 +135,7 @@ OFFHOST_ROUTE_ESE={86}
|
|||
# host 0x00
|
||||
# eSE 0x82 (eSE), 0x86 (eUICC/SPI-SE)
|
||||
# UICC 0x81 (UICC_1), 0x85 (UICC_2)
|
||||
DEFAULT_ISODEP_ROUTE=0x81
|
||||
DEFAULT_ISODEP_ROUTE=0x00
|
||||
|
||||
###############################################################################
|
||||
# Configure the HAL Clock control
|
||||
|
|
|
@ -1107,6 +1107,18 @@
|
|||
"Duration": 100,
|
||||
"Value": "0"
|
||||
},
|
||||
{
|
||||
"PowerHint": "CAMERA_MULTICAM_BOOST",
|
||||
"Node": "CDPreferIdle",
|
||||
"Duration": 100,
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"PowerHint": "CAMERA_MULTICAM_BOOST",
|
||||
"Node": "PMU_POLL",
|
||||
"Duration": 100,
|
||||
"Value": "0"
|
||||
},
|
||||
{
|
||||
"PowerHint": "GCA_CAMERA_SHOT_BIGCPU_RANK1",
|
||||
"Node": "TAPreferHighCap",
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
file:platform/hardware/google/pixel:/vibrator/OWNERS
|
||||
chrispaulo@google.com
|
||||
nathankulczak@google.com
|
||||
taikuo@google.com
|
||||
|
|
|
@ -69,6 +69,7 @@ HwCalBase::HwCalBase() {
|
|||
std::ifstream calfile;
|
||||
std::ifstream calfile_dual;
|
||||
auto propertyPrefix = std::getenv("PROPERTY_PREFIX");
|
||||
auto calPath = std::getenv("CALIBRATION_FILEPATH");
|
||||
|
||||
if (propertyPrefix != NULL) {
|
||||
mPropertyPrefix = std::string(propertyPrefix);
|
||||
|
@ -76,6 +77,14 @@ HwCalBase::HwCalBase() {
|
|||
ALOGE("Failed get property prefix!");
|
||||
}
|
||||
|
||||
// Keep the cal file path for the current HwCalBase instance.
|
||||
if (calPath != NULL) {
|
||||
mCalPath = std::string(calPath);
|
||||
} else {
|
||||
ALOGE("Failed get the calibration file path!");
|
||||
}
|
||||
|
||||
// Read the cal data for the current instance.
|
||||
utils::fileFromEnv("CALIBRATION_FILEPATH", &calfile);
|
||||
|
||||
for (std::string line; std::getline(calfile, line);) {
|
||||
|
@ -89,6 +98,7 @@ HwCalBase::HwCalBase() {
|
|||
}
|
||||
}
|
||||
|
||||
// Read the cal data for the other instance.
|
||||
utils::fileFromEnv("CALIBRATION_FILEPATH_DUAL", &calfile_dual);
|
||||
|
||||
for (std::string line; std::getline(calfile_dual, line);) {
|
||||
|
@ -106,7 +116,6 @@ HwCalBase::HwCalBase() {
|
|||
|
||||
void HwCalBase::debug(int fd) {
|
||||
std::ifstream stream;
|
||||
std::string path;
|
||||
std::string line;
|
||||
struct context {
|
||||
HwCalBase *obj;
|
||||
|
@ -133,9 +142,8 @@ void HwCalBase::debug(int fd) {
|
|||
|
||||
dprintf(fd, "Persist:\n");
|
||||
|
||||
utils::fileFromEnv("CALIBRATION_FILEPATH", &stream, &path);
|
||||
|
||||
dprintf(fd, " %s:\n", path.c_str());
|
||||
utils::openNoCreate(mCalPath, &stream);
|
||||
dprintf(fd, " %s:\n", mCalPath.c_str());
|
||||
while (std::getline(stream, line)) {
|
||||
dprintf(fd, " %s\n", line.c_str());
|
||||
}
|
||||
|
|
|
@ -208,6 +208,7 @@ class HwCalBase {
|
|||
|
||||
private:
|
||||
std::string mPropertyPrefix;
|
||||
std::string mCalPath;
|
||||
std::map<std::string, std::string> mCalData;
|
||||
};
|
||||
|
||||
|
|
|
@ -103,6 +103,19 @@ inline Enable_If_Unsigned<T, T> getProperty(const std::string &key, const T def)
|
|||
return ::android::base::GetUintProperty(key, def);
|
||||
}
|
||||
|
||||
template <typename T, size_t N>
|
||||
inline std::array<T, N> getProperty(const std::string &key, const std::array<T, N> &def) {
|
||||
std::string value = ::android::base::GetProperty(key, "");
|
||||
if (!value.empty()) {
|
||||
std::array<T, N> result{0};
|
||||
std::stringstream stream{value};
|
||||
utils::unpack(stream, &result);
|
||||
if (stream && stream.eof())
|
||||
return result;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline bool getProperty<bool>(const std::string &key, const bool def) {
|
||||
return ::android::base::GetBoolProperty(key, def);
|
||||
|
|
|
@ -318,9 +318,9 @@ class HwCal : public Vibrator::HwCal, private HwCalBase {
|
|||
|
||||
static constexpr uint32_t VERSION_DEFAULT = 2;
|
||||
static constexpr int32_t DEFAULT_FREQUENCY_SHIFT = 0;
|
||||
static constexpr std::array<uint32_t, 2> V_TICK_DEFAULT = {1, 100};
|
||||
static constexpr std::array<uint32_t, 2> V_CLICK_DEFAULT = {1, 100};
|
||||
static constexpr std::array<uint32_t, 2> V_LONG_DEFAULT = {1, 100};
|
||||
static constexpr std::array<uint32_t, 2> V_TICK_DEFAULT = {5, 95};
|
||||
static constexpr std::array<uint32_t, 2> V_CLICK_DEFAULT = {5, 95};
|
||||
static constexpr std::array<uint32_t, 2> V_LONG_DEFAULT = {5, 95};
|
||||
|
||||
public:
|
||||
HwCal() {}
|
||||
|
@ -370,22 +370,19 @@ class HwCal : public Vibrator::HwCal, private HwCalBase {
|
|||
if (getPersist(TICK_VOLTAGES_CONFIG, value)) {
|
||||
return true;
|
||||
}
|
||||
*value = V_TICK_DEFAULT;
|
||||
return true;
|
||||
return getProperty(TICK_VOLTAGES_CONFIG, value, V_TICK_DEFAULT);
|
||||
}
|
||||
bool getClickVolLevels(std::array<uint32_t, 2> *value) override {
|
||||
if (getPersist(CLICK_VOLTAGES_CONFIG, value)) {
|
||||
return true;
|
||||
}
|
||||
*value = V_CLICK_DEFAULT;
|
||||
return true;
|
||||
return getProperty(CLICK_VOLTAGES_CONFIG, value, V_CLICK_DEFAULT);
|
||||
}
|
||||
bool getLongVolLevels(std::array<uint32_t, 2> *value) override {
|
||||
if (getPersist(LONG_VOLTAGES_CONFIG, value)) {
|
||||
return true;
|
||||
}
|
||||
*value = V_LONG_DEFAULT;
|
||||
return true;
|
||||
return getProperty(LONG_VOLTAGES_CONFIG, value, V_LONG_DEFAULT);
|
||||
}
|
||||
bool isChirpEnabled() override {
|
||||
return utils::getProperty("persist.vendor.vibrator.hal.chirp.enabled", false);
|
||||
|
|
|
@ -195,6 +195,8 @@ enum vibe_state {
|
|||
VIBE_STATE_ASP,
|
||||
};
|
||||
|
||||
std::mutex mActiveId_mutex; // protects mActiveId
|
||||
|
||||
class DspMemChunk {
|
||||
private:
|
||||
std::unique_ptr<uint8_t[]> head;
|
||||
|
@ -1081,7 +1083,7 @@ ndk::ScopedAStatus Vibrator::on(uint32_t timeoutMs, uint32_t effectIndex, const
|
|||
if (mIsDual) {
|
||||
mHwApiDual->getOwtFreeSpace(&freeBytes);
|
||||
if (ch-> size() > freeBytes) {
|
||||
ALOGE("Invalid OWT length in flip: Effect %d: %d > %d!", effectIndex,
|
||||
ALOGE("Invalid OWT length in flip: Effect %d: %zu > %d!", effectIndex,
|
||||
ch-> size(), freeBytes);
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||
}
|
||||
|
@ -1482,40 +1484,31 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) {
|
|||
dprintf(fd, " Redc: %.02f\n", mRedc);
|
||||
|
||||
dprintf(fd, " Voltage Levels:\n");
|
||||
dprintf(fd, " Tick Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mTickEffectVol[0],
|
||||
dprintf(fd, " Tick Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mTickEffectVol[0],
|
||||
mTickEffectVol[1]);
|
||||
dprintf(fd, " Click Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mClickEffectVol[0],
|
||||
dprintf(fd, " Click Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mClickEffectVol[0],
|
||||
mClickEffectVol[1]);
|
||||
dprintf(fd, " Long Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mLongEffectVol[0],
|
||||
dprintf(fd, " Long Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mLongEffectVol[0],
|
||||
mLongEffectVol[1]);
|
||||
|
||||
dprintf(fd, " FF effect:\n");
|
||||
dprintf(fd, " Physical waveform:\n");
|
||||
dprintf(fd, "==== Base ====\n\tId\tIndex\tt ->\tt'\tBrake\ttrigger button\n");
|
||||
uint8_t effectId;
|
||||
dprintf(fd, " Scales\n");
|
||||
dprintf(fd, "\tId\tMinScale\tMaxScale\n");
|
||||
for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) {
|
||||
dprintf(fd, "\t%d\t%d\t\t%d\n", effectId, mPrimitiveMinScale[effectId],
|
||||
mPrimitiveMaxScale[effectId]);
|
||||
}
|
||||
|
||||
dprintf(fd, " Base FF effect:\n");
|
||||
dprintf(fd, " Physical waveform:\n");
|
||||
dprintf(fd, "\tId\tIndex\tt ->\tt'\tBrake\ttrigger button\n");
|
||||
for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) {
|
||||
dprintf(fd, "\t%d\t%d\t%d\t%d\t%d\t%X\n", mFfEffects[effectId].id,
|
||||
mFfEffects[effectId].u.periodic.custom_data[1], mEffectDurations[effectId],
|
||||
mFfEffects[effectId].replay.length, mEffectBrakingDurations[effectId],
|
||||
mFfEffects[effectId].trigger.button);
|
||||
}
|
||||
if (mIsDual) {
|
||||
dprintf(fd, "==== Flip ====\n\tId\tIndex\tt ->\tt'\tBrake\ttrigger button\n");
|
||||
for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) {
|
||||
dprintf(fd, "\t%d\t%d\t%d\t%d\t%d\t%X\n", mFfEffectsDual[effectId].id,
|
||||
mFfEffectsDual[effectId].u.periodic.custom_data[1], mEffectDurations[effectId],
|
||||
mFfEffectsDual[effectId].replay.length, mEffectBrakingDurations[effectId],
|
||||
mFfEffectsDual[effectId].trigger.button);
|
||||
}
|
||||
}
|
||||
|
||||
dprintf(fd, "==== Scales ====\n\tId\tMinScale\tMaxScale\n");
|
||||
for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) {
|
||||
dprintf(fd, "\t%d\t%d\t\t%d\n", effectId, mPrimitiveMinScale[effectId],
|
||||
mPrimitiveMaxScale[effectId]);
|
||||
}
|
||||
|
||||
dprintf(fd, "\nBase: OWT waveform:\n");
|
||||
dprintf(fd, " OWT waveform:\n");
|
||||
dprintf(fd, "\tId\tBytes\tData\tt\ttrigger button\n");
|
||||
for (effectId = WAVEFORM_MAX_PHYSICAL_INDEX; effectId < WAVEFORM_MAX_INDEX; effectId++) {
|
||||
uint32_t numBytes = mFfEffects[effectId].u.periodic.custom_len * 2;
|
||||
|
@ -1531,8 +1524,18 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) {
|
|||
dprintf(fd, "\t%d\t%d\t{%s}\t%u\t%X\n", mFfEffects[effectId].id, numBytes, ss.str().c_str(),
|
||||
mFfEffectsDual[effectId].replay.length, mFfEffects[effectId].trigger.button);
|
||||
}
|
||||
|
||||
if (mIsDual) {
|
||||
dprintf(fd, "Flip: OWT waveform:\n");
|
||||
dprintf(fd, " Flip FF effect:\n");
|
||||
dprintf(fd, " Physical waveform:\n");
|
||||
dprintf(fd, "\tId\tIndex\tt ->\tt'\tBrake\ttrigger button\n");
|
||||
for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) {
|
||||
dprintf(fd, "\t%d\t%d\t%d\t%d\t%d\t%X\n", mFfEffectsDual[effectId].id,
|
||||
mFfEffectsDual[effectId].u.periodic.custom_data[1], mEffectDurations[effectId],
|
||||
mFfEffectsDual[effectId].replay.length, mEffectBrakingDurations[effectId],
|
||||
mFfEffectsDual[effectId].trigger.button);
|
||||
}
|
||||
dprintf(fd, " OWT waveform:\n");
|
||||
dprintf(fd, "\tId\tBytes\tData\tt\ttrigger button\n");
|
||||
for (effectId = WAVEFORM_MAX_PHYSICAL_INDEX; effectId < WAVEFORM_MAX_INDEX; effectId++) {
|
||||
uint32_t numBytes = mFfEffectsDual[effectId].u.periodic.custom_len * 2;
|
||||
|
@ -1553,78 +1556,67 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) {
|
|||
dprintf(fd, "\n");
|
||||
|
||||
dprintf(fd, "Versions:\n");
|
||||
const std::vector<std::pair<std::string, std::string>> moduleFolderNames = {
|
||||
{"cs40l26_core", "Haptics"}, {"cl_dsp_core", "DSP"}};
|
||||
const std::string firmwareFolder = "/vendor/firmware/";
|
||||
const std::string waveformName = "cs40l26.bin";
|
||||
const std::array<std::string, 2> firmwareFileNames = {"cs40l26.wmfw", "cs40l26-calib.wmfw"};
|
||||
const std::array<std::string, 4> tuningFileNames = {"cs40l26-svc.bin", "cs40l26-calib.bin",
|
||||
"cs40l26-dvl.bin", "cs40l26-dbc.bin"};
|
||||
std::ifstream verFile;
|
||||
const auto verBinFileMode = std::ifstream::in | std::ifstream::binary;
|
||||
std::string ver;
|
||||
verFile.open("/sys/module/cs40l26_core/version");
|
||||
if (verFile.is_open()) {
|
||||
getline(verFile, ver);
|
||||
dprintf(fd, " Haptics Driver: %s\n", ver.c_str());
|
||||
verFile.close();
|
||||
for (const auto &[folder, logTag] : moduleFolderNames) {
|
||||
verFile.open("/sys/module/" + folder + "/version");
|
||||
if (verFile.is_open()) {
|
||||
getline(verFile, ver);
|
||||
dprintf(fd, " %s Driver: %s\n", logTag.c_str(), ver.c_str());
|
||||
verFile.close();
|
||||
}
|
||||
}
|
||||
verFile.open("/sys/module/cl_dsp_core/version");
|
||||
if (verFile.is_open()) {
|
||||
getline(verFile, ver);
|
||||
dprintf(fd, " DSP Driver: %s\n", ver.c_str());
|
||||
verFile.close();
|
||||
for (auto &name : firmwareFileNames) {
|
||||
verFile.open(firmwareFolder + name, verBinFileMode);
|
||||
if (verFile.is_open()) {
|
||||
verFile.seekg(113);
|
||||
dprintf(fd, " %s: %d.%d.%d\n", name.c_str(), verFile.get(), verFile.get(),
|
||||
verFile.get());
|
||||
verFile.close();
|
||||
}
|
||||
}
|
||||
verFile.open("/vendor/firmware/cs40l26.wmfw", verBinFileMode);
|
||||
if (verFile.is_open()) {
|
||||
verFile.seekg(113);
|
||||
dprintf(fd, " cs40l26.wmfw: %d.%d.%d\n", verFile.get(), verFile.get(), verFile.get());
|
||||
verFile.close();
|
||||
}
|
||||
verFile.open("/vendor/firmware/cs40l26-calib.wmfw", verBinFileMode);
|
||||
if (verFile.is_open()) {
|
||||
verFile.seekg(113);
|
||||
dprintf(fd, " cs40l26-calib.wmfw: %d.%d.%d\n", verFile.get(), verFile.get(),
|
||||
verFile.get());
|
||||
verFile.close();
|
||||
}
|
||||
verFile.open("/vendor/firmware/cs40l26.bin", verBinFileMode);
|
||||
verFile.open(firmwareFolder + waveformName, verBinFileMode);
|
||||
if (verFile.is_open()) {
|
||||
while (getline(verFile, ver)) {
|
||||
auto pos = ver.find("Date: ");
|
||||
if (pos != std::string::npos) {
|
||||
ver = ver.substr(pos + 6, pos + 15);
|
||||
dprintf(fd, " cs40l26.bin: %s\n", ver.c_str());
|
||||
dprintf(fd, " %s: %s\n", waveformName.c_str(), ver.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
verFile.close();
|
||||
}
|
||||
verFile.open("/vendor/firmware/cs40l26-svc.bin", verBinFileMode);
|
||||
if (verFile.is_open()) {
|
||||
verFile.seekg(36);
|
||||
getline(verFile, ver);
|
||||
ver = ver.substr(ver.rfind('\\') + 1);
|
||||
dprintf(fd, " cs40l26-svc.bin: %s\n", ver.c_str());
|
||||
verFile.close();
|
||||
}
|
||||
verFile.open("/vendor/firmware/cs40l26-calib.bin", verBinFileMode);
|
||||
if (verFile.is_open()) {
|
||||
verFile.seekg(36);
|
||||
getline(verFile, ver);
|
||||
ver = ver.substr(ver.rfind('\\') + 1);
|
||||
dprintf(fd, " cs40l26-calib.bin: %s\n", ver.c_str());
|
||||
verFile.close();
|
||||
}
|
||||
verFile.open("/vendor/firmware/cs40l26-dvl.bin", verBinFileMode);
|
||||
if (verFile.is_open()) {
|
||||
verFile.seekg(36);
|
||||
getline(verFile, ver);
|
||||
ver = ver.substr(0, ver.find('\0') + 1);
|
||||
ver = ver.substr(ver.rfind('\\') + 1);
|
||||
dprintf(fd, " cs40l26-dvl.bin: %s\n", ver.c_str());
|
||||
verFile.close();
|
||||
for (auto &name : tuningFileNames) {
|
||||
verFile.open(firmwareFolder + name, verBinFileMode);
|
||||
if (verFile.is_open()) {
|
||||
verFile.seekg(36);
|
||||
getline(verFile, ver);
|
||||
ver = ver.substr(0, ver.find(".bin") + 4);
|
||||
ver = ver.substr(ver.rfind('\\') + 1);
|
||||
dprintf(fd, " %s: %s\n", name.c_str(), ver.c_str());
|
||||
verFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
dprintf(fd, "\n");
|
||||
|
||||
mHwApiDef->debug(fd);
|
||||
|
||||
dprintf(fd, "\n");
|
||||
|
||||
mHwCalDef->debug(fd);
|
||||
|
||||
dprintf(fd, "\n");
|
||||
|
||||
if (mIsDual) {
|
||||
mHwApiDual->debug(fd);
|
||||
dprintf(fd, "\n");
|
||||
|
@ -1930,7 +1922,6 @@ uint32_t Vibrator::intensityToVolLevel(float intensity, uint32_t effectIndex) {
|
|||
volLevel = calc(intensity, mClickEffectVol);
|
||||
break;
|
||||
}
|
||||
|
||||
// The waveform being played must fall within the allowable scale range
|
||||
if (effectIndex < WAVEFORM_MAX_INDEX) {
|
||||
if (volLevel > mPrimitiveMaxScale[effectIndex]) {
|
||||
|
|
|
@ -250,7 +250,6 @@ class Vibrator : public BnVibrator {
|
|||
bool mConfigHapticAlsaDeviceDone{false};
|
||||
bool mGPIOStatus;
|
||||
bool mIsDual{false};
|
||||
std::mutex mActiveId_mutex; // protects mActiveId
|
||||
};
|
||||
|
||||
} // namespace vibrator
|
||||
|
|
|
@ -30,9 +30,9 @@ using ::testing::Test;
|
|||
|
||||
class HwCalTest : public Test {
|
||||
protected:
|
||||
static constexpr std::array<uint32_t, 2> V_TICK_DEFAULT = {1, 100};
|
||||
static constexpr std::array<uint32_t, 2> V_CLICK_DEFAULT = {1, 100};
|
||||
static constexpr std::array<uint32_t, 2> V_LONG_DEFAULT = {1, 100};
|
||||
static constexpr std::array<uint32_t, 2> V_TICK_DEFAULT = {5, 95};
|
||||
static constexpr std::array<uint32_t, 2> V_CLICK_DEFAULT = {5, 95};
|
||||
static constexpr std::array<uint32_t, 2> V_LONG_DEFAULT = {5, 95};
|
||||
|
||||
public:
|
||||
void SetUp() override { setenv("CALIBRATION_FILEPATH", mCalFile.path, true); }
|
||||
|
|
|
@ -87,7 +87,7 @@ static const std::map<Effect, EffectIndex> EFFECT_INDEX{
|
|||
static constexpr uint32_t MIN_ON_OFF_INTERVAL_US = 8500;
|
||||
static constexpr uint8_t VOLTAGE_SCALE_MAX = 100;
|
||||
static constexpr int8_t MAX_COLD_START_LATENCY_MS = 6; // I2C Transaction + DSP Return-From-Standby
|
||||
static constexpr auto POLLING_TIMEOUT = 20;
|
||||
static constexpr auto POLLING_TIMEOUT = 50;
|
||||
enum WaveformIndex : uint16_t {
|
||||
/* Physical waveform */
|
||||
WAVEFORM_LONG_VIBRATION_EFFECT_INDEX = 0,
|
||||
|
@ -506,6 +506,23 @@ TEST_P(EffectsTest, perform) {
|
|||
promise.set_value();
|
||||
return ndk::ScopedAStatus::ok();
|
||||
};
|
||||
std::vector<uint32_t> primitiveMaxScale;
|
||||
std::vector<uint32_t> primitiveMinScale;
|
||||
primitiveMaxScale.resize(WAVEFORM_MAX_INDEX, 100);
|
||||
primitiveMaxScale[WAVEFORM_CLICK_INDEX] = 95;
|
||||
primitiveMaxScale[WAVEFORM_THUD_INDEX] = 75;
|
||||
primitiveMaxScale[WAVEFORM_SPIN_INDEX] = 90;
|
||||
primitiveMaxScale[WAVEFORM_LIGHT_TICK_INDEX] = 75;
|
||||
primitiveMaxScale[WAVEFORM_LOW_TICK_INDEX] = 75;
|
||||
|
||||
primitiveMinScale.resize(WAVEFORM_MAX_INDEX, 0);
|
||||
primitiveMinScale[WAVEFORM_CLICK_INDEX] = 1;
|
||||
primitiveMinScale[WAVEFORM_THUD_INDEX] = 11;
|
||||
primitiveMinScale[WAVEFORM_SPIN_INDEX] = 23;
|
||||
primitiveMinScale[WAVEFORM_SLOW_RISE_INDEX] = 25;
|
||||
primitiveMinScale[WAVEFORM_QUICK_FALL_INDEX] = 2;
|
||||
primitiveMinScale[WAVEFORM_LIGHT_TICK_INDEX] = 3;
|
||||
primitiveMinScale[WAVEFORM_LOW_TICK_INDEX] = 16;
|
||||
bool composeEffect;
|
||||
|
||||
ExpectationSet eSetup;
|
||||
|
@ -515,7 +532,18 @@ TEST_P(EffectsTest, perform) {
|
|||
EffectIndex index = EFFECT_INDEX.at(effect);
|
||||
duration = EFFECT_DURATIONS[index];
|
||||
|
||||
eSetup += EXPECT_CALL(*mMockApi, setFFGain(_, levelToScale(scale->second)))
|
||||
auto updatedScale = levelToScale(scale->second);
|
||||
|
||||
if (index < WAVEFORM_MAX_INDEX) {
|
||||
if (updatedScale > primitiveMaxScale[index]) {
|
||||
updatedScale = primitiveMaxScale[index];
|
||||
}
|
||||
if (updatedScale < primitiveMinScale[index]) {
|
||||
updatedScale = primitiveMinScale[index];
|
||||
}
|
||||
}
|
||||
|
||||
eSetup += EXPECT_CALL(*mMockApi, setFFGain(_, updatedScale))
|
||||
.WillOnce(DoDefault());
|
||||
eActivate = EXPECT_CALL(*mMockApi, setFFPlay(_, index, true))
|
||||
.After(eSetup)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue