Compare commits

..

4 Commits

Author SHA1 Message Date
Simon1511 3462aad493 Revert "sm7125-common: audio: add dedicated service to pass g_call_sim_slot" 7 months ago
Simon1511 1ef977c734 sm7125-common: overlay: set phyical power button location 7 months ago
Simon1511 f964b2f115 sm7125-common: sepolicy: allow fingerprint read on sysfs_lcd_writable 7 months ago
Jenna 61fd2843d4 Build fixes for naap 7 months ago
  1. 6
      BoardConfigCommon.mk
  2. 6
      audio/impl/Android.bp
  3. 29
      audio/impl/PrimaryDevice.cpp
  4. 3
      audio/impl/include/core/default/Device.h
  5. 30
      audio/service/Android.bp
  6. 55
      audio/service/audio_parameter_service.cpp
  7. 16
      audio/service/audio_parameter_service.rc
  8. 3
      common.mk
  9. 4
      overlay/frameworks/base/packages/SystemUI/res/values/dimens.xml
  10. 8
      sepolicy/private/audio_parameter_service.te
  11. 1
      sepolicy/private/file_contexts
  12. 1
      sepolicy/public/property.te
  13. 2
      sepolicy/vendor/hal_audio_default.te
  14. 3
      sepolicy/vendor/hal_fingerprint_default.te
  15. 3
      sepolicy/vendor/property_contexts
  16. 2
      sepolicy/vendor/rild.te
  17. 1
      vendor.prop

@ -165,7 +165,7 @@ DEVICE_MANIFEST_FILE := $(COMMON_PATH)/configs/manifest.xml
DEVICE_MATRIX_FILE := $(COMMON_PATH)/configs/compatibility_matrix.xml DEVICE_MATRIX_FILE := $(COMMON_PATH)/configs/compatibility_matrix.xml
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \ DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \
$(COMMON_PATH)/configs/framework_compatibility_matrix.xml \ $(COMMON_PATH)/configs/framework_compatibility_matrix.xml \
vendor/lineage/config/device_framework_matrix.xml vendor/naap/config/device_framework_matrix.xml
# QCOM # QCOM
BOARD_USES_QCOM_HARDWARE := true BOARD_USES_QCOM_HARDWARE := true
@ -210,8 +210,8 @@ TARGET_RELEASETOOLS_EXTENSIONS := $(COMMON_PATH)/releasetools
# SePolicy # SePolicy
include device/qcom/sepolicy_vndr/SEPolicy.mk include device/qcom/sepolicy_vndr/SEPolicy.mk
BOARD_VENDOR_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/vendor BOARD_VENDOR_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/vendor
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/private PRODUCT_PRIVATE_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/private
SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/public PRODUCT_PUBLIC_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/public
# Vibrator # Vibrator
$(call soong_config_set,samsungVibratorVars,duration_amplitude,true) $(call soong_config_set,samsungVibratorVars,duration_amplitude,true)

