This is a partial revert of c31482154b
Change-Id: Ibba1b588ee5836e8f51dfdb96231da66d7f3b09a
urubino-microg
parent
b376f715ea
commit
805dbb836a
@ -0,0 +1,30 @@ |
|||||||
|
// |
||||||
|
// Copyright (C) 2023 The Android Open Source 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. |
||||||
|
|
||||||
|
cc_binary { |
||||||
|
name: "audio_parameter_service.samsung_sm7125", |
||||||
|
init_rc: ["audio_parameter_service.rc"], |
||||||
|
system_ext_specific: true, |
||||||
|
srcs: [ |
||||||
|
"audio_parameter_service.cpp", |
||||||
|
], |
||||||
|
shared_libs: [ |
||||||
|
"libbase", |
||||||
|
"libutils", |
||||||
|
"libhidlbase", |
||||||
|
"liblog", |
||||||
|
"android.hardware.audio@7.0", |
||||||
|
], |
||||||
|
} |
@ -0,0 +1,58 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <android-base/properties.h> |
||||||
|
#include <android-base/logging.h> |
||||||
|
#include <android/hardware/audio/7.0/IDevicesFactory.h> |
||||||
|
|
||||||
|
using android::base::GetProperty; |
||||||
|
using android::base::SetProperty; |
||||||
|
using android::sp; |
||||||
|
using ::android::hardware::hidl_string; |
||||||
|
|
||||||
|
int main() { |
||||||
|
sp<::android::hardware::audio::V7_0::IDevice> audioDevice; |
||||||
|
|
||||||
|
LOG(DEBUG) << "Passing g_call_sim_slot parameter"; |
||||||
|
|
||||||
|
if (!audioDevice) { |
||||||
|
::android::hardware::audio::V7_0::IDevicesFactory::getService()->openDevice( |
||||||
|
"primary", [&](::android::hardware::audio::V7_0::Result, const sp<::android::hardware::audio::V7_0::IDevice>& result) { |
||||||
|
audioDevice = result; |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
if (audioDevice != nullptr) { |
||||||
|
std::string value = ""; |
||||||
|
|
||||||
|
if (strcmp(GetProperty("vendor.calls.slotid", "-1").c_str(), "0") == 0) { |
||||||
|
// SIM 1
|
||||||
|
value = "0x01"; |
||||||
|
} else if (strcmp(GetProperty("vendor.calls.slotid", "-1").c_str(), "1") == 0) { |
||||||
|
// SIM 2
|
||||||
|
value = "0x02"; |
||||||
|
} |
||||||
|
|
||||||
|
audioDevice->setParameters({}, {{"g_call_sim_slot", value}}); |
||||||
|
} |
||||||
|
|
||||||
|
if (audioDevice != nullptr) |
||||||
|
audioDevice->close(); |
||||||
|
|
||||||
|
SetProperty("vendor.calls.parameter_state", "1"); |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
service audio_parameter_service /system_ext/bin/audio_parameter_service.samsung_sm7125 |
||||||
|
oneshot |
||||||
|
disabled |
||||||
|
|
||||||
|
on boot |
||||||
|
setprop vendor.calls.parameter_state 0 |
||||||
|
|
||||||
|
on property:vendor.calls.slotid=0 && property:vendor.calls.parameter_state=0 |
||||||
|
stop audioserver |
||||||
|
start audioserver |
||||||
|
start audio_parameter_service |
||||||
|
|
||||||
|
on property:vendor.calls.slotid=1 && property:vendor.calls.parameter_state=0 |
||||||
|
stop audioserver |
||||||
|
start audioserver |
||||||
|
start audio_parameter_service |
||||||
|
|
||||||
|
on property:vendor.calls.slotid=-1 && property:vendor.calls.parameter_state=1 |
||||||
|
setprop vendor.calls.parameter_state 0 |
@ -0,0 +1,9 @@ |
|||||||
|
type audio_parameter_service, domain, coredomain; |
||||||
|
type audio_parameter_service_exec, system_file_type, exec_type, file_type; |
||||||
|
|
||||||
|
init_daemon_domain(audio_parameter_service) |
||||||
|
|
||||||
|
hal_client_domain(audio_parameter_service, hal_audio) |
||||||
|
|
||||||
|
get_prop(audio_parameter_service, vendor_call_prop) |
||||||
|
set_prop(audio_parameter_service, vendor_call_prop) |
@ -0,0 +1 @@ |
|||||||
|
/(system_ext|system/system_ext)/bin/audio_parameter_service.samsung_sm7125 u:object_r:audio_parameter_service_exec:s0 |
@ -0,0 +1 @@ |
|||||||
|
system_public_prop(vendor_call_prop) |
Loading…
Reference in new issue