mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 20:45:31 -04:00
universal7885: fm-aidl: Fixups
- libfileio: Move back to liblog. - FMDevCtrl: Add some loggings - FM-app: Call open() before set(apppid)
This commit is contained in:
parent
954d50f9b4
commit
5c7c906519
4 changed files with 26 additions and 12 deletions
|
|
@ -12,11 +12,15 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define LOG_TAG "FMHAL-DevControl"
|
||||
|
||||
#include "FMDevControl.h"
|
||||
|
||||
#include <fm_slsi-impl.h>
|
||||
#include <LogFormat.h>
|
||||
|
||||
#include <android/binder_manager.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cerrno>
|
||||
|
|
@ -39,6 +43,7 @@ namespace aidl::vendor::eureka::hardware::fmradio {
|
|||
}
|
||||
|
||||
::ndk::ScopedAStatus FMDevControl::getValue(GetType type, int *_aidl_return) {
|
||||
ALOGD(make_str("%s: type %d", __func__, type));
|
||||
if (type != GetType::GET_TYPE_FM_MUTEX_LOCKED) {
|
||||
RETURN_IF_FAILED_LOCK;
|
||||
}
|
||||
|
|
@ -92,12 +97,16 @@ namespace aidl::vendor::eureka::hardware::fmradio {
|
|||
if (type != GetType::GET_TYPE_FM_MUTEX_LOCKED) {
|
||||
lock.unlock();
|
||||
}
|
||||
ALOGD(make_str("%s: returning %d", __func__, *_aidl_return));
|
||||
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
::ndk::ScopedAStatus FMDevControl::setValue(SetType type, int value) {
|
||||
using audio_route::IAudioRoute;
|
||||
|
||||
ALOGD(make_str("%s: type %d, value %d", __func__, type, value));
|
||||
|
||||
RETURN_IF_FAILED_LOCK;
|
||||
assert(fd > 0);
|
||||
switch (type) {
|
||||
|
|
@ -122,7 +131,7 @@ namespace aidl::vendor::eureka::hardware::fmradio {
|
|||
fm_radio_slsi::stop_search(fd);
|
||||
break;
|
||||
case SetType::SET_TYPE_FM_SPEAKER_ROUTE:
|
||||
std::shared_ptr<IAudioRoute> svc = IAudioRoute::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService("vendor.eureka.hardware.audio_route.IAudioRoute/default")));
|
||||
auto svc = IAudioRoute::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService("vendor.eureka.hardware.audio_route.IAudioRoute/default")));
|
||||
svc->setParam(value ? "routing=2": "routing=8");
|
||||
break;
|
||||
case SetType::SET_TYPE_FM_SEARCH_START:
|
||||
|
|
@ -135,16 +144,19 @@ namespace aidl::vendor::eureka::hardware::fmradio {
|
|||
break;
|
||||
case SetType::SET_TYPE_FM_APP_PID:
|
||||
client_observe_thread = std::thread([=] {
|
||||
std::shared_ptr<IAudioRoute> svc;
|
||||
pid_t pid = value;
|
||||
|
||||
ALOGD(make_str("%s: FM_APP_PID: recieved value %d", __func__, pid));
|
||||
|
||||
while (true) {
|
||||
if (kill(pid, 0) < 0 && errno == ESRCH) break;
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
}
|
||||
|
||||
ALOGW(make_str("%s: FM_APP_PID: Starting client death receiver", __func__));
|
||||
|
||||
fm_radio_slsi::fm_thread_set(fd, 0);
|
||||
svc = IAudioRoute::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService("vendor.eureka.hardware.audio_route.IAudioRoute/default")));
|
||||
auto svc = IAudioRoute::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService("vendor.eureka.hardware.audio_route.IAudioRoute/default")));
|
||||
svc->setParam("l_fmradio_mode=off");
|
||||
close();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue