mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 04:25:33 -04:00
universal7885: fm-aidl: Rename interfaces and fix errors
This commit is contained in:
parent
839dc3ae4c
commit
6fdc377216
16 changed files with 287 additions and 61 deletions
27
universal7885-common/apps/FMRadio/jni/Android.bp
Normal file
27
universal7885-common/apps/FMRadio/jni/Android.bp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
cc_library_shared {
|
||||
name: "libaudiohack",
|
||||
cflags: [
|
||||
"-Wno-unused-parameter",
|
||||
],
|
||||
srcs: [
|
||||
"FM_AudioRoute_ctl.cpp",
|
||||
],
|
||||
defaults: ["eureka_defaults"],
|
||||
shared_libs: [
|
||||
"liblog",
|
||||
"libutils",
|
||||
"audioflinger-aidl-cpp",
|
||||
"audiopolicy-aidl-cpp",
|
||||
"audiopolicy-types-aidl-cpp",
|
||||
"libaudiofoundation",
|
||||
"libaudioutils",
|
||||
"libaudioclient",
|
||||
"libutils",
|
||||
"libaudiopolicy",
|
||||
"libaudiomanager",
|
||||
],
|
||||
header_libs: [
|
||||
"libaudioclient_headers",
|
||||
"jni_headers",
|
||||
],
|
||||
}
|
||||
38
universal7885-common/apps/FMRadio/jni/FM_AudioRoute_ctl.cpp
Normal file
38
universal7885-common/apps/FMRadio/jni/FM_AudioRoute_ctl.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright 2021 Soo Hwan Na "Royna"
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#include <jni.h>
|
||||
#include <media/AudioSystem.h>
|
||||
#include <media/IAudioFlinger.h>
|
||||
|
||||
#define FM_FAILURE (-1)
|
||||
#define FM_SUCCESS 0
|
||||
#define IOHANDLE 13
|
||||
|
||||
using namespace android;
|
||||
|
||||
extern "C" JNIEXPORT jboolean JNICALL
|
||||
Java_com_eurekateam_fmradio_NativeFMInterface_setAudioRoute(
|
||||
__unused JNIEnv *env, __unused jobject thiz, jboolean speaker) {
|
||||
const sp<IAudioFlinger> &af = AudioSystem::get_audio_flinger();
|
||||
if (af == 0)
|
||||
return PERMISSION_DENIED;
|
||||
if (speaker) {
|
||||
af->setParameters(IOHANDLE, String8("routing=2"));
|
||||
} else {
|
||||
af->setParameters(IOHANDLE, String8("routing=8"));
|
||||
}
|
||||
return FM_SUCCESS;
|
||||
}
|
||||
Loading…
Reference in a new issue