mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 12:35:33 -04:00
universal7885: FMRadio: Remove source edit
If the AIDL hal which can be allowed to change uid calls audioflinger API to change route, we don't need to change source for it. seteuid(audioserver_uid) will work fine
This commit is contained in:
parent
4296d27bea
commit
946f4768e9
11 changed files with 27 additions and 39 deletions
|
|
@ -4,7 +4,6 @@ android_app {
|
|||
"src/**/*.kt",
|
||||
],
|
||||
platform_apis: true,
|
||||
jni_libs: ["libaudiohack"],
|
||||
certificate: "platform",
|
||||
static_libs: [
|
||||
"androidx.core_core",
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
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",
|
||||
],
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
|
@ -47,7 +47,6 @@ class MainActivity : AppCompatActivity() {
|
|||
private lateinit var mAlertImage: AppCompatImageView
|
||||
private lateinit var mAudioManager: AudioManager
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
System.loadLibrary("audiohack")
|
||||
MainFragment.fd = mFMInterface.openFMDevice()
|
||||
mAlertView = (getSystemService(LAYOUT_INFLATER_SERVICE) as LayoutInflater)
|
||||
.inflate(R.layout.alertdialog, null)
|
||||
|
|
|
|||
|
|
@ -37,5 +37,5 @@ class NativeFMInterface {
|
|||
fun setFMRSSI(a: Int, rssi: Long) = mDevCtl.setValue(SetType.SET_TYPE_FM_RMSSI, rssi.toInt())
|
||||
fun closeFMDevice(fd: Int) = mDevCtl.close()
|
||||
fun getSysfsSupport(): Boolean = mSysfsCtl.getValue(GetType.GET_TYPE_FM_SYSFS_IF) == 0
|
||||
external fun setAudioRoute(speaker: Boolean): Int
|
||||
fun setAudioRoute(speaker: Boolean) = mDevCtl.setValue(SetType.SET_TYPE_FM_SPEAKER_ROUTE, if (speaker) 1 else 0)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue