diff options
| -rw-r--r-- | aicp.dependencies | 6 | ||||
| -rw-r--r-- | aidl/vibrator/Android.bp | 42 | ||||
| -rw-r--r-- | aidl/vibrator/Vibrator.cpp | 655 | ||||
| -rw-r--r-- | aidl/vibrator/include/Vibrator.h | 95 | ||||
| -rw-r--r-- | aidl/vibrator/service.cpp | 50 | ||||
| -rw-r--r-- | aidl/vibrator/vendor.qti.hardware.vibrator.service.oneplus.rc | 4 | ||||
| -rw-r--r-- | aidl/vibrator/vendor.qti.hardware.vibrator.service.oneplus.xml | 33 | ||||
| -rw-r--r-- | audio_amplifier/Android.mk | 48 | ||||
| -rw-r--r-- | audio_amplifier/audio_amplifier.c | 234 | ||||
| -rw-r--r-- | wifi-mac-generator/Android.bp | 6 | ||||
| -rw-r--r-- | wifi-mac-generator/wifi-mac-generator.rc | 9 | ||||
| -rw-r--r-- | wifi-mac-generator/wifi-mac-generator.sh | 43 |
12 files changed, 6 insertions, 1219 deletions
diff --git a/aicp.dependencies b/aicp.dependencies index e06910ec..59849979 100644 --- a/aicp.dependencies +++ b/aicp.dependencies @@ -10,5 +10,11 @@ "target_path": "prebuilts/clang/host/linux-x86/clang-r450784e", "branch": "master", "remote": "gitlab" + }, + { + "repository": "LineageOS/android_hardware_oneplus", + "target_path": "hardware/oneplus", + "branch": "lineage-19.1", + "remote": "lineage" } ]
\ No newline at end of file diff --git a/aidl/vibrator/Android.bp b/aidl/vibrator/Android.bp deleted file mode 100644 index 7c07fd35..00000000 --- a/aidl/vibrator/Android.bp +++ /dev/null @@ -1,42 +0,0 @@ -Common_CFlags = ["-Wall"] -Common_CFlags += ["-Werror"] - -cc_library_shared { - name: "vendor.qti.hardware.vibrator.impl.oneplus", - vendor: true, - cflags: Common_CFlags, - srcs: [ - "Vibrator.cpp", - ], - shared_libs: [ - "libcutils", - "libutils", - "liblog", - "libqtivibratoreffect", - "libbinder_ndk", - "android.hardware.vibrator-V1-ndk_platform", - ], - export_include_dirs: ["include"], -} - -cc_binary { - name: "vendor.qti.hardware.vibrator.service.oneplus", - vendor: true, - relative_install_path: "hw", - init_rc: ["vendor.qti.hardware.vibrator.service.oneplus.rc"], - vintf_fragments: [ - "vendor.qti.hardware.vibrator.service.oneplus.xml", - ], - cflags: Common_CFlags, - srcs: [ - "service.cpp", - ], - shared_libs: [ - "libcutils", - "libutils", - "libbase", - "libbinder_ndk", - "android.hardware.vibrator-V1-ndk_platform", - "vendor.qti.hardware.vibrator.impl.oneplus", - ], -} diff --git a/aidl/vibrator/Vibrator.cpp b/aidl/vibrator/Vibrator.cpp deleted file mode 100644 index 661142db..00000000 --- a/aidl/vibrator/Vibrator.cpp +++ /dev/null @@ -1,655 +0,0 @@ -/* - * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#define LOG_TAG "vendor.qti.vibrator" - -#include <cutils/properties.h> -#include <dirent.h> -#include <inttypes.h> -#include <linux/input.h> -#include <log/log.h> -#include <map> -#include <string.h> -#include <sys/ioctl.h> -#include <thread> - -#include "include/Vibrator.h" -#ifdef USE_EFFECT_STREAM -#include "effect.h" -#endif - -namespace aidl { -namespace android { -namespace hardware { -namespace vibrator { - -#define STRONG_MAGNITUDE 0x7fff -#define MEDIUM_MAGNITUDE 0x5fff -#define LIGHT_MAGNITUDE 0x3fff -#define INVALID_VALUE -1 -#define CUSTOM_DATA_LEN 3 -#define NAME_BUF_SIZE 32 - -#define MSM_CPU_LAHAINA 415 -#define APQ_CPU_LAHAINA 439 -#define MSM_CPU_SHIMA 450 -#define MSM_CPU_SM8325 501 -#define APQ_CPU_SM8325P 502 -#define MSM_CPU_YUPIK 475 - -#define test_bit(bit, array) ((array)[(bit)/8] & (1<<((bit)%8))) - -static const char LED_DEVICE[] = "/sys/class/leds/vibrator"; - -static std::map<Effect, std::vector<std::pair<std::string, std::string>>> LED_EFFECTS{ - { Effect::CLICK, { - { "/sys/class/leds/vibrator/ignore_store", "0" }, - { "/sys/class/leds/vibrator/duration", "10" }, - { "/sys/class/leds/vibrator/vmax", "0x1f" }, - { "/sys/class/leds/vibrator/gain", "0x80" }, - { "/sys/class/leds/vibrator/seq", "0x00 0x03" }, - { "/sys/class/leds/vibrator/loop", "0x00 0x00" }, - { "/sys/class/leds/vibrator/brightness", "1" }, - }}, - { Effect::DOUBLE_CLICK, { - { "/sys/class/leds/vibrator/ignore_store", "0" }, - { "/sys/class/leds/vibrator/duration", "30" }, - { "/sys/class/leds/vibrator/vmax", "0x1f" }, - { "/sys/class/leds/vibrator/gain", "0x80" }, - { "/sys/class/leds/vibrator/seq", "0x00 0x03" }, - { "/sys/class/leds/vibrator/loop", "0x00 0x00" }, - { "/sys/class/leds/vibrator/brightness", "1" }, - { "SLEEP", "150" }, - { "/sys/class/leds/vibrator/ignore_store", "0" }, - { "/sys/class/leds/vibrator/duration", "30" }, - { "/sys/class/leds/vibrator/vmax", "0x1f" }, - { "/sys/class/leds/vibrator/gain", "0x80" }, - { "/sys/class/leds/vibrator/seq", "0x00 0x03" }, - { "/sys/class/leds/vibrator/loop", "0x00 0x00" }, - { "/sys/class/leds/vibrator/brightness", "1" }, - }}, - { Effect::TICK, { - { "/sys/class/leds/vibrator/ignore_store", "0" }, - { "/sys/class/leds/vibrator/duration", "30" }, - { "/sys/class/leds/vibrator/vmax", "0x1f" }, - { "/sys/class/leds/vibrator/gain", "0x80" }, - { "/sys/class/leds/vibrator/seq", "0x00 0x03" }, - { "/sys/class/leds/vibrator/loop", "0x00 0x00" }, - { "/sys/class/leds/vibrator/brightness", "1" }, - }}, - { Effect::HEAVY_CLICK, { - { "/sys/class/leds/vibrator/ignore_store", "0" }, - { "/sys/class/leds/vibrator/duration", "10" }, - { "/sys/class/leds/vibrator/vmax", "0x1f" }, - { "/sys/class/leds/vibrator/gain", "0x80" }, - { "/sys/class/leds/vibrator/seq", "0x00 0x03" }, - { "/sys/class/leds/vibrator/loop", "0x00 0x00" }, - { "/sys/class/leds/vibrator/brightness", "1" }, - }} -}; - -InputFFDevice::InputFFDevice() -{ - DIR *dp; - FILE *fp = NULL; - struct dirent *dir; - uint8_t ffBitmask[FF_CNT / 8]; - char devicename[PATH_MAX]; - const char *INPUT_DIR = "/dev/input/"; - char name[NAME_BUF_SIZE]; - int fd, ret; - int soc = property_get_int32("ro.vendor.qti.soc_id", -1); - - mVibraFd = INVALID_VALUE; - mSupportGain = false; - mSupportEffects = false; - mSupportExternalControl = false; - mCurrAppId = INVALID_VALUE; - mCurrMagnitude = 0x7fff; - mInExternalControl = false; - - dp = opendir(INPUT_DIR); - if (!dp) { - ALOGE("open %s failed, errno = %d", INPUT_DIR, errno); - return; - } - - memset(ffBitmask, 0, sizeof(ffBitmask)); - while ((dir = readdir(dp)) != NULL){ - if (dir->d_name[0] == '.' && - (dir->d_name[1] == '\0' || - (dir->d_name[1] == '.' && dir->d_name[2] == '\0'))) - continue; - - snprintf(devicename, PATH_MAX, "%s%s", INPUT_DIR, dir->d_name); - fd = TEMP_FAILURE_RETRY(open(devicename, O_RDWR)); - if (fd < 0) { - ALOGE("open %s failed, errno = %d", devicename, errno); - continue; - } - - ret = TEMP_FAILURE_RETRY(ioctl(fd, EVIOCGNAME(sizeof(name)), name)); - if (ret == -1) { - ALOGE("get input device name %s failed, errno = %d\n", devicename, errno); - close(fd); - continue; - } - - if (strcmp(name, "qcom-hv-haptics") && strcmp(name, "qti-haptics")) { - ALOGD("not a qcom/qti haptics device\n"); - close(fd); - continue; - } - - ALOGI("%s is detected at %s\n", name, devicename); - ret = TEMP_FAILURE_RETRY(ioctl(fd, EVIOCGBIT(EV_FF, sizeof(ffBitmask)), ffBitmask)); - if (ret == -1) { - ALOGE("ioctl failed, errno = %d", errno); - close(fd); - continue; - } - - if (test_bit(FF_CONSTANT, ffBitmask) || - test_bit(FF_PERIODIC, ffBitmask)) { - mVibraFd = fd; - if (test_bit(FF_CUSTOM, ffBitmask)) - mSupportEffects = true; - if (test_bit(FF_GAIN, ffBitmask)) - mSupportGain = true; - - if (soc <= 0 && (fp = fopen("/sys/devices/soc0/soc_id", "r")) != NULL) { - fscanf(fp, "%u", &soc); - fclose(fp); - } - switch (soc) { - case MSM_CPU_LAHAINA: - case APQ_CPU_LAHAINA: - case MSM_CPU_SHIMA: - case MSM_CPU_SM8325: - case APQ_CPU_SM8325P: - case MSM_CPU_YUPIK: - mSupportExternalControl = true; - break; - default: - mSupportExternalControl = false; - break; - } - break; - } - - close(fd); - } - - closedir(dp); -} - -/** Play vibration - * - * @param effectId: ID of the predefined effect will be played. If effectId is valid - * (non-negative value), the timeoutMs value will be ignored, and the - * real playing length will be set in param@playLengtMs and returned - * to VibratorService. If effectId is invalid, value in param@timeoutMs - * will be used as the play length for playing a constant effect. - * @param timeoutMs: playing length, non-zero means playing, zero means stop playing. - * @param playLengthMs: the playing length in ms unit which will be returned to - * VibratorService if the request is playing a predefined effect. - * The custom_data in periodic is reused for returning the playLengthMs - * from kernel space to userspace if the pattern is defined in kernel - * driver. It's been defined with following format: - * <effect-ID, play-time-in-seconds, play-time-in-milliseconds>. - * The effect-ID is used for passing down the predefined effect to - * kernel driver, and the rest two parameters are used for returning - * back the real playing length from kernel driver. - */ -int InputFFDevice::play(int effectId, uint32_t timeoutMs, long *playLengthMs) { - struct ff_effect effect; - struct input_event play; - int16_t data[CUSTOM_DATA_LEN] = {0, 0, 0}; - int ret; -#ifdef USE_EFFECT_STREAM - const struct effect_stream *stream; -#endif - - /* For QMAA compliance, return OK even if vibrator device doesn't exist */ - if (mVibraFd == INVALID_VALUE) { - if (playLengthMs != NULL) - *playLengthMs = 0; - return 0; - } - - if (timeoutMs != 0) { - if (mCurrAppId != INVALID_VALUE) { - ret = TEMP_FAILURE_RETRY(ioctl(mVibraFd, EVIOCRMFF, mCurrAppId)); - if (ret == -1) { - ALOGE("ioctl EVIOCRMFF failed, errno = %d", -errno); - goto errout; - } - mCurrAppId = INVALID_VALUE; - } - - memset(&effect, 0, sizeof(effect)); - if (effectId != INVALID_VALUE) { - data[0] = effectId; - effect.type = FF_PERIODIC; - effect.u.periodic.waveform = FF_CUSTOM; - effect.u.periodic.magnitude = mCurrMagnitude; - effect.u.periodic.custom_data = data; - effect.u.periodic.custom_len = sizeof(int16_t) * CUSTOM_DATA_LEN; -#ifdef USE_EFFECT_STREAM - stream = get_effect_stream(effectId); - if (stream != NULL) { - effect.u.periodic.custom_data = (int16_t *)stream; - effect.u.periodic.custom_len = sizeof(*stream); - } -#endif - } else { - effect.type = FF_CONSTANT; - effect.u.constant.level = mCurrMagnitude; - effect.replay.length = timeoutMs; - } - - effect.id = mCurrAppId; - effect.replay.delay = 0; - - ret = TEMP_FAILURE_RETRY(ioctl(mVibraFd, EVIOCSFF, &effect)); - if (ret == -1) { - ALOGE("ioctl EVIOCSFF failed, errno = %d", -errno); - goto errout; - } - - mCurrAppId = effect.id; - if (effectId != INVALID_VALUE && playLengthMs != NULL) { - *playLengthMs = data[1] * 1000 + data[2]; -#ifdef USE_EFFECT_STREAM - if (stream != NULL && stream->play_rate_hz != 0) - *playLengthMs = ((stream->length * 1000) / stream->play_rate_hz) + 1; -#endif - } - - play.value = 1; - play.type = EV_FF; - play.code = mCurrAppId; - play.time.tv_sec = 0; - play.time.tv_usec = 0; - ret = TEMP_FAILURE_RETRY(write(mVibraFd, (const void*)&play, sizeof(play))); - if (ret == -1) { - ALOGE("write failed, errno = %d\n", -errno); - ret = TEMP_FAILURE_RETRY(ioctl(mVibraFd, EVIOCRMFF, mCurrAppId)); - if (ret == -1) - ALOGE("ioctl EVIOCRMFF failed, errno = %d", -errno); - goto errout; - } - } else if (mCurrAppId != INVALID_VALUE) { - ret = TEMP_FAILURE_RETRY(ioctl(mVibraFd, EVIOCRMFF, mCurrAppId)); - if (ret == -1) { - ALOGE("ioctl EVIOCRMFF failed, errno = %d", -errno); - goto errout; - } - mCurrAppId = INVALID_VALUE; - } - return 0; - -errout: - mCurrAppId = INVALID_VALUE; - return ret; -} - -int InputFFDevice::on(int32_t timeoutMs) { - return play(INVALID_VALUE, timeoutMs, NULL); -} - -int InputFFDevice::off() { - return play(INVALID_VALUE, 0, NULL); -} - -int InputFFDevice::setAmplitude(uint8_t amplitude) { - int tmp, ret; - struct input_event ie; - - /* For QMAA compliance, return OK even if vibrator device doesn't exist */ - if (mVibraFd == INVALID_VALUE) - return 0; - - tmp = amplitude * (STRONG_MAGNITUDE - LIGHT_MAGNITUDE) / 255; - tmp += LIGHT_MAGNITUDE; - ie.type = EV_FF; - ie.code = FF_GAIN; - ie.value = tmp; - - ret = TEMP_FAILURE_RETRY(write(mVibraFd, &ie, sizeof(ie))); - if (ret == -1) { - ALOGE("write FF_GAIN failed, errno = %d", -errno); - return ret; - } - - mCurrMagnitude = tmp; - return 0; -} - -int InputFFDevice::playEffect(int effectId, EffectStrength es, long *playLengthMs) { - switch (es) { - case EffectStrength::LIGHT: - mCurrMagnitude = LIGHT_MAGNITUDE; - break; - case EffectStrength::MEDIUM: - mCurrMagnitude = MEDIUM_MAGNITUDE; - break; - case EffectStrength::STRONG: - mCurrMagnitude = STRONG_MAGNITUDE; - break; - default: - return -1; - } - - return play(effectId, INVALID_VALUE, playLengthMs); -} - -LedVibratorDevice::LedVibratorDevice() { - char devicename[PATH_MAX]; - int fd; - - mDetected = false; - - snprintf(devicename, sizeof(devicename), "%s/%s", LED_DEVICE, "activate"); - fd = TEMP_FAILURE_RETRY(open(devicename, O_RDWR)); - if (fd < 0) { - ALOGE("open %s failed, errno = %d", devicename, errno); - return; - } - - mDetected = true; -} - -int LedVibratorDevice::write_value(const char *file, const char *value) { - int fd; - int ret; - - fd = TEMP_FAILURE_RETRY(open(file, O_WRONLY)); - if (fd < 0) { - ALOGE("open %s failed, errno = %d", file, errno); - return -errno; - } - - ret = TEMP_FAILURE_RETRY(write(fd, value, strlen(value) + 1)); - if (ret == -1) { - ret = -errno; - } else if (ret != strlen(value) + 1) { - /* even though EAGAIN is an errno value that could be set - by write() in some cases, none of them apply here. So, this return - value can be clearly identified when debugging and suggests the - caller that it may try to call vibrator_on() again */ - ret = -EAGAIN; - } else { - ret = 0; - } - - errno = 0; - close(fd); - - return ret; -} - -int LedVibratorDevice::on(int32_t timeoutMs) { - char file[PATH_MAX]; - char value[32]; - int ret; - - snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "state"); - ret = write_value(file, "1"); - if (ret < 0) - goto error; - - snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "duration"); - snprintf(value, sizeof(value), "%u\n", timeoutMs); - ret = write_value(file, value); - if (ret < 0) - goto error; - - snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "activate"); - ret = write_value(file, "1"); - if (ret < 0) - goto error; - - return 0; - -error: - ALOGE("Failed to turn on vibrator ret: %d\n", ret); - return ret; -} - -int LedVibratorDevice::off() -{ - char file[PATH_MAX]; - int ret; - - snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "activate"); - ret = write_value(file, "0"); - return ret; -} - -ndk::ScopedAStatus Vibrator::getCapabilities(int32_t* _aidl_return) { - *_aidl_return = IVibrator::CAP_ON_CALLBACK; - - if (ledVib.mDetected) { - *_aidl_return |= IVibrator::CAP_PERFORM_CALLBACK; - ALOGD("QTI Vibrator reporting capabilities: %d", *_aidl_return); - return ndk::ScopedAStatus::ok(); - } - - if (ff.mSupportGain) - *_aidl_return |= IVibrator::CAP_AMPLITUDE_CONTROL; - if (ff.mSupportEffects) - *_aidl_return |= IVibrator::CAP_PERFORM_CALLBACK; - if (ff.mSupportExternalControl) - *_aidl_return |= IVibrator::CAP_EXTERNAL_CONTROL; - - ALOGD("QTI Vibrator reporting capabilities: %d", *_aidl_return); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::off() { - int ret; - - ALOGD("QTI Vibrator off"); - if (ledVib.mDetected) - ret = ledVib.off(); - else - ret = ff.off(); - if (ret != 0) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC)); - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::on(int32_t timeoutMs, - const std::shared_ptr<IVibratorCallback>& callback) { - int ret; - - ALOGD("Vibrator on for timeoutMs: %d", timeoutMs); - if (ledVib.mDetected) - ret = ledVib.on(timeoutMs); - else - ret = ff.on(timeoutMs); - - if (ret != 0) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC)); - - if (callback != nullptr) { - std::thread([=] { - ALOGD("Starting on on another thread"); - usleep(timeoutMs * 1000); - ALOGD("Notifying on complete"); - if (!callback->onComplete().isOk()) { - ALOGE("Failed to call onComplete"); - } - }).detach(); - } - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es, const std::shared_ptr<IVibratorCallback>& callback, int32_t* _aidl_return) { - long playLengthMs; - int ret; - - ALOGD("Vibrator perform effect %d", effect); - - if (ledVib.mDetected) { - if (const auto it = LED_EFFECTS.find(effect); it != LED_EFFECTS.end()) { - for (const auto &[path, value] : it->second) { - if (path == "SLEEP") { - usleep(atoi(value.c_str()) * 1000); - } else { - ledVib.write_value(path.c_str(), value.c_str()); - } - } - - // Restore gain from persist prop - char gain[PROPERTY_VALUE_MAX]{}; - property_get("persist.vendor.vib.gain", gain, "0x55"); - ledVib.write_value("/sys/class/leds/vibrator/gain", gain); - - // Return magic value for play length so that we won't end up calling on() / off() - playLengthMs = 150; - } else { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - } - } else { - if (effect < Effect::CLICK || - effect > Effect::HEAVY_CLICK) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - - if (es != EffectStrength::LIGHT && es != EffectStrength::MEDIUM && - es != EffectStrength::STRONG) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - - ret = ff.playEffect((static_cast<int>(effect)), es, &playLengthMs); - if (ret != 0) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC)); - } - - if (callback != nullptr) { - std::thread([=] { - ALOGD("Starting perform on another thread"); - usleep(playLengthMs * 1000); - ALOGD("Notifying perform complete"); - callback->onComplete(); - }).detach(); - } - - *_aidl_return = playLengthMs; - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::getSupportedEffects(std::vector<Effect>* _aidl_return) { - if (ledVib.mDetected) { - *_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK, Effect::HEAVY_CLICK}; - } else { - *_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK, Effect::THUD, - Effect::POP, Effect::HEAVY_CLICK}; - } - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::setAmplitude(float amplitude) { - uint8_t tmp; - int ret; - - if (ledVib.mDetected) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - - ALOGD("Vibrator set amplitude: %f", amplitude); - - if (amplitude <= 0.0f || amplitude > 1.0f) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_ARGUMENT)); - - if (ff.mInExternalControl) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - - tmp = (uint8_t)(amplitude * 0xff); - ret = ff.setAmplitude(tmp); - if (ret != 0) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC)); - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::setExternalControl(bool enabled) { - if (ledVib.mDetected) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - - ALOGD("Vibrator set external control: %d", enabled); - if (!ff.mSupportExternalControl) - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); - - ff.mInExternalControl = enabled; - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Vibrator::getCompositionDelayMax(int32_t* maxDelayMs __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::getCompositionSizeMax(int32_t* maxSize __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::getSupportedPrimitives(std::vector<CompositePrimitive>* supported __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::getPrimitiveDuration(CompositePrimitive primitive __unused, - int32_t* durationMs __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect>& composite __unused, - const std::shared_ptr<IVibratorCallback>& callback __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::getSupportedAlwaysOnEffects(std::vector<Effect>* _aidl_return __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::alwaysOnEnable(int32_t id __unused, Effect effect __unused, - EffectStrength strength __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -ndk::ScopedAStatus Vibrator::alwaysOnDisable(int32_t id __unused) { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION)); -} - -} // namespace vibrator -} // namespace hardware -} // namespace android -} // namespace aidl - diff --git a/aidl/vibrator/include/Vibrator.h b/aidl/vibrator/include/Vibrator.h deleted file mode 100644 index 826261b8..00000000 --- a/aidl/vibrator/include/Vibrator.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2018,2020, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#pragma once - -#include <aidl/android/hardware/vibrator/BnVibrator.h> - -namespace aidl { -namespace android { -namespace hardware { -namespace vibrator { - -class InputFFDevice { -public: - InputFFDevice(); - int playEffect(int effectId, EffectStrength es, long *playLengthMs); - int on(int32_t timeoutMs); - int off(); - int setAmplitude(uint8_t amplitude); - bool mSupportGain; - bool mSupportEffects; - bool mSupportExternalControl; - bool mInExternalControl; -private: - int play(int effectId, uint32_t timeoutMs, long *playLengthMs); - int mVibraFd; - int16_t mCurrAppId; - int16_t mCurrMagnitude; -}; - -class LedVibratorDevice { -public: - LedVibratorDevice(); - int on(int32_t timeoutMs); - int off(); - bool mDetected; - int write_value(const char *file, const char *value); -}; - -class Vibrator : public BnVibrator { -public: - class InputFFDevice ff; - class LedVibratorDevice ledVib; - ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override; - ndk::ScopedAStatus off() override; - ndk::ScopedAStatus on(int32_t timeoutMs, - const std::shared_ptr<IVibratorCallback>& callback) override; - ndk::ScopedAStatus perform(Effect effect, EffectStrength strength, - const std::shared_ptr<IVibratorCallback>& callback, - int32_t* _aidl_return) override; - ndk::ScopedAStatus getSupportedEffects(std::vector<Effect>* _aidl_return) override; - ndk::ScopedAStatus setAmplitude(float amplitude) override; - ndk::ScopedAStatus setExternalControl(bool enabled) override; - ndk::ScopedAStatus getCompositionDelayMax(int32_t* maxDelayMs); - ndk::ScopedAStatus getCompositionSizeMax(int32_t* maxSize); - ndk::ScopedAStatus getSupportedPrimitives(std::vector<CompositePrimitive>* supported) override; - ndk::ScopedAStatus getPrimitiveDuration(CompositePrimitive primitive, - int32_t* durationMs) override; - ndk::ScopedAStatus compose(const std::vector<CompositeEffect>& composite, - const std::shared_ptr<IVibratorCallback>& callback) override; - ndk::ScopedAStatus getSupportedAlwaysOnEffects(std::vector<Effect>* _aidl_return) override; - ndk::ScopedAStatus alwaysOnEnable(int32_t id, Effect effect, EffectStrength strength) override; - ndk::ScopedAStatus alwaysOnDisable(int32_t id) override; -}; - -} // namespace vibrator -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/aidl/vibrator/service.cpp b/aidl/vibrator/service.cpp deleted file mode 100644 index 4fe3118e..00000000 --- a/aidl/vibrator/service.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2020, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#define LOG_TAG "vendor.qti.hardware.vibrator.service" - -#include <android-base/logging.h> -#include <android/binder_manager.h> -#include <android/binder_process.h> - -#include "Vibrator.h" - -using aidl::android::hardware::vibrator::Vibrator; - -int main() { - ABinderProcess_setThreadPoolMaxThreadCount(0); - std::shared_ptr<Vibrator> vib = ndk::SharedRefBase::make<Vibrator>(); - - const std::string instance = std::string() + Vibrator::descriptor + "/default"; - binder_status_t status = AServiceManager_addService(vib->asBinder().get(), instance.c_str()); - CHECK(status == STATUS_OK); - - ABinderProcess_joinThreadPool(); - return EXIT_FAILURE; // should not reach -} diff --git a/aidl/vibrator/vendor.qti.hardware.vibrator.service.oneplus.rc b/aidl/vibrator/vendor.qti.hardware.vibrator.service.oneplus.rc deleted file mode 100644 index 3f894396..00000000 --- a/aidl/vibrator/vendor.qti.hardware.vibrator.service.oneplus.rc +++ /dev/null @@ -1,4 +0,0 @@ -service vendor.qti.vibrator /vendor/bin/hw/vendor.qti.hardware.vibrator.service.oneplus - class hal - user system - group system input diff --git a/aidl/vibrator/vendor.qti.hardware.vibrator.service.oneplus.xml b/aidl/vibrator/vendor.qti.hardware.vibrator.service.oneplus.xml deleted file mode 100644 index df29ada4..00000000 --- a/aidl/vibrator/vendor.qti.hardware.vibrator.service.oneplus.xml +++ /dev/null @@ -1,33 +0,0 @@ -<!-- Copyright (c) 2020 The Linux Foundation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - * Neither the name of The Linux Foundation nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> -<manifest version="1.0" type="device"> - <hal format="aidl"> - <name>android.hardware.vibrator</name> - <fqname>IVibrator/default</fqname> - </hal> -</manifest> diff --git a/audio_amplifier/Android.mk b/audio_amplifier/Android.mk deleted file mode 100644 index f176077b..00000000 --- a/audio_amplifier/Android.mk +++ /dev/null @@ -1,48 +0,0 @@ -# -# Copyright 2020-2021 The LineageOS Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -LOCAL_PATH := $(call my-dir) - -ifeq ($(strip $(AUDIO_FEATURE_ENABLED_EXT_AMPLIFIER)),true) - -include $(CLEAR_VARS) - -LOCAL_MODULE := audio_amplifier.$(TARGET_BOARD_PLATFORM) -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_SRC_FILES := audio_amplifier.c -LOCAL_VENDOR_MODULE := true - -LOCAL_C_INCLUDES += \ - $(call include-path-for, audio-route) \ - $(call include-path-for, audio-utils) \ - $(call project-path-for, qcom-audio)/hal \ - $(call project-path-for, qcom-audio)/hal/audio_extn \ - $(call project-path-for, qcom-audio)/hal/msm8974 \ - external/tinycompress/include - -LOCAL_HEADER_LIBRARIES += \ - generated_kernel_headers \ - libhardware_headers - -LOCAL_SHARED_LIBRARIES += \ - audio.primary.$(TARGET_BOARD_PLATFORM) \ - libcutils \ - liblog \ - libtinyalsa - -include $(BUILD_SHARED_LIBRARY) - -endif diff --git a/audio_amplifier/audio_amplifier.c b/audio_amplifier/audio_amplifier.c deleted file mode 100644 index e92a71c0..00000000 --- a/audio_amplifier/audio_amplifier.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (C) 2015 The CyanogenMod Project - * Copyright (C) 2020 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "audio_amplifier" -//#define LOG_NDEBUG 0 - -#include <cutils/str_parms.h> -#include <hardware/audio_amplifier.h> -#include <hardware/hardware.h> -#include <log/log.h> -#include <stdint.h> -#include <stdlib.h> -#include <sys/types.h> - -/* clang-format off */ -#include "audio_hw.h" -#include "platform.h" -#include "platform_api.h" -/* clang-format on */ - -#define UNUSED __attribute__((unused)) - -typedef struct amp_device { - amplifier_device_t amp_dev; - struct audio_device* adev; - struct audio_usecase* usecase_tx; - struct pcm* tfa98xx_out; -} tfa_t; - -static tfa_t* tfa_dev = NULL; - -static int is_speaker(uint32_t snd_device) { - int speaker = 0; - switch (snd_device) { - case SND_DEVICE_OUT_SPEAKER: - case SND_DEVICE_OUT_SPEAKER_REVERSE: - case SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES: - case SND_DEVICE_OUT_VOICE_SPEAKER: - case SND_DEVICE_OUT_VOICE_SPEAKER_2: - case SND_DEVICE_OUT_SPEAKER_AND_HDMI: - case SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET: - case SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET: - speaker = 1; - break; - } - - return speaker; -} - -int tfa98xx_start_feedback(void* adev, uint32_t snd_device) { - tfa_dev->adev = (struct audio_device*)adev; - int pcm_dev_tx_id = 0, rc = 0; - struct pcm_config pcm_config_tfa98xx = { - .channels = 2, - .rate = 48000, - .period_size = 256, - .period_count = 4, - .format = PCM_FORMAT_S16_LE, - .start_threshold = 0, - .stop_threshold = INT_MAX, - .silence_threshold = 0, - }; - - if (!tfa_dev) { - ALOGE("%d: Invalid params", __LINE__); - return -EINVAL; - } - - if (tfa_dev->tfa98xx_out || !is_speaker(snd_device)) return 0; - - tfa_dev->usecase_tx = (struct audio_usecase*)calloc(1, sizeof(struct audio_usecase)); - if (!tfa_dev->usecase_tx) { - ALOGE("%d: failed to allocate usecase", __LINE__); - return -ENOMEM; - } - tfa_dev->usecase_tx->id = USECASE_AUDIO_SPKR_CALIB_TX; - tfa_dev->usecase_tx->type = PCM_CAPTURE; - tfa_dev->usecase_tx->in_snd_device = SND_DEVICE_IN_CAPTURE_VI_FEEDBACK; -#if __has_include("device_utils.h") - list_init(&tfa_dev->usecase_tx->device_list); -#endif - - list_add_tail(&tfa_dev->adev->usecase_list, &tfa_dev->usecase_tx->list); - enable_snd_device(tfa_dev->adev, tfa_dev->usecase_tx->in_snd_device); - enable_audio_route(tfa_dev->adev, tfa_dev->usecase_tx); - - pcm_dev_tx_id = platform_get_pcm_device_id(tfa_dev->usecase_tx->id, tfa_dev->usecase_tx->type); - ALOGD("pcm_dev_tx_id = %d", pcm_dev_tx_id); - if (pcm_dev_tx_id < 0) { - ALOGE("%d: Invalid pcm device for usecase (%d)", __LINE__, tfa_dev->usecase_tx->id); - rc = -ENODEV; - goto error; - } - - tfa_dev->tfa98xx_out = - pcm_open(tfa_dev->adev->snd_card, pcm_dev_tx_id, PCM_IN, &pcm_config_tfa98xx); - if (!(tfa_dev->tfa98xx_out || pcm_is_ready(tfa_dev->tfa98xx_out))) { - ALOGE("%d: %s", __LINE__, pcm_get_error(tfa_dev->tfa98xx_out)); - rc = -EIO; - goto error; - } - - rc = pcm_start(tfa_dev->tfa98xx_out); - if (rc < 0) { - ALOGE("%d: pcm start for TX failed", __LINE__); - rc = -EINVAL; - goto error; - } - return 0; - -error: - ALOGE("%s: error case", __func__); - if (tfa_dev->tfa98xx_out != 0) { - pcm_close(tfa_dev->tfa98xx_out); - tfa_dev->tfa98xx_out = NULL; - } - list_remove(&tfa_dev->usecase_tx->list); - disable_snd_device(tfa_dev->adev, tfa_dev->usecase_tx->in_snd_device); - disable_audio_route(tfa_dev->adev, tfa_dev->usecase_tx); - free(tfa_dev->usecase_tx); - - return rc; -} - -void tfa98xx_stop_feedback(void* adev, uint32_t snd_device) { - tfa_dev->adev = (struct audio_device*)adev; - if (!tfa_dev) { - ALOGE("%s: Invalid params", __func__); - return; - } - - if (!is_speaker(snd_device)) return; - - if (tfa_dev->tfa98xx_out) { - pcm_close(tfa_dev->tfa98xx_out); - tfa_dev->tfa98xx_out = NULL; - } - - disable_snd_device(tfa_dev->adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK); - - tfa_dev->usecase_tx = get_usecase_from_list(tfa_dev->adev, USECASE_AUDIO_SPKR_CALIB_TX); - if (tfa_dev->usecase_tx) { - list_remove(&tfa_dev->usecase_tx->list); - disable_audio_route(tfa_dev->adev, tfa_dev->usecase_tx); - free(tfa_dev->usecase_tx); - } - return; -} - -static int amp_set_feedback(UNUSED amplifier_device_t* device, void* adev, uint32_t devices, - bool enable) { - tfa_dev->adev = (struct audio_device*)adev; - if (enable) { - tfa98xx_start_feedback(tfa_dev->adev, devices); - } else { - tfa98xx_stop_feedback(tfa_dev->adev, devices); - } - return 0; -} - -static int amp_dev_close(hw_device_t* device) { - tfa_t* dev = (tfa_t*)device; - if (dev) free(dev); - - return 0; -} - -static int amp_module_open(const hw_module_t* module, const char* name, hw_device_t** device) { - if (strcmp(name, AMPLIFIER_HARDWARE_INTERFACE)) { - ALOGE("%s:%d: %s does not match amplifier hardware interface name\n", __func__, __LINE__, - name); - return -ENODEV; - } - - tfa_dev = calloc(1, sizeof(tfa_t)); - if (!tfa_dev) { - ALOGE("%s:%d: Unable to allocate memory for amplifier device\n", __func__, __LINE__); - return -ENOMEM; - } - - tfa_dev->amp_dev.common.tag = HARDWARE_DEVICE_TAG; - tfa_dev->amp_dev.common.module = (hw_module_t*)module; - tfa_dev->amp_dev.common.version = HARDWARE_DEVICE_API_VERSION(1, 0); - tfa_dev->amp_dev.common.close = amp_dev_close; - - tfa_dev->amp_dev.set_input_devices = NULL; - tfa_dev->amp_dev.set_output_devices = NULL; - tfa_dev->amp_dev.enable_output_devices = NULL; - tfa_dev->amp_dev.enable_input_devices = NULL; - tfa_dev->amp_dev.set_mode = NULL; - tfa_dev->amp_dev.output_stream_start = NULL; - tfa_dev->amp_dev.input_stream_start = NULL; - tfa_dev->amp_dev.output_stream_standby = NULL; - tfa_dev->amp_dev.input_stream_standby = NULL; - tfa_dev->amp_dev.set_parameters = NULL; - tfa_dev->amp_dev.out_set_parameters = NULL; - tfa_dev->amp_dev.in_set_parameters = NULL; - tfa_dev->amp_dev.set_feedback = amp_set_feedback; - - *device = (hw_device_t*)tfa_dev; - - return 0; -} - -static struct hw_module_methods_t hal_module_methods = { - .open = amp_module_open, -}; - -/* clang-format off */ -amplifier_module_t HAL_MODULE_INFO_SYM = { - .common = { - .tag = HARDWARE_MODULE_TAG, - .module_api_version = AMPLIFIER_MODULE_API_VERSION_0_1, - .hal_api_version = HARDWARE_HAL_API_VERSION, - .id = AMPLIFIER_HARDWARE_MODULE_ID, - .name = "TFA98XX audio amplifier HAL", - .author = "The LineageOS Project", - .methods = &hal_module_methods, - }, -}; diff --git a/wifi-mac-generator/Android.bp b/wifi-mac-generator/Android.bp deleted file mode 100644 index 155af8c2..00000000 --- a/wifi-mac-generator/Android.bp +++ /dev/null @@ -1,6 +0,0 @@ -sh_binary { - name: "wifi-mac-generator", - init_rc: ["wifi-mac-generator.rc"], - src: "wifi-mac-generator.sh", - vendor: true, -} diff --git a/wifi-mac-generator/wifi-mac-generator.rc b/wifi-mac-generator/wifi-mac-generator.rc deleted file mode 100644 index 0defe7f9..00000000 --- a/wifi-mac-generator/wifi-mac-generator.rc +++ /dev/null @@ -1,9 +0,0 @@ -service vendor.wifi-mac-generator /vendor/bin/wifi-mac-generator - class main - user wifi - group wifi - oneshot - disabled - -on post-fs-data - start vendor.wifi-mac-generator diff --git a/wifi-mac-generator/wifi-mac-generator.sh b/wifi-mac-generator/wifi-mac-generator.sh deleted file mode 100644 index cb8cf0dd..00000000 --- a/wifi-mac-generator/wifi-mac-generator.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/vendor/bin/sh -WLAN_MAC_VENDOR_PREFIX="C0EEFB" -WLAN_MAC_PERSIST_PATH="/mnt/vendor/persist/wlan_mac.bin" - -function wait_for_file() { - retries=0 - - while [ ! -f "${1}" ]; do - retries=$((retries + 1)) - - if [ "${retries}" -eq 10 ]; then - return 1 - fi - - sleep 1 - done - - return 0 -} - -if [[ ! -f "${WLAN_MAC_PERSIST_PATH}" ]] || [[ ! -s "${WLAN_MAC_PERSIST_PATH}" ]]; then - MAC_0_PATH="/data/vendor/oemnvitems/4678_0" - - if ! wait_for_file "${MAC_0_PATH}"; then - MAC_0="${WLAN_MAC_VENDOR_PREFIX}`xxd -l 3 -p /dev/urandom | tr '[:lower:]' '[:upper:]'`" - else - MAC_0=`xxd -p "${MAC_0_PATH}" | grep -o '..' | tac | tr -d '\n' | tr '[:lower:]' '[:upper:]'` - fi - - MAC_1_PATH="/data/vendor/oemnvitems/4678_1" - - if ! wait_for_file "${MAC_1_PATH}"; then - MAC_1="${WLAN_MAC_VENDOR_PREFIX}`xxd -l 3 -p /dev/urandom | tr '[:lower:]' '[:upper:]'`" - else - MAC_1=`xxd -p "${MAC_1_PATH}" | grep -o '..' | tac | tr -d '\n' | tr '[:lower:]' '[:upper:]'` - fi - - echo "Intf0MacAddress=${MAC_0}" > "${WLAN_MAC_PERSIST_PATH}" - echo "Intf1MacAddress=${MAC_1}" >> "${WLAN_MAC_PERSIST_PATH}" - echo "Intf2MacAddress=000AF58989FD" >> "${WLAN_MAC_PERSIST_PATH}" - echo "Intf3MacAddress=000AF58989FC" >> "${WLAN_MAC_PERSIST_PATH}" - echo "END" >> "${WLAN_MAC_PERSIST_PATH}" -fi |