@ -68,6 +68,7 @@ cc_library_shared {
"android.hardware.audio@2.0-util", "android.hardware.audio@2.0-util",
"android.hardware.audio.common@2.0", "android.hardware.audio.common@2.0",
"android.hardware.audio.common@2.0-util", "android.hardware.audio.common@2.0-util",
"libcutils",
], ],
cflags: [ cflags: [
"-DMAJOR_VERSION=2", "-DMAJOR_VERSION=2",
@ -85,6 +86,7 @@ cc_library_shared {
"android.hardware.audio@4.0-util", "android.hardware.audio@4.0-util",
"android.hardware.audio.common@4.0", "android.hardware.audio.common@4.0",
"android.hardware.audio.common@4.0-util", "android.hardware.audio.common@4.0-util",
"libcutils",
], ],
cflags: [ cflags: [
"-DMAJOR_VERSION=4", "-DMAJOR_VERSION=4",
@ -101,6 +103,7 @@ cc_library_shared {
"android.hardware.audio@5.0-util", "android.hardware.audio@5.0-util",
"android.hardware.audio.common@5.0", "android.hardware.audio.common@5.0",
"android.hardware.audio.common@5.0-util", "android.hardware.audio.common@5.0-util",
"libcutils",
], ],
cflags: [ cflags: [
"-DMAJOR_VERSION=5", "-DMAJOR_VERSION=5",
@ -117,6 +120,7 @@ cc_library_shared {
"android.hardware.audio@6.0-util", "android.hardware.audio@6.0-util",
"android.hardware.audio.common@6.0", "android.hardware.audio.common@6.0",
"android.hardware.audio.common@6.0-util", "android.hardware.audio.common@6.0-util",
"libcutils",
], ],
cflags: [ cflags: [
"-DMAJOR_VERSION=6", "-DMAJOR_VERSION=6",
@ -135,6 +139,7 @@ cc_library_shared {
"android.hardware.audio.common@7.0-enums", "android.hardware.audio.common@7.0-enums",
"android.hardware.audio.common@7.0-util", "android.hardware.audio.common@7.0-util",
"libbase", "libbase",
"libcutils",
], ],
cflags: [ cflags: [
"-DMAJOR_VERSION=7", "-DMAJOR_VERSION=7",
@ -154,6 +159,7 @@ cc_library_shared {
"android.hardware.audio.common@7.1-enums", "android.hardware.audio.common@7.1-enums",
"android.hardware.audio.common@7.1-util", "android.hardware.audio.common@7.1-util",
"libbase", "libbase",
"libcutils",
], ],
cflags: [ cflags: [
"-DMAJOR_VERSION=7", "-DMAJOR_VERSION=7",

@ -19,6 +19,9 @@
#include "core/default/PrimaryDevice.h" #include "core/default/PrimaryDevice.h"
#include "core/default/Util.h" #include "core/default/Util.h"
#include <cutils/properties.h>
#include <string.h>
#if MAJOR_VERSION >= 4 #if MAJOR_VERSION >= 4
#include <cmath> #include <cmath>
#endif #endif
@ -208,6 +211,32 @@ Return<Result> PrimaryDevice::setVoiceVolume(float volume) {
} }
Return<Result> PrimaryDevice::setMode(AudioMode mode) { Return<Result> PrimaryDevice::setMode(AudioMode mode) {
/* On stock ROM Samsung sets the g_call_state and g_call_sim_slot audio parameters
* in the framework, breaking it on AOSP ROMs.
* For the g_call_sim_slot parameter 0x01 describes SIM1 and 0x02 SIM2.
*/
char simSlot[92];
// These props return either -1 (not calling),
// 0 (SIM1 is calling) or 1 (SIM2 is calling)
property_get("vendor.calls.slotid", simSlot, "");
// Wait until one sim slot reports a call
if (mode == AudioMode::IN_CALL) {
while (strcmp(simSlot, "-1") == 0) {
property_get("vendor.calls.slotid", simSlot, "");
}
}
if (strcmp(simSlot, "0") == 0) {
// SIM1
mDevice->halSetParameters("g_call_sim_slot=0x01");
} else if (strcmp(simSlot, "1") == 0) {
// SIM2
mDevice->halSetParameters("g_call_sim_slot=0x02");
}
// INVALID, CURRENT, CNT, MAX are reserved for internal use. // INVALID, CURRENT, CNT, MAX are reserved for internal use.
// TODO: remove the values from the HIDL interface // TODO: remove the values from the HIDL interface
switch (mode) { switch (mode) {

@ -173,6 +173,8 @@ struct Device : public IDevice, public ParametersUtil {
uint32_t version() const { return mDevice->common.version; } uint32_t version() const { return mDevice->common.version; }
int halSetParameters(const char* keysAndValues) override;
private: private:
bool mIsClosed; bool mIsClosed;
audio_hw_device_t* mDevice; audio_hw_device_t* mDevice;
@ -191,7 +193,6 @@ struct Device : public IDevice, public ParametersUtil {
// Methods from ParametersUtil. // Methods from ParametersUtil.
char* halGetParameters(const char* keys) override; char* halGetParameters(const char* keys) override;
int halSetParameters(const char* keysAndValues) override;
}; };
} // namespace implementation } // namespace implementation

@ -1,30 +0,0 @@
//
// 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",
],
}

@ -1,55 +0,0 @@
/*
* 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(), "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;
}

@ -1,16 +0,0 @@
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=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
stop audioserver
start audioserver

@ -72,8 +72,7 @@ PRODUCT_PACKAGES += \
libqcomvisualizer \ libqcomvisualizer \
libqcomvoiceprocessing \ libqcomvoiceprocessing \
libqcompostprocbundle \ libqcompostprocbundle \
libvolumelistener \ libvolumelistener
audio_parameter_service.samsung_sm7125
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
$(COMMON_PATH)/audio/configs/audio_configs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_configs.xml \ $(COMMON_PATH)/audio/configs/audio_configs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_configs.xml \

@ -21,5 +21,9 @@
<!-- Bottom margin size when fingerprint in display is active --> <!-- Bottom margin size when fingerprint in display is active -->
<dimen name="keyguard_indication_margin_bottom">20dp</dimen> <dimen name="keyguard_indication_margin_bottom">20dp</dimen>
<!-- Location on the screen of the center of the physical power button. This is a reasonable
default that should be overridden by device-specific overlays. -->
<dimen name="physical_power_button_center_screen_location_y">980px</dimen>
</resources> </resources>

@ -1,8 +0,0 @@
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)
set_prop(audio_parameter_service, vendor_call_prop)

@ -1 +0,0 @@
/(system_ext|system/system_ext)/bin/audio_parameter_service.samsung_sm7125 u:object_r:audio_parameter_service_exec:s0

@ -1 +0,0 @@
system_public_prop(vendor_call_prop)

@ -6,4 +6,4 @@ allow hal_audio_default imei_efs_file:file { read open getattr };
allow hal_audio_default efs_file:dir search; allow hal_audio_default efs_file:dir search;
get_prop(hal_audio_default, vendor_call_prop) get_prop(hal_audio_default, vendor_radio_prop)

@ -19,3 +19,6 @@ allow hal_fingerprint_default sysfs_fingerprint:file r_file_perms;
# /data/vendor/biometrics/* # /data/vendor/biometrics/*
allow hal_fingerprint_default biometrics_vendor_data_file:file create_file_perms; allow hal_fingerprint_default biometrics_vendor_data_file:file create_file_perms;
allow hal_fingerprint_default biometrics_vendor_data_file:dir { read write open add_name create rmdir remove_name search }; allow hal_fingerprint_default biometrics_vendor_data_file:dir { read write open add_name create rmdir remove_name search };
# /sys/class/lcd/panel/
allow hal_fingerprint_default sysfs_lcd_writable:file r_file_perms;

@ -22,8 +22,7 @@ vendor.sec.rild. u:object_r:vendor_radio_prop:s0
ro.vendor.sec.radio. u:object_r:vendor_radio_prop:s0 ro.vendor.sec.radio. u:object_r:vendor_radio_prop:s0
ro.vendor.use_data_netmgrd u:object_r:vendor_radio_prop:s0 ro.vendor.use_data_netmgrd u:object_r:vendor_radio_prop:s0
ro.vendor.epdg.support u:object_r:vendor_radio_prop:s0 ro.vendor.epdg.support u:object_r:vendor_radio_prop:s0
vendor.calls u:object_r:vendor_radio_prop:s0
vendor.calls u:object_r:vendor_call_prop:s0
# Sensors # Sensors
vendor.sensor.file.permission u:object_r:vendor_sensors_prop:s0 vendor.sensor.file.permission u:object_r:vendor_sensors_prop:s0

@ -3,8 +3,6 @@
get_prop(rild, vendor_radio_prop) get_prop(rild, vendor_radio_prop)
get_prop(rild, radio_prop) get_prop(rild, radio_prop)
set_prop(rild, vendor_call_prop)
allow rild block_device:dir search; allow rild block_device:dir search;
allow rild mnt_vendor_file:dir { getattr search }; allow rild mnt_vendor_file:dir { getattr search };

@ -97,7 +97,6 @@ camera.disable_zsl_mode=1
ro.camera.notify_nfc=1 ro.camera.notify_nfc=1
# Chipset # Chipset
ro.soc.manufacturer=Qualcomm
ro.soc.model=SM7125 ro.soc.model=SM7125
# Crypto # Crypto

Loading…
Cancel
Save