├── audio ├── config │ └── audioPolicy │ │ ├── api │ │ ├── last_current.txt │ │ ├── last_removed.txt │ │ └── removed.txt │ │ ├── engine │ │ ├── api │ │ │ ├── last_current.txt │ │ │ ├── last_removed.txt │ │ │ └── removed.txt │ │ └── Android.bp │ │ ├── capengine │ │ ├── api │ │ │ ├── last_current.txt │ │ │ ├── last_removed.txt │ │ │ └── removed.txt │ │ └── Android.bp │ │ └── Android.bp ├── manifest.json ├── file_contexts ├── alsa_utils │ ├── Android.bp │ └── include │ │ ├── alsa_format.h │ │ └── alsa_logging.h ├── libeffects │ ├── loudness │ │ ├── dsp │ │ │ └── core │ │ │ │ ├── interpolation.h │ │ │ │ └── interpolator_linear.h │ │ ├── Android.bp │ │ └── aidl │ │ │ ├── LoudnessEnhancerContext.h │ │ │ └── EffectLoudnessEnhancer.h │ ├── downmix │ │ ├── Android.bp │ │ └── aidl │ │ │ ├── DownmixContext.h │ │ │ └── EffectDownmix.h │ ├── visualizer │ │ ├── Android.bp │ │ └── aidl │ │ │ └── Visualizer.h │ ├── reverb │ │ ├── Android.bp │ │ └── aidl │ │ │ └── EffectReverb.h │ ├── bundle │ │ └── Android.bp │ └── dynamicsproc │ │ ├── Android.bp │ │ ├── dsp │ │ └── SHCircularBuffer.h │ │ └── aidl │ │ └── DynamicsProcessing.h ├── primary │ ├── PrimaryMixer.cpp │ └── PrimaryMixer.h ├── include │ ├── core-impl │ │ ├── Configuration.h │ │ ├── AidlConversionXsdc.h │ │ ├── ModuleAlsa.h │ │ ├── Config.h │ │ ├── Telephony.h │ │ ├── StreamStub.h │ │ ├── DriverStubImpl.h │ │ ├── ModuleStub.h │ │ ├── ChildInterface.h │ │ ├── ModulePrimary.h │ │ ├── Bluetooth.h │ │ ├── ModuleUsb.h │ │ ├── ModuleRemoteSubmix.h │ │ └── StreamUsb.h │ └── effect-impl │ │ ├── EffectRange.h │ │ └── EffectThread.h ├── android.hardware.audio.service.rpi.rc ├── android.hardware.audio.service.rpi.xml ├── stub │ ├── StreamStub.cpp │ ├── ApeHeader.h │ └── ApeHeader.cpp ├── usb │ └── UsbAlsaMixerControl.h ├── AidlConversionXsdc.cpp ├── usb_audio_policy_configuration.xml ├── alsa │ └── ModuleAlsa.cpp ├── Config.cpp └── EffectMain.cpp ├── sepolicy ├── bootanim.te ├── priv_app.te ├── device.te ├── mediaserver.te ├── mediaswcodec.te ├── platform_app.te ├── system_app.te ├── surfaceflinger.te ├── system_server.te ├── untrusted_app_all.te ├── keystore.te ├── proc_net.te ├── hal_keymint_default.te ├── hal_audio_default.te ├── hal_graphics_allocator_default.te ├── init.te ├── netd.te ├── hal_tv_hdmi_connection_default.te ├── file.te ├── mediacodec.te ├── hal_tv_hdmi_cec_default.te ├── suspend_blocker.te ├── hal_drm_clearkey.te ├── kernel.te ├── property.te ├── vendor_init.te ├── hal_graphics_composer_default.te ├── te_macros ├── hal_drm_widevine.te ├── hal_camera.te ├── service_contexts ├── property_contexts ├── file_contexts └── genfs_contexts ├── product_manifest.xml ├── README.md ├── manifest.xml ├── light ├── apex_manifest.json ├── android.hardware.light-service.rpi.xml ├── apex_file_contexts ├── android.hardware.light-service.rpi.rc ├── Lights.h ├── Android.bp └── main.cpp ├── seccomp_policy ├── mediaswcodec.policy └── mediacodec.policy ├── health ├── apex_manifest.json ├── android.hardware.health-service.rpi.xml ├── apex_file_contexts ├── android.hardware.health-service.rpi.rc ├── main.cpp ├── HealthImpl.h └── Android.bp ├── usb ├── apex_manifest.json ├── android.hardware.usb.gadget-service.rpi.rc ├── apex_file_contexts ├── android.hardware.usb.gadget-service.rpi.xml ├── main.cpp └── Android.bp ├── bluetooth ├── apex_manifest.json ├── android.hardware.bluetooth-service.rpi.xml ├── apex_file_contexts ├── android.hardware.bluetooth-service.rpi.rc ├── net_bluetooth_mgmt.h ├── main.cpp ├── Android.bp └── BluetoothHci.h ├── hdmi ├── cec │ ├── apex_manifest.json │ ├── android.hardware.tv.hdmi.cec-service.rpi.rc │ ├── apex_file_contexts │ ├── android.hardware.tv.hdmi.cec-service.rpi.xml │ ├── HdmiCecPort.h │ ├── main.cpp │ └── Android.bp └── connection │ ├── apex_manifest.json │ ├── android.hardware.tv.hdmi.connection-service.rpi.rc │ ├── apex_file_contexts │ ├── android.hardware.tv.hdmi.connection-service.rpi.xml │ ├── main.cpp │ ├── Android.bp │ └── HdmiConnection.h ├── wifi ├── apex_manifest_hostapd.json ├── apex_manifest_supplicant.json ├── wpa_supplicant_overlay.conf ├── apex_file_contexts_hostapd ├── apex_file_contexts_supplicant ├── android.hardware.wifi.hostapd-service.rc ├── android.hardware.wifi.supplicant-service.rc └── Android.bp ├── camera ├── external │ ├── apex_manifest.json │ ├── apex_file_contexts │ ├── android.hardware.camera.provider-V1-external-service.xml │ ├── android.hardware.camera.provider-V1-external-service.rc │ ├── Android.bp │ └── external_camera_config.xml └── libcamera │ └── camera_hal.yaml ├── suspend_blocker ├── apex_manifest.json ├── suspend_blocker_rpi.rc ├── apex_file_contexts ├── suspend_blocker_rpi.cpp └── Android.bp ├── Android.bp ├── ramdisk ├── init.rpi4.rc ├── fstab.rpi4 └── ueventd.rpi4.rc ├── overlay ├── WifiRpiOverlay │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── config.xml ├── AndroidRpiOverlay │ ├── Android.bp │ └── AndroidManifest.xml ├── AndroidTvRpiOverlay │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── config.xml ├── BluetoothRpiOverlay │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── config.xml ├── CarServiceRpiOverlay │ ├── Android.bp │ └── AndroidManifest.xml ├── SettingsRpiOverlay │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── config.xml ├── SystemUIRpiOverlay │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── config.xml ├── SettingsProviderRpiOverlay │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── defaults.xml └── SettingsProviderTvRpiOverlay │ ├── Android.bp │ ├── AndroidManifest.xml │ └── res │ └── values │ └── defaults.xml ├── car ├── display_settings.xml ├── evs_config_override.json └── car_audio_configuration.xml ├── AndroidProducts.mk ├── framework_compatibility_matrix.xml ├── boot └── config.txt ├── mkbootimg.mk ├── media ├── media_codecs.xml └── media_codecs_v4l2_c2_video.xml ├── aosp_rpi4_tv.mk ├── aosp_rpi4.mk ├── BoardConfig.mk ├── vendor.prop └── mkimg.sh /audio/config/audioPolicy/api/last_current.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /audio/config/audioPolicy/api/last_removed.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sepolicy/bootanim.te: -------------------------------------------------------------------------------- 1 | gpu_access(bootanim) 2 | -------------------------------------------------------------------------------- /sepolicy/priv_app.te: -------------------------------------------------------------------------------- 1 | gpu_access(priv_app) 2 | -------------------------------------------------------------------------------- /audio/config/audioPolicy/engine/api/last_current.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /audio/config/audioPolicy/engine/api/last_removed.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sepolicy/device.te: -------------------------------------------------------------------------------- 1 | type cec_device, dev_type; 2 | -------------------------------------------------------------------------------- /sepolicy/mediaserver.te: -------------------------------------------------------------------------------- 1 | gpu_access(mediaserver) 2 | -------------------------------------------------------------------------------- /sepolicy/mediaswcodec.te: -------------------------------------------------------------------------------- 1 | gpu_access(mediaswcodec) 2 | -------------------------------------------------------------------------------- /sepolicy/platform_app.te: -------------------------------------------------------------------------------- 1 | gpu_access(platform_app) 2 | -------------------------------------------------------------------------------- /sepolicy/system_app.te: -------------------------------------------------------------------------------- 1 | gpu_access(system_app) 2 | -------------------------------------------------------------------------------- /audio/config/audioPolicy/capengine/api/last_current.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /audio/config/audioPolicy/capengine/api/last_removed.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sepolicy/surfaceflinger.te: -------------------------------------------------------------------------------- 1 | gpu_access(surfaceflinger) 2 | -------------------------------------------------------------------------------- /sepolicy/system_server.te: -------------------------------------------------------------------------------- 1 | gpu_access(system_server) 2 | -------------------------------------------------------------------------------- /sepolicy/untrusted_app_all.te: -------------------------------------------------------------------------------- 1 | gpu_access(untrusted_app_all) 2 | -------------------------------------------------------------------------------- /product_manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /sepolicy/keystore.te: -------------------------------------------------------------------------------- 1 | hal_client_domain(keystore, hal_gatekeeper) 2 | -------------------------------------------------------------------------------- /sepolicy/proc_net.te: -------------------------------------------------------------------------------- 1 | allow proc_net proc:filesystem associate; 2 | -------------------------------------------------------------------------------- /audio/config/audioPolicy/api/removed.txt: -------------------------------------------------------------------------------- 1 | // Signature format: 2.0 2 | -------------------------------------------------------------------------------- /audio/config/audioPolicy/engine/api/removed.txt: -------------------------------------------------------------------------------- 1 | // Signature format: 2.0 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Raspberry Vanilla AOSP 16 device configuration for Raspberry Pi 4. 2 | -------------------------------------------------------------------------------- /audio/config/audioPolicy/capengine/api/removed.txt: -------------------------------------------------------------------------------- 1 | // Signature format: 2.0 2 | -------------------------------------------------------------------------------- /manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /sepolicy/hal_keymint_default.te: -------------------------------------------------------------------------------- 1 | get_prop(hal_keymint_default, serialno_prop) 2 | -------------------------------------------------------------------------------- /sepolicy/hal_audio_default.te: -------------------------------------------------------------------------------- 1 | get_prop(hal_audio_default, vendor_audio_config_prop) 2 | -------------------------------------------------------------------------------- /sepolicy/hal_graphics_allocator_default.te: -------------------------------------------------------------------------------- 1 | gpu_access(hal_graphics_allocator_default) 2 | -------------------------------------------------------------------------------- /audio/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.android.hardware.audio.rpi4", 3 | "version": 1 4 | } 5 | -------------------------------------------------------------------------------- /sepolicy/init.te: -------------------------------------------------------------------------------- 1 | allow init kernel:system module_request; 2 | allow init tmpfs:lnk_file create; 3 | -------------------------------------------------------------------------------- /light/apex_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.android.hardware.light.rpi4", 3 | "version": 1 4 | } 5 | -------------------------------------------------------------------------------- /seccomp_policy/mediaswcodec.policy: -------------------------------------------------------------------------------- 1 | # device specific syscalls 2 | sched_getaffinity: 1 3 | sysinfo: 1 4 | -------------------------------------------------------------------------------- /sepolicy/netd.te: -------------------------------------------------------------------------------- 1 | dontaudit netd self:capability sys_module; 2 | allow netd kernel:system module_request; 3 | -------------------------------------------------------------------------------- /health/apex_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.android.hardware.health.rpi4", 3 | "version": 1 4 | } 5 | -------------------------------------------------------------------------------- /sepolicy/hal_tv_hdmi_connection_default.te: -------------------------------------------------------------------------------- 1 | allow hal_tv_hdmi_connection_default sysfs_hdmi:file r_file_perms; 2 | -------------------------------------------------------------------------------- /usb/apex_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.android.hardware.usb.gadget.rpi4", 3 | "version": 1 4 | } 5 | -------------------------------------------------------------------------------- /bluetooth/apex_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.android.hardware.bluetooth.rpi4", 3 | "version": 1 4 | } 5 | -------------------------------------------------------------------------------- /hdmi/cec/apex_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.android.hardware.tv.hdmi.cec.rpi4", 3 | "version": 1 4 | } 5 | -------------------------------------------------------------------------------- /wifi/apex_manifest_hostapd.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.android.hardware.wifi.hostapd.rpi4", 3 | "version": 1 4 | } 5 | -------------------------------------------------------------------------------- /sepolicy/file.te: -------------------------------------------------------------------------------- 1 | type mediadrm_vendor_data_file, file_type, data_file_type; 2 | type sysfs_hdmi, fs_type, sysfs_type; 3 | -------------------------------------------------------------------------------- /camera/external/apex_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.android.hardware.camera.external.rpi4", 3 | "version": 1 4 | } 5 | -------------------------------------------------------------------------------- /suspend_blocker/apex_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.android.hardware.suspend_blocker.rpi4", 3 | "version": 1 4 | } 5 | -------------------------------------------------------------------------------- /wifi/apex_manifest_supplicant.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.android.hardware.wifi.supplicant.rpi4", 3 | "version": 1 4 | } 5 | -------------------------------------------------------------------------------- /hdmi/connection/apex_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.android.hardware.tv.hdmi.connection.rpi4", 3 | "version": 1 4 | } 5 | -------------------------------------------------------------------------------- /Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021-2022 KonstaKANG 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | soong_namespace { 6 | } 7 | -------------------------------------------------------------------------------- /wifi/wpa_supplicant_overlay.conf: -------------------------------------------------------------------------------- 1 | disable_scan_offload=1 2 | wowlan_triggers=any 3 | p2p_disabled=1 4 | filter_rssi=-75 5 | no_ctrl_interface= -------------------------------------------------------------------------------- /sepolicy/mediacodec.te: -------------------------------------------------------------------------------- 1 | gpu_access(mediacodec) 2 | get_prop(mediacodec, vendor_ffmpeg_config_prop) 3 | get_prop(mediacodec, vendor_v4l2_config_prop) 4 | -------------------------------------------------------------------------------- /sepolicy/hal_tv_hdmi_cec_default.te: -------------------------------------------------------------------------------- 1 | allow hal_tv_hdmi_cec_default cec_device:chr_file rw_file_perms; 2 | get_prop(hal_tv_hdmi_cec_default, vendor_hdmi_config_prop) 3 | -------------------------------------------------------------------------------- /seccomp_policy/mediacodec.policy: -------------------------------------------------------------------------------- 1 | # device specific syscalls 2 | _llseek: 1 3 | eventfd2: 1 4 | getcwd: 1 5 | pselect6: 1 6 | recvfrom: 1 7 | sched_getaffinity: 1 8 | sendto: 1 9 | sysinfo: 1 10 | -------------------------------------------------------------------------------- /suspend_blocker/suspend_blocker_rpi.rc: -------------------------------------------------------------------------------- 1 | service vendor.suspend_blocker-rpi /apex/com.android.hardware.suspend_blocker.rpi4/bin/suspend_blocker_rpi 2 | class hal 3 | group system 4 | user root 5 | -------------------------------------------------------------------------------- /sepolicy/suspend_blocker.te: -------------------------------------------------------------------------------- 1 | type suspend_blocker, domain; 2 | type suspend_blocker_exec, exec_type, vendor_file_type, file_type; 3 | 4 | init_daemon_domain(suspend_blocker); 5 | 6 | wakelock_use(suspend_blocker); 7 | -------------------------------------------------------------------------------- /suspend_blocker/apex_file_contexts: -------------------------------------------------------------------------------- 1 | (/.*)? u:object_r:vendor_file:s0 2 | /etc(/.*)? u:object_r:vendor_configs_file:s0 3 | /bin/suspend_blocker_rpi u:object_r:suspend_blocker_exec:s0 4 | -------------------------------------------------------------------------------- /wifi/apex_file_contexts_hostapd: -------------------------------------------------------------------------------- 1 | (/.*)? u:object_r:vendor_file:s0 2 | /etc(/.*)? u:object_r:vendor_configs_file:s0 3 | /bin/hw/hostapd u:object_r:hal_wifi_hostapd_default_exec:s0 4 | -------------------------------------------------------------------------------- /sepolicy/hal_drm_clearkey.te: -------------------------------------------------------------------------------- 1 | type hal_drm_clearkey, domain; 2 | type hal_drm_clearkey_exec, vendor_file_type, exec_type, file_type; 3 | init_daemon_domain(hal_drm_clearkey) 4 | 5 | hal_server_domain(hal_drm_clearkey, hal_drm) 6 | -------------------------------------------------------------------------------- /wifi/apex_file_contexts_supplicant: -------------------------------------------------------------------------------- 1 | (/.*)? u:object_r:vendor_file:s0 2 | /etc(/.*)? u:object_r:vendor_configs_file:s0 3 | /bin/hw/wpa_supplicant u:object_r:hal_wifi_supplicant_default_exec:s0 4 | -------------------------------------------------------------------------------- /usb/android.hardware.usb.gadget-service.rpi.rc: -------------------------------------------------------------------------------- 1 | service vendor.usb_gadget-rpi /apex/com.android.hardware.usb.gadget.rpi4/bin/hw/android.hardware.usb.gadget-service.rpi 2 | class hal 3 | user system 4 | group system shell mtp 5 | -------------------------------------------------------------------------------- /sepolicy/kernel.te: -------------------------------------------------------------------------------- 1 | allow kernel self:capability mknod; 2 | allow kernel self:system module_request; 3 | allow kernel device:dir { create write add_name remove_name rmdir }; 4 | allow kernel device:chr_file { create setattr getattr unlink }; 5 | -------------------------------------------------------------------------------- /bluetooth/android.hardware.bluetooth-service.rpi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.bluetooth 4 | IBluetoothHci/default 5 | 6 | 7 | -------------------------------------------------------------------------------- /light/android.hardware.light-service.rpi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.light 4 | 2 5 | ILights/default 6 | 7 | 8 | -------------------------------------------------------------------------------- /ramdisk/init.rpi4.rc: -------------------------------------------------------------------------------- 1 | import /vendor/etc/init/hw/init.rpi4.usb.rc 2 | 3 | on init 4 | symlink /sdcard /storage/sdcard0 5 | 6 | on fs 7 | mount_all /vendor/etc/fstab.rpi4 --early 8 | 9 | on late-fs 10 | mount_all /vendor/etc/fstab.rpi4 --late 11 | -------------------------------------------------------------------------------- /sepolicy/property.te: -------------------------------------------------------------------------------- 1 | vendor_internal_prop(vendor_audio_config_prop) 2 | vendor_internal_prop(vendor_ffmpeg_config_prop) 3 | vendor_internal_prop(vendor_hdmi_config_prop) 4 | vendor_internal_prop(vendor_hwc_config_prop) 5 | vendor_internal_prop(vendor_v4l2_config_prop) 6 | -------------------------------------------------------------------------------- /health/android.hardware.health-service.rpi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.health 4 | 4 5 | IHealth/default 6 | 7 | 8 | -------------------------------------------------------------------------------- /light/apex_file_contexts: -------------------------------------------------------------------------------- 1 | (/.*)? u:object_r:vendor_file:s0 2 | /etc(/.*)? u:object_r:vendor_configs_file:s0 3 | /bin/hw/android\.hardware\.light-service\.rpi u:object_r:hal_light_default_exec:s0 4 | -------------------------------------------------------------------------------- /health/apex_file_contexts: -------------------------------------------------------------------------------- 1 | (/.*)? u:object_r:vendor_file:s0 2 | /etc(/.*)? u:object_r:vendor_configs_file:s0 3 | /bin/hw/android\.hardware\.health-service\.rpi u:object_r:hal_health_default_exec:s0 4 | -------------------------------------------------------------------------------- /sepolicy/vendor_init.te: -------------------------------------------------------------------------------- 1 | set_prop(vendor_init, vendor_audio_config_prop) 2 | set_prop(vendor_init, vendor_ffmpeg_config_prop) 3 | set_prop(vendor_init, vendor_hdmi_config_prop) 4 | set_prop(vendor_init, vendor_hwc_config_prop) 5 | set_prop(vendor_init, vendor_v4l2_config_prop) 6 | -------------------------------------------------------------------------------- /health/android.hardware.health-service.rpi.rc: -------------------------------------------------------------------------------- 1 | service vendor.health-rpi /apex/com.android.hardware.health.rpi4/bin/hw/android.hardware.health-service.rpi 2 | class hal 3 | user system 4 | group system 5 | capabilities WAKE_ALARM BLOCK_SUSPEND 6 | file /dev/kmsg w 7 | -------------------------------------------------------------------------------- /bluetooth/apex_file_contexts: -------------------------------------------------------------------------------- 1 | (/.*)? u:object_r:vendor_file:s0 2 | /etc(/.*)? u:object_r:vendor_configs_file:s0 3 | /bin/hw/android\.hardware\.bluetooth-service\.rpi u:object_r:hal_bluetooth_default_exec:s0 4 | -------------------------------------------------------------------------------- /overlay/WifiRpiOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021-2022 KonstaKANG 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | runtime_resource_overlay { 6 | name: "WifiRpiOverlay", 7 | resource_dirs: ["res"], 8 | sdk_version: "current", 9 | vendor: true, 10 | } 11 | -------------------------------------------------------------------------------- /usb/apex_file_contexts: -------------------------------------------------------------------------------- 1 | (/.*)? u:object_r:vendor_file:s0 2 | /etc(/.*)? u:object_r:vendor_configs_file:s0 3 | /bin/hw/android\.hardware\.usb\.gadget-service\.rpi u:object_r:hal_usb_gadget_default_exec:s0 4 | -------------------------------------------------------------------------------- /hdmi/cec/android.hardware.tv.hdmi.cec-service.rpi.rc: -------------------------------------------------------------------------------- 1 | service vendor.cec-rpi /apex/com.android.hardware.tv.hdmi.cec.rpi4/bin/hw/android.hardware.tv.hdmi.cec-service.rpi 2 | interface aidl android.hardware.tv.hdmi.cec.IHdmiCec/default 3 | class hal 4 | user system 5 | group system 6 | -------------------------------------------------------------------------------- /overlay/AndroidRpiOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021-2022 KonstaKANG 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | runtime_resource_overlay { 6 | name: "AndroidRpiOverlay", 7 | resource_dirs: ["res"], 8 | sdk_version: "current", 9 | vendor: true, 10 | } 11 | -------------------------------------------------------------------------------- /hdmi/cec/apex_file_contexts: -------------------------------------------------------------------------------- 1 | (/.*)? u:object_r:vendor_file:s0 2 | /etc(/.*)? u:object_r:vendor_configs_file:s0 3 | /bin/hw/android\.hardware\.tv\.hdmi\.cec-service\.rpi u:object_r:hal_tv_hdmi_cec_default_exec:s0 4 | -------------------------------------------------------------------------------- /overlay/AndroidTvRpiOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021-2022 KonstaKANG 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | runtime_resource_overlay { 6 | name: "AndroidTvRpiOverlay", 7 | resource_dirs: ["res"], 8 | sdk_version: "current", 9 | vendor: true, 10 | } 11 | -------------------------------------------------------------------------------- /overlay/BluetoothRpiOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021-2022 KonstaKANG 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | runtime_resource_overlay { 6 | name: "BluetoothRpiOverlay", 7 | resource_dirs: ["res"], 8 | sdk_version: "current", 9 | vendor: true, 10 | } 11 | -------------------------------------------------------------------------------- /overlay/CarServiceRpiOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021-2023 KonstaKANG 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | runtime_resource_overlay { 6 | name: "CarServiceRpiOverlay", 7 | resource_dirs: ["res"], 8 | sdk_version: "current", 9 | vendor: true, 10 | } 11 | -------------------------------------------------------------------------------- /overlay/SettingsRpiOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021-2022 KonstaKANG 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | runtime_resource_overlay { 6 | name: "SettingsRpiOverlay", 7 | resource_dirs: ["res"], 8 | sdk_version: "current", 9 | vendor: true, 10 | } 11 | -------------------------------------------------------------------------------- /overlay/SystemUIRpiOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021-2022 KonstaKANG 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | runtime_resource_overlay { 6 | name: "SystemUIRpiOverlay", 7 | resource_dirs: ["res"], 8 | sdk_version: "current", 9 | vendor: true, 10 | } 11 | -------------------------------------------------------------------------------- /sepolicy/hal_graphics_composer_default.te: -------------------------------------------------------------------------------- 1 | vndbinder_use(hal_graphics_composer_default) 2 | gpu_access(hal_graphics_composer_default) 3 | get_prop(hal_graphics_composer_default, vendor_hwc_config_prop) 4 | 5 | allow hal_graphics_composer_default self:netlink_kobject_uevent_socket { bind create read }; 6 | -------------------------------------------------------------------------------- /overlay/SettingsProviderRpiOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021-2022 KonstaKANG 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | runtime_resource_overlay { 6 | name: "SettingsProviderRpiOverlay", 7 | resource_dirs: ["res"], 8 | sdk_version: "current", 9 | vendor: true, 10 | } 11 | -------------------------------------------------------------------------------- /overlay/SettingsProviderTvRpiOverlay/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021-2022 KonstaKANG 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | runtime_resource_overlay { 6 | name: "SettingsProviderTvRpiOverlay", 7 | resource_dirs: ["res"], 8 | sdk_version: "current", 9 | vendor: true, 10 | } 11 | -------------------------------------------------------------------------------- /bluetooth/android.hardware.bluetooth-service.rpi.rc: -------------------------------------------------------------------------------- 1 | service vendor.bluetooth-rpi /apex/com.android.hardware.bluetooth.rpi4/bin/hw/android.hardware.bluetooth-service.rpi 2 | class hal 3 | capabilities BLOCK_SUSPEND NET_ADMIN SYS_NICE 4 | user bluetooth 5 | group bluetooth 6 | task_profiles HighPerformance 7 | -------------------------------------------------------------------------------- /car/display_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /camera/external/apex_file_contexts: -------------------------------------------------------------------------------- 1 | (/.*)? u:object_r:vendor_file:s0 2 | /etc(/.*)? u:object_r:vendor_configs_file:s0 3 | /bin/hw/android\.hardware\.camera\.provider-V1-external-service u:object_r:hal_camera_default_exec:s0 4 | -------------------------------------------------------------------------------- /hdmi/connection/android.hardware.tv.hdmi.connection-service.rpi.rc: -------------------------------------------------------------------------------- 1 | service vendor.hdmi-rpi /apex/com.android.hardware.tv.hdmi.connection.rpi4/bin/hw/android.hardware.tv.hdmi.connection-service.rpi 2 | interface aidl android.hardware.tv.hdmi.connection.IHdmiConnection/default 3 | class hal 4 | user system 5 | group system 6 | -------------------------------------------------------------------------------- /hdmi/connection/apex_file_contexts: -------------------------------------------------------------------------------- 1 | (/.*)? u:object_r:vendor_file:s0 2 | /etc(/.*)? u:object_r:vendor_configs_file:s0 3 | /bin/hw/android\.hardware\.tv\.hdmi\.connection-service\.rpi u:object_r:hal_tv_hdmi_connection_default_exec:s0 4 | -------------------------------------------------------------------------------- /sepolicy/te_macros: -------------------------------------------------------------------------------- 1 | ##################################### 2 | # gpu_access(client_domain) 3 | # Allow client_domain to communicate with the GPU 4 | define(`gpu_access', ` 5 | allow $1 gpu_device:dir r_dir_perms; 6 | allow $1 gpu_device:chr_file rw_file_perms; 7 | allow $1 sysfs_gpu:dir r_dir_perms; 8 | allow $1 sysfs_gpu:file r_file_perms; 9 | ') 10 | -------------------------------------------------------------------------------- /usb/android.hardware.usb.gadget-service.rpi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.usb.gadget 4 | 1 5 | 6 | IUsbGadget 7 | default 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /hdmi/cec/android.hardware.tv.hdmi.cec-service.rpi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.tv.hdmi.cec 4 | 1 5 | 6 | IHdmiCec 7 | default 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /sepolicy/hal_drm_widevine.te: -------------------------------------------------------------------------------- 1 | type hal_drm_widevine, domain; 2 | type hal_drm_widevine_exec, vendor_file_type, exec_type, file_type; 3 | init_daemon_domain(hal_drm_widevine) 4 | 5 | hal_server_domain(hal_drm_widevine, hal_drm) 6 | 7 | allow hal_drm_widevine mediadrm_vendor_data_file:file create_file_perms; 8 | allow hal_drm_widevine mediadrm_vendor_data_file:dir create_dir_perms; 9 | -------------------------------------------------------------------------------- /audio/file_contexts: -------------------------------------------------------------------------------- 1 | (/.*)? u:object_r:vendor_file:s0 2 | /etc(/.*)? u:object_r:vendor_configs_file:s0 3 | /bin/hw/android\.hardware\.audio\.service.rpi u:object_r:hal_audio_default_exec:s0 4 | /bin/hw/android\.hardware\.audio\.effect\.service.rpi u:object_r:hal_audio_default_exec:s0 5 | -------------------------------------------------------------------------------- /audio/config/audioPolicy/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Android Open Source Project 2 | // Copyright (C) 2025 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | xsd_config { 7 | name: "audio_policy_configuration_aidl_rpi", 8 | srcs: ["audio_policy_configuration.xsd"], 9 | package_name: "android.audio.policy.configuration", 10 | nullability: true, 11 | } 12 | -------------------------------------------------------------------------------- /hdmi/connection/android.hardware.tv.hdmi.connection-service.rpi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.tv.hdmi.connection 4 | 1 5 | 6 | IHdmiConnection 7 | default 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /camera/external/android.hardware.camera.provider-V1-external-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.camera.provider 4 | 1 5 | 6 | ICameraProvider 7 | external/0 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /audio/config/audioPolicy/engine/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Android Open Source Project 2 | // Copyright (C) 2025 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | xsd_config { 7 | name: "audio_policy_engine_configuration_aidl_rpi", 8 | srcs: ["audio_policy_engine_configuration.xsd"], 9 | package_name: "android.audio.policy.engine.configuration", 10 | nullability: true, 11 | } 12 | -------------------------------------------------------------------------------- /AndroidProducts.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2021-2023 KonstaKANG 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | 7 | PRODUCT_MAKEFILES := \ 8 | $(LOCAL_DIR)/aosp_rpi4.mk \ 9 | $(LOCAL_DIR)/aosp_rpi4_car.mk \ 10 | $(LOCAL_DIR)/aosp_rpi4_tv.mk 11 | 12 | COMMON_LUNCH_CHOICES := \ 13 | aosp_rpi4-trunk_staging-userdebug \ 14 | aosp_rpi4_car-trunk_staging-userdebug \ 15 | aosp_rpi4_tv-trunk_staging-userdebug 16 | -------------------------------------------------------------------------------- /framework_compatibility_matrix.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.media.c2 4 | 1 5 | 6 | IComponentStore 7 | ffmpeg 8 | v4l2 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /audio/config/audioPolicy/capengine/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Android Open Source Project 2 | // Copyright (C) 2025 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | xsd_config { 7 | name: "audio_policy_capengine_configuration_aidl_rpi", 8 | srcs: ["PolicyConfigurableDomains.xsd"], 9 | package_name: "android.audio.policy.capengine.configuration", 10 | nullability: true, 11 | root_elements: ["ConfigurableDomains"], 12 | } 13 | -------------------------------------------------------------------------------- /camera/external/android.hardware.camera.provider-V1-external-service.rc: -------------------------------------------------------------------------------- 1 | service vendor.camera.provider-ext /apex/com.android.hardware.camera.external.rpi4/bin/hw/android.hardware.camera.provider-V1-external-service 2 | interface aidl android.hardware.camera.provider.ICameraProvider/external/0 3 | class hal 4 | user cameraserver 5 | group audio camera input drmrpc usb 6 | ioprio rt 4 7 | capabilities SYS_NICE 8 | task_profiles CameraServiceCapacity MaxPerformance 9 | -------------------------------------------------------------------------------- /sepolicy/hal_camera.te: -------------------------------------------------------------------------------- 1 | vndbinder_use(hal_camera_default); 2 | 3 | allow hal_camera_default hal_graphics_mapper_hwservice:hwservice_manager find; 4 | hal_client_domain(hal_camera_default, hal_graphics_allocator); 5 | hal_client_domain(hal_camera_default, hal_graphics_composer); 6 | 7 | allow cameraserver device:dir r_dir_perms; 8 | allow cameraserver video_device:dir r_dir_perms; 9 | allow cameraserver video_device:chr_file rw_file_perms; 10 | 11 | gpu_access(hal_camera_default) 12 | gpu_access(cameraserver) 13 | -------------------------------------------------------------------------------- /sepolicy/service_contexts: -------------------------------------------------------------------------------- 1 | # Camera 2 | android.hardware.camera.provider.ICameraProvider/external/0 u:object_r:hal_camera_service:s0 3 | android.hardware.camera.provider.ICameraProvider/libcamera/0 u:object_r:hal_camera_service:s0 4 | 5 | # DRM 6 | android.hardware.drm.IDrmFactory/widevine u:object_r:hal_drm_service:s0 7 | 8 | # Gatekeeper 9 | android.hardware.security.sharedsecret.ISharedSecret/gatekeeper u:object_r:hal_gatekeeper_service:s0 10 | 11 | # Graphics 12 | mapper/minigbm_gbm_mesa u:object_r:hal_graphics_mapper_service:s0 13 | -------------------------------------------------------------------------------- /wifi/android.hardware.wifi.hostapd-service.rc: -------------------------------------------------------------------------------- 1 | on property:apex.all.ready=true 2 | mkdir /data/vendor/wifi 0770 wifi wifi 3 | mkdir /data/vendor/wifi/hostapd 0770 wifi wifi 4 | mkdir /data/vendor/wifi/hostapd/sockets 0770 wifi wifi 5 | 6 | service hostapd /apex/com.android.hardware.wifi.hostapd.rpi4/bin/hw/hostapd 7 | interface aidl android.hardware.wifi.hostapd.IHostapd/default 8 | class main 9 | capabilities NET_ADMIN NET_RAW 10 | user wifi 11 | group wifi net_raw net_admin 12 | disabled 13 | oneshot 14 | -------------------------------------------------------------------------------- /suspend_blocker/suspend_blocker_rpi.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 The Android Open Source Project 3 | * Copyright (C) 2021-2022 KonstaKANG 4 | * 5 | * SPDX-License-Identifier: Apache-2.0 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | int main() { 12 | auto wl = android::wakelock::WakeLock::tryGet("suspend_blocker_rpi"); // RAII object 13 | if (!wl.has_value()) { 14 | return EXIT_FAILURE; 15 | } 16 | 17 | sigset_t mask; 18 | sigemptyset(&mask); 19 | return sigsuspend(&mask); // Infinite sleep 20 | } 21 | -------------------------------------------------------------------------------- /overlay/AndroidRpiOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /overlay/AndroidTvRpiOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /overlay/BluetoothRpiOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /overlay/SettingsRpiOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /overlay/SystemUIRpiOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /overlay/SettingsProviderRpiOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /overlay/SettingsProviderTvRpiOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /overlay/WifiRpiOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 20 | 21 | -------------------------------------------------------------------------------- /overlay/CarServiceRpiOverlay/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 20 | 21 | -------------------------------------------------------------------------------- /camera/libcamera/camera_hal.yaml: -------------------------------------------------------------------------------- 1 | cameras: 2 | "/base/soc/i2c0mux/i2c@1/imx219@10": 3 | location: back 4 | rotation: 0 5 | "/base/soc/i2c0mux/i2c@1/imx296@1a": 6 | location: back 7 | rotation: 0 8 | "/base/soc/i2c0mux/i2c@1/imx477@1a": 9 | location: back 10 | rotation: 0 11 | "/base/soc/i2c0mux/i2c@1/imx500@1a": 12 | location: back 13 | rotation: 0 14 | "/base/soc/i2c0mux/i2c@1/imx519@1a": 15 | location: back 16 | rotation: 0 17 | "/base/soc/i2c0mux/i2c@1/imx708@1a": 18 | location: back 19 | rotation: 0 20 | "/base/soc/i2c0mux/i2c@1/ov5647@36": 21 | location: back 22 | rotation: 0 23 | "/base/soc/i2c0mux/i2c@1/ov64a40@36": 24 | location: back 25 | rotation: 0 26 | -------------------------------------------------------------------------------- /boot/config.txt: -------------------------------------------------------------------------------- 1 | # Kernel 2 | arm_64bit=1 3 | kernel=Image 4 | 5 | # Ramdisk 6 | initramfs ramdisk.img followkernel 7 | 8 | # Audio 9 | dtparam=audio=on 10 | 11 | # Camera 12 | camera_auto_detect=1 13 | start_x=1 14 | 15 | # CPU 16 | arm_boost=1 17 | 18 | # Display 19 | disable_overscan=1 20 | 21 | # Display panel 22 | #dtoverlay=vc4-kms-dsi-7inch 23 | #dtoverlay=vc4-kms-dsi-ili9881-5inch 24 | #dtoverlay=vc4-kms-dsi-ili9881-7inch 25 | 26 | # Graphics acceleration 27 | disable_fw_kms_setup=1 28 | dtoverlay=vc4-kms-v3d 29 | 30 | # I2C 31 | #dtparam=i2c_arm=on 32 | 33 | # I2S 34 | #dtparam=i2s=on 35 | 36 | # Serial console 37 | enable_uart=1 38 | 39 | # SPI 40 | #dtparam=spi=on 41 | 42 | # USB 43 | dtoverlay=dwc2,dr_mode=peripheral 44 | [cm4] 45 | dtoverlay=dwc2,dr_mode=otg 46 | [all] 47 | -------------------------------------------------------------------------------- /wifi/android.hardware.wifi.supplicant-service.rc: -------------------------------------------------------------------------------- 1 | on property:apex.all.ready=true 2 | mkdir /data/vendor/wifi 0770 wifi wifi 3 | mkdir /data/vendor/wifi/wpa 0770 wifi wifi 4 | mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi 5 | 6 | service wpa_supplicant /apex/com.android.hardware.wifi.supplicant.rpi4/bin/hw/wpa_supplicant \ 7 | -O/data/vendor/wifi/wpa/sockets -dd \ 8 | -g@android:wpa_wlan0 9 | # we will start as root and wpa_supplicant will switch to user wifi 10 | # after setting up the capabilities required for WEXT 11 | # user wifi 12 | # group wifi inet keystore 13 | interface aidl android.hardware.wifi.supplicant.ISupplicant/default 14 | class main 15 | socket wpa_wlan0 dgram 660 wifi wifi 16 | user root 17 | disabled 18 | oneshot 19 | -------------------------------------------------------------------------------- /audio/alsa_utils/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 The Android Open Source Project 2 | // Copyright (C) 2025 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_library { 7 | name: "libalsautilsv2-rpi", 8 | vendor_available: true, 9 | srcs: [ 10 | "alsa_device_profile.c", 11 | "alsa_device_proxy.c", 12 | "alsa_format.c", 13 | "alsa_logging.c", 14 | ], 15 | export_include_dirs: ["include"], 16 | header_libs: [ 17 | "libaudio_system_headers", 18 | ], 19 | export_header_lib_headers: [ 20 | "libaudio_system_headers", 21 | ], 22 | shared_libs: [ 23 | "libasound", 24 | "libaudioutils", 25 | "libcutils", 26 | "liblog", 27 | "libtinyalsav2", 28 | ], 29 | cflags: [ 30 | "-Wall", 31 | "-Werror", 32 | "-Wno-unused-parameter", 33 | ], 34 | } 35 | -------------------------------------------------------------------------------- /suspend_blocker/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 The Android Open Source Project 2 | // Copyright (C) 2021-2022 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_binary { 7 | name: "suspend_blocker_rpi", 8 | vendor: true, 9 | srcs: ["suspend_blocker_rpi.cpp"], 10 | shared_libs: ["libpower"], 11 | installable: false, 12 | } 13 | 14 | prebuilt_etc { 15 | name: "suspend_blocker_rpi.rc", 16 | src: "suspend_blocker_rpi.rc", 17 | installable: false, 18 | } 19 | 20 | apex { 21 | name: "com.android.hardware.suspend_blocker.rpi4", 22 | manifest: "apex_manifest.json", 23 | file_contexts: "apex_file_contexts", 24 | key: "com.android.hardware.key", 25 | certificate: ":com.android.hardware.certificate", 26 | updatable: false, 27 | vendor: true, 28 | 29 | binaries: ["suspend_blocker_rpi"], 30 | prebuilts: [ 31 | "suspend_blocker_rpi.rc", 32 | ], 33 | } 34 | -------------------------------------------------------------------------------- /audio/libeffects/loudness/dsp/core/interpolation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef LE_FX_ENGINE_DSP_CORE_INTERPOLATION_H_ 17 | #define LE_FX_ENGINE_DSP_CORE_INTERPOLATION_H_ 18 | 19 | #include "dsp/core/interpolator_base.h" 20 | #include "dsp/core/interpolator_linear.h" 21 | 22 | #endif // LE_FX_ENGINE_DSP_CORE_INTERPOLATION_H_ 23 | 24 | -------------------------------------------------------------------------------- /mkbootimg.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2021-2022 KonstaKANG 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | 7 | DEVICE_PATH := device/brcm/rpi4 8 | KERNEL_PATH := device/brcm/rpi4-kernel 9 | VENDOR_PATH := vendor/brcm 10 | 11 | RPI_BOOT_OUT := $(PRODUCT_OUT)/rpiboot 12 | $(RPI_BOOT_OUT): $(INSTALLED_RAMDISK_TARGET) 13 | mkdir -p $(RPI_BOOT_OUT) 14 | mkdir -p $(RPI_BOOT_OUT)/overlays 15 | cp $(DEVICE_PATH)/boot/* $(RPI_BOOT_OUT) 16 | cp $(KERNEL_PATH)/Image $(RPI_BOOT_OUT) 17 | cp $(KERNEL_PATH)/bcm2711-rpi-*.dtb $(RPI_BOOT_OUT) 18 | cp $(KERNEL_PATH)/overlays/* $(RPI_BOOT_OUT)/overlays 19 | cp $(PRODUCT_OUT)/ramdisk.img $(RPI_BOOT_OUT) 20 | cp $(VENDOR_PATH)/rpi4/proprietary/boot/* $(RPI_BOOT_OUT) 21 | echo $(BOARD_KERNEL_CMDLINE) > $(RPI_BOOT_OUT)/cmdline.txt 22 | 23 | $(INSTALLED_BOOTIMAGE_TARGET): $(RPI_BOOT_OUT) 24 | $(call pretty,"Target boot image: $@") 25 | dd if=/dev/zero of=$@ bs=1M count=128 26 | mkfs.fat -F 32 -n "boot" $@ 27 | mcopy -s -i $@ $(RPI_BOOT_OUT)/* :: 28 | -------------------------------------------------------------------------------- /sepolicy/property_contexts: -------------------------------------------------------------------------------- 1 | # Audio 2 | persist.vendor.audio.device u:object_r:vendor_audio_config_prop:s0 3 | persist.vendor.audio.pcm.card u:object_r:vendor_audio_config_prop:s0 4 | 5 | # CEC 6 | persist.vendor.hdmi.cec_device u:object_r:vendor_hdmi_config_prop:s0 7 | 8 | # FFmpeg 9 | persist.vendor.ffmpeg_codec2.rank.audio u:object_r:vendor_ffmpeg_config_prop:s0 10 | persist.vendor.ffmpeg_codec2.rank.video u:object_r:vendor_ffmpeg_config_prop:s0 11 | persist.vendor.ffmpeg_codec2.v4l2.h264 u:object_r:vendor_ffmpeg_config_prop:s0 12 | persist.vendor.ffmpeg_codec2.v4l2.h265 u:object_r:vendor_ffmpeg_config_prop:s0 13 | 14 | # Graphics 15 | vendor.hwc.drm.ctm u:object_r:vendor_hwc_config_prop:s0 16 | vendor.hwc.drm.disable_hdr u:object_r:vendor_hwc_config_prop:s0 17 | vendor.hwc.drm.force_mode u:object_r:vendor_hwc_config_prop:s0 18 | 19 | # V4L2 20 | persist.vendor.v4l2_codec2.rank.decoder u:object_r:vendor_v4l2_config_prop:s0 21 | persist.vendor.v4l2_codec2.rank.encoder u:object_r:vendor_v4l2_config_prop:s0 22 | -------------------------------------------------------------------------------- /light/android.hardware.light-service.rpi.rc: -------------------------------------------------------------------------------- 1 | on early-boot 2 | chown system system /sys/class/backlight/10-0045/brightness 3 | chown system system /sys/class/backlight/10-0045/max_brightness 4 | chown system system /sys/class/backlight/11-0045/brightness 5 | chown system system /sys/class/backlight/11-0045/max_brightness 6 | chown system system /sys/class/backlight/rpi_backlight/brightness 7 | chown system system /sys/class/backlight/rpi_backlight/max_brightness 8 | chmod 660 /sys/class/backlight/10-0045/brightness 9 | chmod 440 /sys/class/backlight/10-0045/max_brightness 10 | chmod 660 /sys/class/backlight/11-0045/brightness 11 | chmod 440 /sys/class/backlight/11-0045/max_brightness 12 | chmod 660 /sys/class/backlight/rpi_backlight/brightness 13 | chmod 440 /sys/class/backlight/rpi_backlight/max_brightness 14 | 15 | service vendor.light-rpi /apex/com.android.hardware.light.rpi4/bin/hw/android.hardware.light-service.rpi 16 | class hal 17 | user system 18 | group system 19 | shutdown critical 20 | -------------------------------------------------------------------------------- /audio/alsa_utils/include/alsa_format.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ANDROID_SYSTEM_MEDIA_ALSA_UTILS_ALSA_FORMAT_H 18 | #define ANDROID_SYSTEM_MEDIA_ALSA_UTILS_ALSA_FORMAT_H 19 | 20 | #include 21 | 22 | #include 23 | 24 | enum pcm_format get_pcm_format_for_mask(const struct pcm_mask* mask); 25 | 26 | #endif /* ANDROID_SYSTEM_MEDIA_ALSA_UTILS_ALSA_FORMAT_H */ 27 | -------------------------------------------------------------------------------- /audio/primary/PrimaryMixer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "AHAL_PrimaryMixer" 18 | 19 | #include "PrimaryMixer.h" 20 | 21 | namespace aidl::android::hardware::audio::core::primary { 22 | 23 | // static 24 | PrimaryMixer& PrimaryMixer::getInstance() { 25 | static PrimaryMixer gInstance; 26 | return gInstance; 27 | } 28 | 29 | } // namespace aidl::android::hardware::audio::core::primary 30 | -------------------------------------------------------------------------------- /overlay/BluetoothRpiOverlay/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | true 23 | 24 | 25 | -------------------------------------------------------------------------------- /ramdisk/fstab.rpi4: -------------------------------------------------------------------------------- 1 | # Android fstab file. 2 | # The filesystem that contains the filesystem checker binary (typically /system) cannot 3 | # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK 4 | 5 | # 6 | /dev/block/mmcblk0p5 /system ext4 ro,barrier=1 wait,first_stage_mount 7 | /dev/block/mmcblk0p6 /vendor ext4 ro,barrier=1 wait,first_stage_mount 8 | /dev/block/mmcblk0p7 /metadata ext4 nodev,noatime,nosuid wait,check,formattable,first_stage_mount 9 | /dev/block/mmcblk0p3 /data ext4 nodev,noatime,nosuid,errors=panic wait,check,formattable,quota 10 | /devices/platform/scb/*.pcie/*/*/*/usb* auto auto defaults voldmanaged=usb:auto 11 | /devices/platform/soc/*.usb/usb* auto auto defaults voldmanaged=usb:auto 12 | -------------------------------------------------------------------------------- /overlay/SystemUIRpiOverlay/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | internet,bt,dnd,location,airplane,hotspot,dark,dream,screenrecord 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /media/media_codecs.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /audio/include/core-impl/Configuration.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include "Module.h" 22 | 23 | namespace aidl::android::hardware::audio::core::internal { 24 | 25 | std::unique_ptr getConfiguration(Module::Type moduleType); 26 | std::vector 27 | getStandard16And24BitPcmAudioProfiles(); 28 | 29 | } // namespace aidl::android::hardware::audio::core::internal 30 | -------------------------------------------------------------------------------- /camera/external/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 KonstaKANG 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | prebuilt_etc { 6 | name: "android.hardware.camera.provider-V1-external-service.rc", 7 | src: "android.hardware.camera.provider-V1-external-service.rc", 8 | installable: false, 9 | } 10 | 11 | prebuilt_etc { 12 | name: "android.hardware.camera.provider-V1-external-service.xml", 13 | src: "android.hardware.camera.provider-V1-external-service.xml", 14 | sub_dir: "vintf", 15 | installable: false, 16 | } 17 | 18 | apex { 19 | name: "com.android.hardware.camera.external.rpi4", 20 | manifest: "apex_manifest.json", 21 | file_contexts: "apex_file_contexts", 22 | key: "com.android.hardware.key", 23 | certificate: ":com.android.hardware.certificate", 24 | updatable: false, 25 | vendor: true, 26 | 27 | binaries: [ 28 | "android.hardware.camera.provider-V1-external-service", 29 | ], 30 | prebuilts: [ 31 | "android.hardware.camera.provider-V1-external-service.rc", 32 | "android.hardware.camera.provider-V1-external-service.xml", 33 | ], 34 | } 35 | -------------------------------------------------------------------------------- /audio/android.hardware.audio.service.rpi.rc: -------------------------------------------------------------------------------- 1 | service vendor.audio-rpi /apex/com.android.hardware.audio.rpi4/bin/hw/android.hardware.audio.service.rpi 2 | class hal 3 | user audioserver 4 | # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) 5 | group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock context_hub 6 | capabilities BLOCK_SUSPEND SYS_NICE 7 | # setting RLIMIT_RTPRIO allows binder RT priority inheritance 8 | rlimit rtprio 10 10 9 | ioprio rt 4 10 | task_profiles ProcessCapacityHigh HighPerformance 11 | onrestart restart audioserver 12 | 13 | service vendor.audio-effect-rpi /apex/com.android.hardware.audio.rpi4/bin/hw/android.hardware.audio.effect.service.rpi 14 | class hal 15 | user audioserver 16 | # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) 17 | group audio media 18 | capabilities BLOCK_SUSPEND 19 | # setting RLIMIT_RTPRIO allows binder RT priority inheritance 20 | rlimit rtprio 10 10 21 | ioprio rt 4 22 | task_profiles ProcessCapacityHigh HighPerformance 23 | onrestart restart audioserver 24 | -------------------------------------------------------------------------------- /audio/alsa_utils/include/alsa_logging.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ANDROID_SYSTEM_MEDIA_ALSA_UTILS_ALSA_LOGGING_H 18 | #define ANDROID_SYSTEM_MEDIA_ALSA_UTILS_ALSA_LOGGING_H 19 | 20 | #include 21 | 22 | void log_pcm_mask(const char* mask_name, const struct pcm_mask* mask); 23 | void log_pcm_params(const struct pcm_params * alsa_hw_params); 24 | void log_pcm_config(const struct pcm_config * config, const char* label); 25 | 26 | #endif /* ANDROID_SYSTEM_MEDIA_ALSA_UTILS_ALSA_LOGGING_H */ 27 | -------------------------------------------------------------------------------- /sepolicy/file_contexts: -------------------------------------------------------------------------------- 1 | # CEC 2 | /dev/cec0 u:object_r:cec_device:s0 3 | /dev/cec1 u:object_r:cec_device:s0 4 | 5 | # DRM 6 | /data/vendor/mediadrm(/.*)? u:object_r:mediadrm_vendor_data_file:s0 7 | 8 | # Graphics 9 | /dev/dri(/.*)? u:object_r:gpu_device:s0 10 | 11 | # Partitions 12 | /dev/block/mmcblk0p1 u:object_r:boot_block_device:s0 13 | /dev/block/mmcblk0p3 u:object_r:userdata_block_device:s0 14 | /dev/block/mmcblk0p5 u:object_r:system_block_device:s0 15 | /dev/block/mmcblk0p6 u:object_r:system_block_device:s0 16 | /dev/block/mmcblk0p7 u:object_r:metadata_block_device:s0 17 | /dev/block/nvme0n1p1 u:object_r:boot_block_device:s0 18 | /dev/block/nvme0n1p3 u:object_r:userdata_block_device:s0 19 | /dev/block/nvme0n1p5 u:object_r:system_block_device:s0 20 | /dev/block/nvme0n1p6 u:object_r:system_block_device:s0 21 | /dev/block/nvme0n1p7 u:object_r:metadata_block_device:s0 22 | /dev/block/sda1 u:object_r:boot_block_device:s0 23 | /dev/block/sda3 u:object_r:userdata_block_device:s0 24 | /dev/block/sda5 u:object_r:system_block_device:s0 25 | /dev/block/sda6 u:object_r:system_block_device:s0 26 | /dev/block/sda7 u:object_r:metadata_block_device:s0 27 | -------------------------------------------------------------------------------- /sepolicy/genfs_contexts: -------------------------------------------------------------------------------- 1 | # CEC 2 | genfscon sysfs /devices/platform/gpu/drm/card0/card0-HDMI-A-1/status u:object_r:sysfs_hdmi:s0 3 | genfscon sysfs /devices/platform/gpu/drm/card0/card0-HDMI-A-2/status u:object_r:sysfs_hdmi:s0 4 | 5 | # Graphics 6 | genfscon sysfs /devices/platform/v3dbus/fec00000.v3d u:object_r:sysfs_gpu:s0 7 | genfscon sysfs /devices/platform/gpu u:object_r:sysfs_gpu:s0 8 | 9 | # Lights 10 | genfscon sysfs /class/backlight/10-0045/brightness u:object_r:sysfs_leds:s0 11 | genfscon sysfs /class/backlight/10-0045/max_brightness u:object_r:sysfs_leds:s0 12 | genfscon sysfs /class/backlight/11-0045/brightness u:object_r:sysfs_leds:s0 13 | genfscon sysfs /class/backlight/11-0045/max_brightness u:object_r:sysfs_leds:s0 14 | genfscon sysfs /class/backlight/rpi_backlight/brightness u:object_r:sysfs_leds:s0 15 | genfscon sysfs /class/backlight/rpi_backlight/max_brightness u:object_r:sysfs_leds:s0 16 | 17 | # Serial number 18 | genfscon sysfs /firmware/devicetree/base/serial-number u:object_r:sysfs_dt_firmware_android:s0 19 | 20 | # Suspend 21 | genfscon sysfs /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/wakeup/wakeup0 u:object_r:sysfs_wakeup:s0 22 | -------------------------------------------------------------------------------- /audio/android.hardware.audio.service.rpi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.audio.core 4 | 3 5 | IModule/default 6 | 7 | 8 | android.hardware.audio.core 9 | 3 10 | IModule/r_submix 11 | 12 | 13 | android.hardware.audio.core 14 | 3 15 | IModule/bluetooth 16 | 17 | 18 | android.hardware.audio.core 19 | 3 20 | IConfig/default 21 | 22 | 29 | 30 | android.hardware.audio.core 31 | 3 32 | IModule/usb 33 | 34 | 35 | android.hardware.audio.effect 36 | 3 37 | IFactory/default 38 | 39 | 40 | -------------------------------------------------------------------------------- /audio/primary/PrimaryMixer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "alsa/Mixer.h" 20 | 21 | namespace aidl::android::hardware::audio::core::primary { 22 | 23 | class PrimaryMixer : public alsa::Mixer { 24 | public: 25 | static constexpr int kInvalidAlsaCard = -1; 26 | static constexpr int kInvalidAlsaDevice = -1; 27 | static constexpr int kAlsaCard = 0; 28 | static constexpr int kAlsaDevice = 0; 29 | 30 | static PrimaryMixer& getInstance(); 31 | 32 | private: 33 | PrimaryMixer() : alsa::Mixer(kAlsaCard) {} 34 | }; 35 | 36 | } // namespace aidl::android::hardware::audio::core::primary 37 | -------------------------------------------------------------------------------- /light/Lights.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 The Android Open Source Project 3 | * Copyright (C) 2023 KonstaKANG 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace aidl::android::hardware::light { 23 | 24 | class Lights : public BnLights { 25 | public: 26 | Lights(); 27 | 28 | ndk::ScopedAStatus setLightState(int id, const HwLightState& state) override; 29 | ndk::ScopedAStatus getLights(std::vector* types) override; 30 | 31 | private: 32 | uint32_t maxBrightness; 33 | uint32_t rgbToScaledBrightness(const HwLightState& state, uint32_t maxBrightness); 34 | }; 35 | 36 | } // aidl::android::hardware::light 37 | -------------------------------------------------------------------------------- /audio/libeffects/downmix/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Android Open Source Project 2 | // Copyright (C) 2025 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_library_shared { 7 | name: "libdownmixaidl_rpi", 8 | relative_install_path: "soundfx", 9 | vendor: true, 10 | srcs: [ 11 | ":effectCommonFileRpi", 12 | "aidl/DownmixContext.cpp", 13 | "aidl/EffectDownmix.cpp", 14 | ], 15 | shared_libs: [ 16 | "android.hardware.audio.effect-V3-ndk", 17 | "android.hardware.common-V2-ndk", 18 | "android.hardware.common.fmq-V1-ndk", 19 | "android.media.audio.common.types-V4-ndk", 20 | "libaudio_aidl_conversion_common_ndk", 21 | "libaudioaidlcommon", 22 | "libaudioutils", 23 | "libbase", 24 | "libbinder_ndk", 25 | "libcutils", 26 | "libfmq", 27 | "liblog", 28 | "libutils", 29 | ], 30 | header_libs: [ 31 | "libaudio_system_headers", 32 | "libaudioaidl_rpi_headers", 33 | "libaudioeffects", 34 | "libhardware_headers", 35 | "libsystem_headers", 36 | ], 37 | cflags: [ 38 | "-DBACKEND_NDK", 39 | "-Wall", 40 | "-Werror", 41 | "-Wextra", 42 | "-Wthread-safety", 43 | ], 44 | } 45 | -------------------------------------------------------------------------------- /health/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 The Android Open Source Project 3 | * Copyright (C) 2023 KonstaKANG 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "HealthImpl.h" 19 | 20 | #include 21 | #include 22 | 23 | using ::aidl::android::hardware::health::HalHealthLoop; 24 | using ::aidl::android::hardware::health::HealthImpl; 25 | 26 | int main() { 27 | auto config = std::make_unique(); 28 | android::hardware::health::InitHealthdConfig(config.get()); 29 | auto binder = ndk::SharedRefBase::make("default", std::move(config)); 30 | auto hal_health_loop = std::make_shared(binder, binder); 31 | return hal_health_loop->StartLoop(); 32 | } 33 | -------------------------------------------------------------------------------- /bluetooth/net_bluetooth_mgmt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * Copyright (C) 2024 KonstaKANG 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace aidl::android::hardware::bluetooth::impl { 23 | 24 | class NetBluetoothMgmt { 25 | public: 26 | NetBluetoothMgmt() {} 27 | ~NetBluetoothMgmt() { 28 | ::close(bt_fd_); 29 | } 30 | 31 | int openHci(int hci_interface = 0); 32 | void closeHci(); 33 | 34 | private: 35 | int waitHciDev(int hci_interface); 36 | int findRfKill(); 37 | int rfKill(int block); 38 | char *rfkill_state_; 39 | 40 | // File descriptor opened to the bluetooth user channel. 41 | int bt_fd_{-1}; 42 | }; 43 | 44 | } // namespace aidl::android::hardware::bluetooth::impl 45 | -------------------------------------------------------------------------------- /overlay/SettingsProviderTvRpiOverlay/res/values/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | Raspberry Pi 4 23 | 24 | 25 | 128 26 | 27 | 28 | 0 29 | 30 | 31 | true 32 | true 33 | 34 | 35 | -------------------------------------------------------------------------------- /audio/libeffects/visualizer/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Android Open Source Project 2 | // Copyright (C) 2025 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_library_shared { 7 | name: "libvisualizeraidl_rpi", 8 | relative_install_path: "soundfx", 9 | vendor: true, 10 | srcs: [ 11 | ":effectCommonFileRpi", 12 | "aidl/Visualizer.cpp", 13 | "aidl/VisualizerContext.cpp", 14 | ], 15 | shared_libs: [ 16 | "android.hardware.audio.effect-V3-ndk", 17 | "android.hardware.common-V2-ndk", 18 | "android.hardware.common.fmq-V1-ndk", 19 | "android.media.audio.common.types-V4-ndk", 20 | "libaudio_aidl_conversion_common_ndk", 21 | "libaudioaidlcommon", 22 | "libaudioutils", 23 | "libbase", 24 | "libbinder_ndk", 25 | "libcutils", 26 | "libfmq", 27 | "liblog", 28 | "libutils", 29 | ], 30 | header_libs: [ 31 | "libaudio_system_headers", 32 | "libaudioaidl_rpi_headers", 33 | "libaudioeffects", 34 | "libaudioutils_headers", 35 | "libsystem_headers", 36 | ], 37 | cflags: [ 38 | "-DBACKEND_NDK", 39 | "-DBUILD_FLOAT", 40 | "-DSUPPORT_MC", 41 | "-Wall", 42 | "-Werror", 43 | "-Wextra", 44 | "-Wthread-safety", 45 | ], 46 | } 47 | -------------------------------------------------------------------------------- /audio/libeffects/loudness/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Android Open Source Project 2 | // Copyright (C) 2025 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_library_shared { 7 | name: "libloudnessenhanceraidl_rpi", 8 | relative_install_path: "soundfx", 9 | vendor: true, 10 | srcs: [ 11 | ":effectCommonFileRpi", 12 | "aidl/EffectLoudnessEnhancer.cpp", 13 | "aidl/LoudnessEnhancerContext.cpp", 14 | "dsp/core/dynamic_range_compression.cpp", 15 | ], 16 | shared_libs: [ 17 | "android.hardware.audio.effect-V3-ndk", 18 | "android.hardware.common-V2-ndk", 19 | "android.hardware.common.fmq-V1-ndk", 20 | "android.media.audio.common.types-V4-ndk", 21 | "libaudio_aidl_conversion_common_ndk", 22 | "libaudioaidlcommon", 23 | "libaudioutils", 24 | "libbase", 25 | "libbinder_ndk", 26 | "libcutils", 27 | "libfmq", 28 | "liblog", 29 | "libutils", 30 | ], 31 | header_libs: [ 32 | "libaudio_system_headers", 33 | "libaudioaidl_rpi_headers", 34 | "libaudioeffects", 35 | "libhardware_headers", 36 | "libsystem_headers", 37 | ], 38 | cflags: [ 39 | "-DBACKEND_NDK", 40 | "-Wall", 41 | "-Werror", 42 | "-Wextra", 43 | "-Wthread-safety", 44 | ], 45 | } 46 | -------------------------------------------------------------------------------- /light/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 The Android Open Source Project 2 | // Copyright (C) 2023 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_binary { 7 | name: "android.hardware.light-service.rpi", 8 | relative_install_path: "hw", 9 | vendor: true, 10 | srcs: [ 11 | "Lights.cpp", 12 | "main.cpp", 13 | ], 14 | shared_libs: [ 15 | "android.hardware.light-V2-ndk", 16 | "libbase", 17 | "libbinder_ndk", 18 | ], 19 | installable: false, 20 | } 21 | 22 | prebuilt_etc { 23 | name: "android.hardware.light-service.rpi.rc", 24 | src: "android.hardware.light-service.rpi.rc", 25 | installable: false, 26 | } 27 | 28 | prebuilt_etc { 29 | name: "android.hardware.light-service.rpi.xml", 30 | src: "android.hardware.light-service.rpi.xml", 31 | sub_dir: "vintf", 32 | installable: false, 33 | } 34 | 35 | apex { 36 | name: "com.android.hardware.light.rpi4", 37 | manifest: "apex_manifest.json", 38 | file_contexts: "apex_file_contexts", 39 | key: "com.android.hardware.key", 40 | certificate: ":com.android.hardware.certificate", 41 | updatable: false, 42 | vendor: true, 43 | 44 | binaries: ["android.hardware.light-service.rpi"], 45 | prebuilts: [ 46 | "android.hardware.light-service.rpi.rc", 47 | "android.hardware.light-service.rpi.xml", 48 | ], 49 | } 50 | -------------------------------------------------------------------------------- /audio/libeffects/reverb/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Android Open Source Project 2 | // Copyright (C) 2025 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_library_shared { 7 | name: "libreverbaidl_rpi", 8 | relative_install_path: "soundfx", 9 | vendor: true, 10 | srcs: [ 11 | ":effectCommonFileRpi", 12 | "aidl/EffectReverb.cpp", 13 | "aidl/ReverbContext.cpp", 14 | ], 15 | local_include_dirs: ["aidl"], 16 | static_libs: [ 17 | "libreverb", 18 | ], 19 | shared_libs: [ 20 | "android.hardware.audio.effect-V3-ndk", 21 | "android.hardware.common-V2-ndk", 22 | "android.hardware.common.fmq-V1-ndk", 23 | "android.media.audio.common.types-V4-ndk", 24 | "libaudio_aidl_conversion_common_ndk", 25 | "libaudioaidlcommon", 26 | "libaudioutils", 27 | "libbase", 28 | "libbinder_ndk", 29 | "libcutils", 30 | "libfmq", 31 | "liblog", 32 | "libutils", 33 | ], 34 | header_libs: [ 35 | "libaudio_system_headers", 36 | "libaudioaidl_rpi_headers", 37 | "libaudioeffects", 38 | "libhardware_headers", 39 | "libsystem_headers", 40 | ], 41 | cflags: [ 42 | "-DBACKEND_NDK", 43 | "-Wall", 44 | "-Werror", 45 | "-Wextra", 46 | "-Wthread-safety", 47 | ], 48 | } 49 | -------------------------------------------------------------------------------- /light/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * Copyright (C) 2025 KonstaKANG 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "Lights.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | using ::aidl::android::hardware::light::Lights; 25 | 26 | int main() { 27 | ABinderProcess_setThreadPoolMaxThreadCount(0); 28 | std::shared_ptr lights = ndk::SharedRefBase::make(); 29 | 30 | const std::string instance = std::string() + Lights::descriptor + "/default"; 31 | binder_status_t status = AServiceManager_addService(lights->asBinder().get(), instance.c_str()); 32 | CHECK(status == STATUS_OK); 33 | 34 | ABinderProcess_joinThreadPool(); 35 | return EXIT_FAILURE; // should not reach 36 | } 37 | -------------------------------------------------------------------------------- /audio/include/core-impl/AidlConversionXsdc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace aidl::android::hardware::audio::core::internal { 25 | 26 | ConversionResult<::aidl::android::media::audio::common::AudioFormatDescription> 27 | xsdc2aidl_AudioFormatDescription(const std::string& xsdc); 28 | 29 | ConversionResult xsdc2aidl_SurroundSoundConfig( 30 | const ::android::audio::policy::configuration::SurroundSound& xsdc); 31 | 32 | } // namespace aidl::android::hardware::audio::core::internal 33 | -------------------------------------------------------------------------------- /hdmi/cec/HdmiCecPort.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 The Android Open Source Project 3 | * Copyright (C) 2025 KonstaKANG 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | 20 | namespace android { 21 | namespace hardware { 22 | namespace tv { 23 | namespace hdmi { 24 | namespace cec { 25 | namespace implementation { 26 | 27 | using ::aidl::android::hardware::tv::hdmi::cec::Result; 28 | 29 | class HdmiCecPort { 30 | public: 31 | HdmiCecPort(unsigned int portId); 32 | ~HdmiCecPort(); 33 | Result init(const char* path); 34 | void release(); 35 | 36 | unsigned int mPortId; 37 | int mCecFd; 38 | int mExitFd; 39 | }; 40 | 41 | } // namespace implementation 42 | } // namespace cec 43 | } // namespace hdmi 44 | } // namespace tv 45 | } // namespace hardware 46 | } // namespace android 47 | -------------------------------------------------------------------------------- /usb/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * Copyright (C) 2024 KonstaKANG 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "UsbGadget.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | using ::aidl::android::hardware::usb::gadget::UsbGadget; 25 | 26 | int main() { 27 | ABinderProcess_setThreadPoolMaxThreadCount(0); 28 | std::shared_ptr usbgadget = ndk::SharedRefBase::make(); 29 | 30 | const std::string instance = std::string() + UsbGadget::descriptor + "/default"; 31 | binder_status_t status = AServiceManager_addService(usbgadget->asBinder().get(), instance.c_str()); 32 | CHECK(status == STATUS_OK); 33 | 34 | ABinderProcess_joinThreadPool(); 35 | return EXIT_FAILURE; // should not reach 36 | } 37 | -------------------------------------------------------------------------------- /aosp_rpi4_tv.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2021-2023 KonstaKANG 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | 7 | DEVICE_PATH := device/brcm/rpi4 8 | 9 | # Inherit device configuration 10 | $(call inherit-product, device/brcm/rpi4/device.mk) 11 | 12 | PRODUCT_AAPT_PREF_CONFIG := xhdpi 13 | PRODUCT_CHARACTERISTICS := tv 14 | 15 | $(call inherit-product, device/google/atv/products/atv_base.mk) 16 | $(call enforce-product-packages-exist,com.android.ranging) 17 | 18 | # Android TV 19 | PRODUCT_PACKAGES += \ 20 | DocumentsUI \ 21 | LeanbackIME \ 22 | TvProvision \ 23 | TvSampleLeanbackLauncher \ 24 | TvSettingsTwoPanel 25 | 26 | # Bluetooth 27 | PRODUCT_VENDOR_PROPERTIES += \ 28 | bluetooth.device.class_of_device=34,4,36 29 | 30 | # Boot animation 31 | PRODUCT_COPY_FILES += \ 32 | device/google/atv/products/bootanimations/bootanimation.zip:$(TARGET_COPY_OUT_SYSTEM)/media/bootanimation.zip 33 | 34 | # Keylayout 35 | PRODUCT_COPY_FILES += \ 36 | $(DEVICE_PATH)/keylayout/Generic-tv.kl:$(TARGET_COPY_OUT_VENDOR)/usr/keylayout/Generic.kl 37 | 38 | # Overlays 39 | PRODUCT_PACKAGES += \ 40 | AndroidTvRpiOverlay \ 41 | BluetoothRpiOverlay \ 42 | SettingsProviderTvRpiOverlay \ 43 | WifiRpiOverlay 44 | 45 | # Device identifier. This must come after all inclusions. 46 | PRODUCT_DEVICE := rpi4 47 | PRODUCT_NAME := aosp_rpi4_tv 48 | PRODUCT_BRAND := Raspberry 49 | PRODUCT_MODEL := Pi 4 50 | PRODUCT_MANUFACTURER := Raspberry 51 | -------------------------------------------------------------------------------- /audio/libeffects/bundle/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Android Open Source Project 2 | // Copyright (C) 2025 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_library_shared { 7 | name: "libbundleaidl_rpi", 8 | relative_install_path: "soundfx", 9 | vendor: true, 10 | srcs: [ 11 | ":effectCommonFileRpi", 12 | "aidl/BundleContext.cpp", 13 | "aidl/EffectBundleAidl.cpp", 14 | ], 15 | local_include_dirs: ["aidl"], 16 | static_libs: [ 17 | "libmusicbundle", 18 | ], 19 | shared_libs: [ 20 | "android.hardware.audio.effect-V3-ndk", 21 | "android.hardware.common-V2-ndk", 22 | "android.hardware.common.fmq-V1-ndk", 23 | "android.media.audio.common.types-V4-ndk", 24 | "libaudio_aidl_conversion_common_ndk", 25 | "libaudioaidlcommon", 26 | "libaudioutils", 27 | "libbase", 28 | "libbinder_ndk", 29 | "libcutils", 30 | "libfmq", 31 | "liblog", 32 | "libstagefright_foundation", 33 | "libutils", 34 | ], 35 | header_libs: [ 36 | "libaudio_system_headers", 37 | "libaudioaidl_rpi_headers", 38 | "libaudioeffects", 39 | "libhardware_headers", 40 | "libsystem_headers", 41 | ], 42 | cflags: [ 43 | "-DBACKEND_NDK", 44 | "-Wall", 45 | "-Werror", 46 | "-Wextra", 47 | "-Wthread-safety", 48 | ], 49 | } 50 | -------------------------------------------------------------------------------- /bluetooth/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * Copyright (C) 2024 KonstaKANG 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "BluetoothHci.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | using ::aidl::android::hardware::bluetooth::impl::BluetoothHci; 25 | 26 | int main() { 27 | ABinderProcess_setThreadPoolMaxThreadCount(0); 28 | std::shared_ptr bluetooth = ndk::SharedRefBase::make(); 29 | 30 | const std::string instance = std::string() + BluetoothHci::descriptor + "/default"; 31 | binder_status_t status = AServiceManager_addService(bluetooth->asBinder().get(), instance.c_str()); 32 | CHECK(status == STATUS_OK); 33 | 34 | ABinderProcess_joinThreadPool(); 35 | return EXIT_FAILURE; // should not reach 36 | } 37 | -------------------------------------------------------------------------------- /audio/libeffects/dynamicsproc/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Android Open Source Project 2 | // Copyright (C) 2025 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_library_shared { 7 | name: "libdynamicsprocessingaidl_rpi", 8 | relative_install_path: "soundfx", 9 | vendor: true, 10 | srcs: [ 11 | ":effectCommonFileRpi", 12 | "aidl/DynamicsProcessing.cpp", 13 | "aidl/DynamicsProcessingContext.cpp", 14 | "dsp/DPBase.cpp", 15 | "dsp/DPFrequency.cpp", 16 | ], 17 | static_libs: [ 18 | "libaudioaidlranges", 19 | ], 20 | shared_libs: [ 21 | "android.hardware.audio.effect-V3-ndk", 22 | "android.hardware.common-V2-ndk", 23 | "android.hardware.common.fmq-V1-ndk", 24 | "android.media.audio.common.types-V4-ndk", 25 | "libaudio_aidl_conversion_common_ndk", 26 | "libaudioaidlcommon", 27 | "libaudioutils", 28 | "libbase", 29 | "libbinder_ndk", 30 | "libcutils", 31 | "libfmq", 32 | "liblog", 33 | "libutils", 34 | ], 35 | header_libs: [ 36 | "libaudio_system_headers", 37 | "libaudioaidl_rpi_headers", 38 | "libaudioeffects", 39 | "libeigen", 40 | "libsystem_headers", 41 | ], 42 | cflags: [ 43 | "-DBACKEND_NDK", 44 | "-Wall", 45 | "-Werror", 46 | "-Wextra", 47 | "-Wthread-safety", 48 | ], 49 | } 50 | -------------------------------------------------------------------------------- /hdmi/cec/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * Copyright (C) 2025 KonstaKANG 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "HdmiCec.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | using android::hardware::tv::hdmi::cec::implementation::HdmiCec; 25 | 26 | int main() { 27 | ABinderProcess_setThreadPoolMaxThreadCount(1); 28 | ABinderProcess_startThreadPool(); 29 | 30 | std::shared_ptr hdmiCecAidl = ndk::SharedRefBase::make(); 31 | const std::string instance = std::string() + HdmiCec::descriptor + "/default"; 32 | binder_status_t status = AServiceManager_addService(hdmiCecAidl->asBinder().get(), instance.c_str()); 33 | CHECK_EQ(status, STATUS_OK); 34 | 35 | ABinderProcess_joinThreadPool(); 36 | return EXIT_FAILURE; // should not reach 37 | } 38 | -------------------------------------------------------------------------------- /aosp_rpi4.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2021-2023 KonstaKANG 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | 7 | DEVICE_PATH := device/brcm/rpi4 8 | 9 | # Inherit device configuration 10 | $(call inherit-product, device/brcm/rpi4/device.mk) 11 | 12 | PRODUCT_AAPT_CONFIG := normal mdpi hdpi 13 | PRODUCT_AAPT_PREF_CONFIG := hdpi 14 | PRODUCT_CHARACTERISTICS := tablet,nosdcard 15 | 16 | $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk) 17 | $(call enforce-product-packages-exist,com.android.ranging) 18 | 19 | # Freeform windows 20 | PRODUCT_COPY_FILES += \ 21 | frameworks/native/data/etc/android.software.freeform_window_management.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.freeform_window_management.xml 22 | 23 | # Keylayout 24 | PRODUCT_COPY_FILES += \ 25 | $(DEVICE_PATH)/keylayout/Generic.kl:$(TARGET_COPY_OUT_VENDOR)/usr/keylayout/Generic.kl 26 | 27 | # Overlays 28 | PRODUCT_PACKAGES += \ 29 | AndroidRpiOverlay \ 30 | BluetoothRpiOverlay \ 31 | SettingsProviderRpiOverlay \ 32 | SettingsRpiOverlay \ 33 | SystemUIRpiOverlay \ 34 | WifiRpiOverlay 35 | 36 | # Permissions 37 | PRODUCT_COPY_FILES += \ 38 | frameworks/native/data/etc/tablet_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/tablet_core_hardware.xml 39 | 40 | # Device identifier. This must come after all inclusions. 41 | PRODUCT_DEVICE := rpi4 42 | PRODUCT_NAME := aosp_rpi4 43 | PRODUCT_BRAND := Raspberry 44 | PRODUCT_MODEL := Pi 4 45 | PRODUCT_MANUFACTURER := Raspberry 46 | -------------------------------------------------------------------------------- /hdmi/connection/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * Copyright (C) 2025 KonstaKANG 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "HdmiConnection.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | using android::hardware::tv::hdmi::connection::implementation::HdmiConnection; 25 | 26 | int main() { 27 | ABinderProcess_setThreadPoolMaxThreadCount(1); 28 | ABinderProcess_startThreadPool(); 29 | 30 | std::shared_ptr hdmiAidl = ndk::SharedRefBase::make(); 31 | const std::string instance = std::string() + HdmiConnection::descriptor + "/default"; 32 | binder_status_t status = AServiceManager_addService(hdmiAidl->asBinder().get(), instance.c_str()); 33 | CHECK_EQ(status, STATUS_OK); 34 | 35 | ABinderProcess_joinThreadPool(); 36 | return EXIT_FAILURE; // should not reach 37 | } 38 | -------------------------------------------------------------------------------- /usb/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 The Android Open Source Project 2 | // Copyright (C) 2024 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_binary { 7 | name: "android.hardware.usb.gadget-service.rpi", 8 | relative_install_path: "hw", 9 | vendor: true, 10 | srcs: [ 11 | "MonitorFfs.cpp", 12 | "UsbGadget.cpp", 13 | "UsbGadgetUtils.cpp", 14 | "main.cpp", 15 | ], 16 | shared_libs: [ 17 | "android.hardware.usb.gadget-V1-ndk", 18 | "libbase", 19 | "libbinder_ndk", 20 | "liblog", 21 | "libutils", 22 | ], 23 | installable: false, 24 | } 25 | 26 | prebuilt_etc { 27 | name: "android.hardware.usb.gadget-service.rpi.rc", 28 | src: "android.hardware.usb.gadget-service.rpi.rc", 29 | installable: false, 30 | } 31 | 32 | prebuilt_etc { 33 | name: "android.hardware.usb.gadget-service.rpi.xml", 34 | src: "android.hardware.usb.gadget-service.rpi.xml", 35 | sub_dir: "vintf", 36 | installable: false, 37 | } 38 | 39 | apex { 40 | name: "com.android.hardware.usb.gadget.rpi4", 41 | manifest: "apex_manifest.json", 42 | file_contexts: "apex_file_contexts", 43 | key: "com.android.hardware.key", 44 | certificate: ":com.android.hardware.certificate", 45 | updatable: false, 46 | vendor: true, 47 | 48 | binaries: ["android.hardware.usb.gadget-service.rpi"], 49 | prebuilts: [ 50 | "android.hardware.usb.gadget-service.rpi.rc", 51 | "android.hardware.usb.gadget-service.rpi.xml", 52 | ], 53 | } 54 | -------------------------------------------------------------------------------- /hdmi/connection/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 The Android Open Source Project 2 | // Copyright (C) 2025 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_binary { 7 | name: "android.hardware.tv.hdmi.connection-service.rpi", 8 | relative_install_path: "hw", 9 | vendor: true, 10 | srcs: [ 11 | "HdmiConnection.cpp", 12 | "main.cpp", 13 | ], 14 | shared_libs: [ 15 | "android.hardware.tv.hdmi.connection-V1-ndk", 16 | "libbase", 17 | "libbinder_ndk", 18 | "liblog", 19 | ], 20 | installable: false, 21 | } 22 | 23 | prebuilt_etc { 24 | name: "android.hardware.tv.hdmi.connection-service.rpi.rc", 25 | src: "android.hardware.tv.hdmi.connection-service.rpi.rc", 26 | installable: false, 27 | } 28 | 29 | prebuilt_etc { 30 | name: "android.hardware.tv.hdmi.connection-service.rpi.xml", 31 | src: "android.hardware.tv.hdmi.connection-service.rpi.xml", 32 | sub_dir: "vintf", 33 | installable: false, 34 | } 35 | 36 | apex { 37 | name: "com.android.hardware.tv.hdmi.connection.rpi4", 38 | manifest: "apex_manifest.json", 39 | file_contexts: "apex_file_contexts", 40 | key: "com.android.hardware.key", 41 | certificate: ":com.android.hardware.certificate", 42 | updatable: false, 43 | vendor: true, 44 | 45 | binaries: ["android.hardware.tv.hdmi.connection-service.rpi"], 46 | prebuilts: [ 47 | "android.hardware.tv.hdmi.connection-service.rpi.rc", 48 | "android.hardware.tv.hdmi.connection-service.rpi.xml", 49 | ], 50 | } 51 | -------------------------------------------------------------------------------- /hdmi/cec/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 The Android Open Source Project 2 | // Copyright (C) 2025 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_binary { 7 | name: "android.hardware.tv.hdmi.cec-service.rpi", 8 | relative_install_path: "hw", 9 | vendor: true, 10 | srcs: [ 11 | "HdmiCec.cpp", 12 | "HdmiCecPort.cpp", 13 | "main.cpp", 14 | ], 15 | shared_libs: [ 16 | "android.hardware.tv.hdmi.cec-V1-ndk", 17 | "libbase", 18 | "libbinder_ndk", 19 | "libcutils", 20 | "libhardware", 21 | "liblog", 22 | ], 23 | installable: false, 24 | } 25 | 26 | prebuilt_etc { 27 | name: "android.hardware.tv.hdmi.cec-service.rpi.rc", 28 | src: "android.hardware.tv.hdmi.cec-service.rpi.rc", 29 | installable: false, 30 | } 31 | 32 | prebuilt_etc { 33 | name: "android.hardware.tv.hdmi.cec-service.rpi.xml", 34 | src: "android.hardware.tv.hdmi.cec-service.rpi.xml", 35 | sub_dir: "vintf", 36 | installable: false, 37 | } 38 | 39 | apex { 40 | name: "com.android.hardware.tv.hdmi.cec.rpi4", 41 | manifest: "apex_manifest.json", 42 | file_contexts: "apex_file_contexts", 43 | key: "com.android.hardware.key", 44 | certificate: ":com.android.hardware.certificate", 45 | updatable: false, 46 | vendor: true, 47 | 48 | binaries: ["android.hardware.tv.hdmi.cec-service.rpi"], 49 | prebuilts: [ 50 | "android.hardware.tv.hdmi.cec-service.rpi.rc", 51 | "android.hardware.tv.hdmi.cec-service.rpi.xml", 52 | ], 53 | } 54 | -------------------------------------------------------------------------------- /health/HealthImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 The Android Open Source Project 3 | * Copyright (C) 2023 KonstaKANG 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | using ::aidl::android::hardware::health::Health; 23 | 24 | namespace aidl::android::hardware::health { 25 | 26 | class HealthImpl : public Health { 27 | public: 28 | using Health::Health; 29 | virtual ~HealthImpl() {} 30 | 31 | ndk::ScopedAStatus getChargeCounterUah(int32_t* out) override; 32 | ndk::ScopedAStatus getCurrentNowMicroamps(int32_t* out) override; 33 | ndk::ScopedAStatus getCurrentAverageMicroamps(int32_t* out) override; 34 | ndk::ScopedAStatus getCapacity(int32_t* out) override; 35 | ndk::ScopedAStatus getChargeStatus(BatteryStatus* out) override; 36 | ndk::ScopedAStatus getBatteryHealthData(BatteryHealthData* out) override; 37 | 38 | protected: 39 | void UpdateHealthInfo(HealthInfo* health_info) override; 40 | }; 41 | 42 | } // namespace aidl::android::hardware::health 43 | -------------------------------------------------------------------------------- /health/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 The Android Open Source Project 2 | // Copyright (C) 2023 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_binary { 7 | name: "android.hardware.health-service.rpi", 8 | relative_install_path: "hw", 9 | vendor: true, 10 | srcs: [ 11 | "HealthImpl.cpp", 12 | "main.cpp", 13 | ], 14 | static_libs: [ 15 | "libbatterymonitor", 16 | "libhealth_aidl_impl", 17 | "libhealthloop", 18 | ], 19 | shared_libs: [ 20 | "android.hardware.health-V4-ndk", 21 | "libbase", 22 | "libbinder_ndk", 23 | "libcutils", 24 | "liblog", 25 | "libutils", 26 | ], 27 | overrides: ["charger"], 28 | installable: false, 29 | } 30 | 31 | prebuilt_etc { 32 | name: "android.hardware.health-service.rpi.rc", 33 | src: "android.hardware.health-service.rpi.rc", 34 | installable: false, 35 | } 36 | 37 | prebuilt_etc { 38 | name: "android.hardware.health-service.rpi.xml", 39 | src: "android.hardware.health-service.rpi.xml", 40 | sub_dir: "vintf", 41 | installable: false, 42 | } 43 | 44 | apex { 45 | name: "com.android.hardware.health.rpi4", 46 | manifest: "apex_manifest.json", 47 | file_contexts: "apex_file_contexts", 48 | key: "com.android.hardware.key", 49 | certificate: ":com.android.hardware.certificate", 50 | updatable: false, 51 | vendor: true, 52 | 53 | binaries: ["android.hardware.health-service.rpi"], 54 | prebuilts: [ 55 | "android.hardware.health-service.rpi.rc", 56 | "android.hardware.health-service.rpi.xml", 57 | ], 58 | } 59 | -------------------------------------------------------------------------------- /bluetooth/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 The Android Open Source Project 2 | // Copyright (C) 2024 KonstaKANG 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | 6 | cc_binary { 7 | name: "android.hardware.bluetooth-service.rpi", 8 | relative_install_path: "hw", 9 | vendor: true, 10 | srcs: [ 11 | "BluetoothHci.cpp", 12 | "main.cpp", 13 | "net_bluetooth_mgmt.cpp", 14 | ], 15 | static_libs: [ 16 | "android.hardware.bluetooth.async", 17 | "android.hardware.bluetooth.hci", 18 | ], 19 | shared_libs: [ 20 | "android.hardware.bluetooth-V1-ndk", 21 | "libbase", 22 | "libbinder_ndk", 23 | "liblog", 24 | "libutils", 25 | ], 26 | installable: false, 27 | } 28 | 29 | prebuilt_etc { 30 | name: "android.hardware.bluetooth-service.rpi.rc", 31 | src: "android.hardware.bluetooth-service.rpi.rc", 32 | installable: false, 33 | } 34 | 35 | prebuilt_etc { 36 | name: "android.hardware.bluetooth-service.rpi.xml", 37 | src: "android.hardware.bluetooth-service.rpi.xml", 38 | sub_dir: "vintf", 39 | installable: false, 40 | } 41 | 42 | apex { 43 | name: "com.android.hardware.bluetooth.rpi4", 44 | manifest: "apex_manifest.json", 45 | file_contexts: "apex_file_contexts", 46 | key: "com.android.hardware.key", 47 | certificate: ":com.android.hardware.certificate", 48 | updatable: false, 49 | vendor: true, 50 | 51 | binaries: ["android.hardware.bluetooth-service.rpi"], 52 | prebuilts: [ 53 | "android.hardware.bluetooth-service.rpi.rc", 54 | "android.hardware.bluetooth-service.rpi.xml", 55 | ], 56 | } 57 | -------------------------------------------------------------------------------- /audio/include/core-impl/ModuleAlsa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "core-impl/Module.h" 20 | 21 | namespace aidl::android::hardware::audio::core { 22 | 23 | // This class is intended to be used as a base class for implementations 24 | // that use TinyAlsa. This can be either a primary module or a USB Audio 25 | // module. This class does not define a complete module implementation, 26 | // and should never be used on its own. Derived classes are expected to 27 | // provide necessary overrides for all interface methods omitted here. 28 | class ModuleAlsa : public Module { 29 | public: 30 | ModuleAlsa(Type type, std::unique_ptr&& config) 31 | : Module(type, std::move(config)) {} 32 | 33 | protected: 34 | // Extension methods of 'Module'. 35 | ndk::ScopedAStatus populateConnectedDevicePort( 36 | ::aidl::android::media::audio::common::AudioPort* audioPort, 37 | int32_t nextPortId) override; 38 | }; 39 | 40 | } // namespace aidl::android::hardware::audio::core 41 | -------------------------------------------------------------------------------- /overlay/SettingsProviderRpiOverlay/res/values/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | Raspberry Pi 4 23 | 24 | 25 | 128 26 | 27 | 28 | false 29 | 30 | 31 | 0 32 | 33 | 34 | true 35 | 36 | 37 | true 38 | 39 | 40 | true 41 | true 42 | 43 | 44 | -------------------------------------------------------------------------------- /overlay/SettingsRpiOverlay/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | false 23 | 24 | 25 | false 26 | 27 | 28 | false 29 | 30 | 31 | false 32 | 33 | 34 | false 35 | 36 | 37 | false 38 | 39 | 40 | -------------------------------------------------------------------------------- /ramdisk/ueventd.rpi4.rc: -------------------------------------------------------------------------------- 1 | # Bluetooth 2 | /dev/rfkill 0660 bluetooth bluetooth 3 | 4 | # Camera 5 | /dev/media* 0660 system camera 6 | /dev/v4l-subdev* 0660 system camera 7 | /dev/video* 0660 system camera 8 | 9 | # CEC 10 | /dev/cec0 0660 system graphics 11 | /dev/cec1 0660 system graphics 12 | 13 | # DMA 14 | /dev/dma_heap/linux,cma 0666 system graphics 15 | 16 | # FFmpeg 17 | /dev/media0 0660 media media 18 | /dev/video19 0660 media media 19 | 20 | # USB 21 | /sys/class/udc/fe980000.usb current_speed 0664 system system 22 | 23 | # V4L2 24 | /dev/media1 0660 media media 25 | /dev/video10 0660 media media 26 | /dev/video11 0660 media media 27 | /dev/video12 0660 media media 28 | /dev/video18 0660 media media 29 | /dev/video31 0660 media media 30 | -------------------------------------------------------------------------------- /audio/include/core-impl/Config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include "AudioPolicyConfigXmlConverter.h" 23 | #include "EngineConfigXmlConverter.h" 24 | 25 | namespace aidl::android::hardware::audio::core { 26 | static const std::string kEngineConfigFileName = "audio_policy_engine_configuration.xml"; 27 | 28 | class Config : public BnConfig { 29 | public: 30 | explicit Config(internal::AudioPolicyConfigXmlConverter& apConverter) 31 | : mAudioPolicyConverter(apConverter) {} 32 | 33 | private: 34 | ndk::ScopedAStatus getSurroundSoundConfig(SurroundSoundConfig* _aidl_return) override; 35 | ndk::ScopedAStatus getEngineConfig( 36 | aidl::android::media::audio::common::AudioHalEngineConfig* _aidl_return) override; 37 | 38 | internal::AudioPolicyConfigXmlConverter& mAudioPolicyConverter; 39 | internal::EngineConfigXmlConverter mEngConfigConverter{ 40 | ::android::audio_find_readable_configuration_file(kEngineConfigFileName.c_str())}; 41 | }; 42 | 43 | } // namespace aidl::android::hardware::audio::core 44 | -------------------------------------------------------------------------------- /car/evs_config_override.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "car" : { 4 | "width" : 76.7, 5 | "wheelBase" : 117.9, 6 | "frontExtent" : 44.7, 7 | "rearExtent" : 40 8 | }, 9 | "displays" : [ 10 | { 11 | "_comment": "Display0", 12 | "displayPort" : 0, 13 | "frontRange" : 100, 14 | "rearRange" : 100 15 | }, 16 | { 17 | "_comment": "Display1", 18 | "displayPort" : 1, 19 | "frontRange" : 100, 20 | "rearRange" : 100 21 | } 22 | ], 23 | "graphic" : { 24 | "frontPixel" : -20, 25 | "rearPixel" : 260 26 | }, 27 | "cameras" : [ 28 | { 29 | "cameraId" : "/dev/video0", 30 | "function" : "reverse", 31 | "x" : 0.0, 32 | "y" : 20.0, 33 | "z" : 48, 34 | "yaw" : 180, 35 | "pitch" : -10, 36 | "roll" : 0, 37 | "hfov" : 115, 38 | "vfov" : 80, 39 | "hflip" : true, 40 | "vflip" : false 41 | }, 42 | { 43 | "cameraId" : "1", 44 | "function" : "front", 45 | "x" : 0.0, 46 | "y" : 100.0, 47 | "z" : 48, 48 | "yaw" : 0, 49 | "pitch" : -10, 50 | "roll" : 0, 51 | "hfov" : 115, 52 | "vfov" : 80, 53 | "hflip" : false, 54 | "vflip" : false 55 | }, 56 | { 57 | "cameraId" : "2", 58 | "function" : "right", 59 | "x" : -25.0, 60 | "y" : 60.0, 61 | "z" : 88, 62 | "yaw" : -90, 63 | "pitch" : -10, 64 | "roll" : 0, 65 | "hfov" : 60, 66 | "vfov" : 62, 67 | "hflip" : false, 68 | "vflip" : false 69 | }, 70 | { 71 | "cameraId" : "3", 72 | "function" : "left", 73 | "x" : 20.0, 74 | "y" : 60.0, 75 | "z" : 88, 76 | "yaw" : 90, 77 | "pitch" : -10, 78 | "roll" : 0, 79 | "hfov" : 60, 80 | "vfov" : 62, 81 | "hflip" : false, 82 | "vflip" : false 83 | } 84 | ] 85 | } 86 | -------------------------------------------------------------------------------- /audio/include/effect-impl/EffectRange.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace aidl::android::hardware::audio::effect { 25 | 26 | template 27 | bool isInRange(const T& value, const T& low, const T& high) { 28 | return (value >= low) && (value <= high); 29 | } 30 | 31 | template 32 | bool isTupleInRange(const T& test, const T& min, const T& max, std::index_sequence) { 33 | return (isInRange(std::get(test), std::get(min), std::get(max)) && ...); 34 | } 35 | 36 | template > 37 | bool isTupleInRange(const T& test, const T& min, const T& max) { 38 | return isTupleInRange(test, min, max, std::make_index_sequence{}); 39 | } 40 | 41 | template 42 | bool isTupleInRange(const std::vector& cfgs, const T& min, const T& max, const F& func) { 43 | auto minT = func(min), maxT = func(max); 44 | return std::all_of(cfgs.cbegin(), cfgs.cend(), 45 | [&](const T& cfg) { return isTupleInRange(func(cfg), minT, maxT); }); 46 | } 47 | 48 | } // namespace aidl::android::hardware::audio::effect 49 | -------------------------------------------------------------------------------- /audio/include/core-impl/Telephony.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | 23 | namespace aidl::android::hardware::audio::core { 24 | 25 | class Telephony : public BnTelephony { 26 | public: 27 | Telephony(); 28 | 29 | private: 30 | ndk::ScopedAStatus getSupportedAudioModes( 31 | std::vector<::aidl::android::media::audio::common::AudioMode>* _aidl_return) override; 32 | ndk::ScopedAStatus switchAudioMode( 33 | ::aidl::android::media::audio::common::AudioMode in_mode) override; 34 | ndk::ScopedAStatus setTelecomConfig(const TelecomConfig& in_config, 35 | TelecomConfig* _aidl_return) override; 36 | 37 | const std::vector<::aidl::android::media::audio::common::AudioMode> mSupportedAudioModes = { 38 | ::aidl::android::media::audio::common::AudioMode::NORMAL, 39 | ::aidl::android::media::audio::common::AudioMode::RINGTONE, 40 | ::aidl::android::media::audio::common::AudioMode::IN_CALL, 41 | ::aidl::android::media::audio::common::AudioMode::IN_COMMUNICATION, 42 | // Omit CALL_SCREEN for a better VTS coverage. 43 | }; 44 | TelecomConfig mTelecomConfig; 45 | }; 46 | 47 | } // namespace aidl::android::hardware::audio::core 48 | -------------------------------------------------------------------------------- /media/media_codecs_v4l2_c2_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /overlay/AndroidTvRpiOverlay/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 22 | 128 23 | 24 | 26 | 20 27 | 28 | 31 | 20 32 | 33 | 35 | true 36 | 37 | 38 | false 39 | true 40 | 41 | 42 | -------------------------------------------------------------------------------- /audio/stub/StreamStub.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "AHAL_Stream" 18 | #include 19 | 20 | #include "core-impl/Module.h" 21 | #include "core-impl/StreamStub.h" 22 | 23 | using aidl::android::hardware::audio::common::SinkMetadata; 24 | using aidl::android::hardware::audio::common::SourceMetadata; 25 | using aidl::android::media::audio::common::AudioDevice; 26 | using aidl::android::media::audio::common::AudioOffloadInfo; 27 | using aidl::android::media::audio::common::MicrophoneInfo; 28 | 29 | namespace aidl::android::hardware::audio::core { 30 | 31 | StreamStub::StreamStub(StreamContext* context, const Metadata& metadata) 32 | : StreamCommonImpl(context, metadata), DriverStubImpl(getContext()) {} 33 | 34 | StreamStub::~StreamStub() { 35 | cleanupWorker(); 36 | } 37 | 38 | StreamInStub::StreamInStub(StreamContext&& context, const SinkMetadata& sinkMetadata, 39 | const std::vector& microphones) 40 | : StreamIn(std::move(context), microphones), StreamStub(&mContextInstance, sinkMetadata) {} 41 | 42 | StreamOutStub::StreamOutStub(StreamContext&& context, const SourceMetadata& sourceMetadata, 43 | const std::optional& offloadInfo) 44 | : StreamOut(std::move(context), offloadInfo), StreamStub(&mContextInstance, sourceMetadata) {} 45 | 46 | } // namespace aidl::android::hardware::audio::core 47 | -------------------------------------------------------------------------------- /audio/libeffects/loudness/aidl/LoudnessEnhancerContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include "dsp/core/dynamic_range_compression.h" 22 | #include "effect-impl/EffectContext.h" 23 | 24 | namespace aidl::android::hardware::audio::effect { 25 | 26 | enum LoudnessEnhancerState { 27 | LOUDNESS_ENHANCER_STATE_UNINITIALIZED, 28 | LOUDNESS_ENHANCER_STATE_INITIALIZED, 29 | LOUDNESS_ENHANCER_STATE_ACTIVE, 30 | }; 31 | 32 | class LoudnessEnhancerContext final : public EffectContext { 33 | public: 34 | LoudnessEnhancerContext(int statusDepth, const Parameter::Common& common); 35 | ~LoudnessEnhancerContext() = default; 36 | 37 | RetCode enable() override; 38 | RetCode disable() override; 39 | RetCode reset() override; 40 | RetCode setLeGain(int gainMb); 41 | int getLeGain() const { return mGain; } 42 | 43 | IEffect::Status process(float* in, float* out, int samples); 44 | 45 | private: 46 | LoudnessEnhancerState mState = LOUDNESS_ENHANCER_STATE_UNINITIALIZED; 47 | int mGain = LOUDNESS_ENHANCER_DEFAULT_TARGET_GAIN_MB; 48 | // In this implementation, there is no coupling between the compression on the left and right 49 | // channels 50 | std::unique_ptr mCompressor; 51 | 52 | void init_params(); 53 | }; 54 | } // namespace aidl::android::hardware::audio::effect 55 | -------------------------------------------------------------------------------- /audio/usb/UsbAlsaMixerControl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | #include "alsa/Mixer.h" 28 | 29 | namespace aidl::android::hardware::audio::core::usb { 30 | 31 | class UsbAlsaMixerControl { 32 | public: 33 | static UsbAlsaMixerControl& getInstance(); 34 | 35 | void setDeviceConnectionState(int card, bool masterMuted, float masterVolume, bool connected); 36 | 37 | // Master volume settings will be applied to all sound cards, it is only set by the 38 | // USB module. 39 | ndk::ScopedAStatus setMasterMute(bool muted); 40 | ndk::ScopedAStatus setMasterVolume(float volume); 41 | // The volume settings can be different on sound cards. It is controlled by streams. 42 | ndk::ScopedAStatus setVolumes(int card, const std::vector& volumes); 43 | 44 | private: 45 | std::shared_ptr getAlsaMixer(int card); 46 | std::map> getAlsaMixers(); 47 | 48 | std::mutex mLock; 49 | // A map whose key is the card number and value is a shared pointer to corresponding 50 | // AlsaMixer object. 51 | std::map> mMixerControls GUARDED_BY(mLock); 52 | }; 53 | 54 | } // namespace aidl::android::hardware::audio::core::usb 55 | -------------------------------------------------------------------------------- /audio/include/core-impl/StreamStub.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "core-impl/DriverStubImpl.h" 20 | #include "core-impl/Stream.h" 21 | 22 | namespace aidl::android::hardware::audio::core { 23 | 24 | class StreamStub : public StreamCommonImpl, public DriverStubImpl { 25 | public: 26 | StreamStub(StreamContext* context, const Metadata& metadata); 27 | ~StreamStub(); 28 | }; 29 | 30 | class StreamInStub final : public StreamIn, public StreamStub { 31 | public: 32 | friend class ndk::SharedRefBase; 33 | StreamInStub( 34 | StreamContext&& context, 35 | const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, 36 | const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones); 37 | 38 | private: 39 | void onClose(StreamDescriptor::State) override { defaultOnClose(); } 40 | }; 41 | 42 | class StreamOutStub final : public StreamOut, public StreamStub { 43 | public: 44 | friend class ndk::SharedRefBase; 45 | StreamOutStub(StreamContext&& context, 46 | const ::aidl::android::hardware::audio::common::SourceMetadata& sourceMetadata, 47 | const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo>& 48 | offloadInfo); 49 | 50 | private: 51 | void onClose(StreamDescriptor::State) override { defaultOnClose(); } 52 | }; 53 | 54 | } // namespace aidl::android::hardware::audio::core 55 | -------------------------------------------------------------------------------- /wifi/Android.bp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2025 KonstaKANG 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | prebuilt_etc { 6 | name: "android.hardware.wifi.hostapd-service.rc", 7 | src: "android.hardware.wifi.hostapd-service.rc", 8 | installable: false, 9 | } 10 | 11 | prebuilt_etc { 12 | name: "android.hardware.wifi.supplicant-service.rc", 13 | src: "android.hardware.wifi.supplicant-service.rc", 14 | installable: false, 15 | } 16 | 17 | prebuilt_etc { 18 | name: "wpa_supplicant.conf.rpi", 19 | src: ":wpa_supplicant_template.conf", 20 | filename: "wpa_supplicant.conf", 21 | relative_install_path: "wifi", 22 | installable: false, 23 | } 24 | 25 | prebuilt_etc { 26 | name: "wpa_supplicant_overlay.conf", 27 | src: "wpa_supplicant_overlay.conf", 28 | relative_install_path: "wifi", 29 | installable: false, 30 | } 31 | 32 | apex { 33 | name: "com.android.hardware.wifi.hostapd.rpi4", 34 | manifest: "apex_manifest_hostapd.json", 35 | file_contexts: "apex_file_contexts_hostapd", 36 | key: "com.android.hardware.key", 37 | certificate: ":com.android.hardware.certificate", 38 | updatable: false, 39 | vendor: true, 40 | 41 | binaries: [ 42 | "//external/wpa_supplicant_8/wpa_supplicant/wpa_supplicant:hostapd", 43 | ], 44 | prebuilts: [ 45 | "android.hardware.wifi.hostapd-service.rc", 46 | "android.hardware.wifi.hostapd.xml.prebuilt", 47 | ], 48 | } 49 | 50 | apex { 51 | name: "com.android.hardware.wifi.supplicant.rpi4", 52 | manifest: "apex_manifest_supplicant.json", 53 | file_contexts: "apex_file_contexts_supplicant", 54 | key: "com.android.hardware.key", 55 | certificate: ":com.android.hardware.certificate", 56 | updatable: false, 57 | vendor: true, 58 | 59 | binaries: [ 60 | "//external/wpa_supplicant_8/wpa_supplicant/wpa_supplicant:wpa_supplicant", 61 | ], 62 | prebuilts: [ 63 | "android.hardware.wifi.supplicant-service.rc", 64 | "android.hardware.wifi.supplicant.xml.prebuilt", 65 | "wpa_supplicant.conf.rpi", 66 | "wpa_supplicant_overlay.conf", 67 | ], 68 | } 69 | -------------------------------------------------------------------------------- /BoardConfig.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2021-2022 KonstaKANG 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | 7 | DEVICE_PATH := device/brcm/rpi4 8 | 9 | # Architecture 10 | TARGET_ARCH := arm64 11 | TARGET_ARCH_VARIANT := armv8-a 12 | TARGET_CPU_ABI := arm64-v8a 13 | TARGET_CPU_ABI2 := 14 | TARGET_CPU_VARIANT := generic 15 | 16 | # Bluetooth 17 | BOARD_HAVE_BLUETOOTH := true 18 | 19 | # Bootloader 20 | TARGET_NO_BOOTLOADER := true 21 | 22 | # Display 23 | TARGET_SCREEN_DENSITY := 240 24 | 25 | # Kernel 26 | BOARD_CUSTOM_BOOTIMG := true 27 | BOARD_CUSTOM_BOOTIMG_MK := $(DEVICE_PATH)/mkbootimg.mk 28 | BOARD_KERNEL_CMDLINE := console=ttyS0,115200 no_console_suspend root=/dev/ram0 rootwait androidboot.hardware=rpi4 29 | 30 | # Manifest 31 | DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := $(DEVICE_PATH)/framework_compatibility_matrix.xml 32 | DEVICE_MANIFEST_FILE := $(DEVICE_PATH)/manifest.xml 33 | PRODUCT_MANIFEST_FILES := $(DEVICE_PATH)/product_manifest.xml 34 | 35 | # Partition sizes 36 | BOARD_FLASH_BLOCK_SIZE := 4096 37 | BOARD_USES_METADATA_PARTITION := true 38 | BOARD_BOOTIMAGE_PARTITION_SIZE := 134217728 # 128M 39 | BOARD_METADATAIMAGE_PARTITION_SIZE := 16777216 # 16M 40 | BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3221225472 # 3072M 41 | BOARD_USERDATAIMAGE_PARTITION_SIZE := 134217728 # 128M 42 | BOARD_VENDORIMAGE_PARTITION_SIZE := 402653184 # 384M 43 | BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 44 | TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true 45 | TARGET_USERIMAGES_USE_EXT4 := true 46 | 47 | # Platform 48 | TARGET_BOARD_PLATFORM := bcm2711 49 | TARGET_BOOTLOADER_BOARD_NAME := bcm2711 50 | 51 | # Properties 52 | TARGET_VENDOR_PROP += $(DEVICE_PATH)/vendor.prop 53 | 54 | # Recovery 55 | TARGET_NO_RECOVERY := true 56 | 57 | # SELinux 58 | BOARD_SEPOLICY_DIRS += device/brcm/rpi4/sepolicy 59 | BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive 60 | 61 | # Treble 62 | TARGET_COPY_OUT_VENDOR := vendor 63 | 64 | # Wifi 65 | BOARD_WLAN_DEVICE := bcmdhd 66 | BOARD_HOSTAPD_DRIVER := NL80211 67 | BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE) 68 | BOARD_WPA_SUPPLICANT_DRIVER := NL80211 69 | BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE) 70 | WPA_SUPPLICANT_VERSION := VER_0_8_X 71 | -------------------------------------------------------------------------------- /audio/include/core-impl/DriverStubImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "core-impl/Stream.h" 20 | 21 | namespace aidl::android::hardware::audio::core { 22 | 23 | class DriverStubImpl : virtual public DriverInterface { 24 | public: 25 | explicit DriverStubImpl(const StreamContext& context) 26 | : DriverStubImpl(context, 500 /*asyncSleepTimeUs*/) {} 27 | DriverStubImpl(const StreamContext& context, int asyncSleepTimeUs); 28 | 29 | ::android::status_t init(DriverCallbackInterface* callback) override; 30 | ::android::status_t drain(StreamDescriptor::DrainMode) override; 31 | ::android::status_t flush() override; 32 | ::android::status_t pause() override; 33 | ::android::status_t standby() override; 34 | ::android::status_t start() override; 35 | ::android::status_t transfer(void* buffer, size_t frameCount, size_t* actualFrameCount, 36 | int32_t* latencyMs) override; 37 | void shutdown() override; 38 | 39 | protected: 40 | const size_t mBufferSizeFrames; 41 | const size_t mFrameSizeBytes; 42 | const int mSampleRate; 43 | const bool mIsAsynchronous; 44 | const bool mIsInput; 45 | const int32_t mMixPortHandle; 46 | const int mAsyncSleepTimeUs; 47 | bool mIsInitialized = false; // Used for validating the state machine logic. 48 | bool mIsStandby = true; // Used for validating the state machine logic. 49 | int64_t mStartTimeNs = 0; 50 | long mFramesSinceStart = 0; 51 | }; 52 | 53 | } // namespace aidl::android::hardware::audio::core 54 | -------------------------------------------------------------------------------- /audio/include/core-impl/ModuleStub.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "core-impl/Module.h" 20 | 21 | namespace aidl::android::hardware::audio::core { 22 | 23 | class ModuleStub final : public Module { 24 | public: 25 | ModuleStub(std::unique_ptr&& config) : Module(Type::STUB, std::move(config)) {} 26 | 27 | protected: 28 | ndk::ScopedAStatus getBluetooth(std::shared_ptr* _aidl_return) override; 29 | ndk::ScopedAStatus getBluetoothA2dp(std::shared_ptr* _aidl_return) override; 30 | ndk::ScopedAStatus getBluetoothLe(std::shared_ptr* _aidl_return) override; 31 | 32 | ndk::ScopedAStatus createInputStream( 33 | StreamContext&& context, 34 | const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, 35 | const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones, 36 | std::shared_ptr* result) override; 37 | ndk::ScopedAStatus createOutputStream( 38 | StreamContext&& context, 39 | const ::aidl::android::hardware::audio::common::SourceMetadata& sourceMetadata, 40 | const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo>& 41 | offloadInfo, 42 | std::shared_ptr* result) override; 43 | 44 | private: 45 | ChildInterface mBluetooth; 46 | ChildInterface mBluetoothA2dp; 47 | ChildInterface mBluetoothLe; 48 | }; 49 | 50 | } // namespace aidl::android::hardware::audio::core 51 | -------------------------------------------------------------------------------- /audio/libeffects/downmix/aidl/DownmixContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "effect-impl/EffectContext.h" 20 | 21 | #include 22 | 23 | namespace aidl::android::hardware::audio::effect { 24 | 25 | enum DownmixState { 26 | DOWNMIX_STATE_UNINITIALIZED, 27 | DOWNMIX_STATE_INITIALIZED, 28 | DOWNMIX_STATE_ACTIVE, 29 | }; 30 | 31 | class DownmixContext final : public EffectContext { 32 | public: 33 | DownmixContext(int statusDepth, const Parameter::Common& common); 34 | ~DownmixContext(); 35 | RetCode enable() override; 36 | RetCode disable() override; 37 | 38 | RetCode setDmType(Downmix::Type type) { 39 | mType = type; 40 | return RetCode::SUCCESS; 41 | } 42 | Downmix::Type getDmType() const { return mType; } 43 | 44 | RetCode setOutputDevice( 45 | const std::vector<::aidl::android::media::audio::common::AudioDeviceDescription>& 46 | device) override { 47 | // FIXME change type if playing on headset vs speaker 48 | mOutputDevice = device; 49 | return RetCode::SUCCESS; 50 | } 51 | 52 | IEffect::Status downmixProcess(float* in, float* out, int samples); 53 | 54 | static bool validateCommonConfig(const Parameter::Common& common); 55 | 56 | private: 57 | DownmixState mState; 58 | Downmix::Type mType; 59 | ::aidl::android::media::audio::common::AudioChannelLayout mChMask; 60 | ::android::audio_utils::channels::ChannelMix mChannelMix; 61 | 62 | // Common Params 63 | void init_params(const Parameter::Common& common); 64 | }; 65 | 66 | } // namespace aidl::android::hardware::audio::effect 67 | -------------------------------------------------------------------------------- /audio/libeffects/loudness/aidl/EffectLoudnessEnhancer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include "effect-impl/EffectImpl.h" 22 | #include "LoudnessEnhancerContext.h" 23 | 24 | namespace aidl::android::hardware::audio::effect { 25 | 26 | class LoudnessEnhancerImpl final : public EffectImpl { 27 | public: 28 | static const std::string kEffectName; 29 | static const Descriptor kDescriptor; 30 | LoudnessEnhancerImpl() = default; 31 | ~LoudnessEnhancerImpl() { cleanUp(); } 32 | 33 | ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override; 34 | ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) 35 | REQUIRES(mImplMutex) override; 36 | ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific) 37 | REQUIRES(mImplMutex) override; 38 | IEffect::Status effectProcessImpl(float* in, float* out, int process) 39 | REQUIRES(mImplMutex) override; 40 | std::shared_ptr createContext(const Parameter::Common& common) 41 | REQUIRES(mImplMutex) override; 42 | RetCode releaseContext() REQUIRES(mImplMutex) override; 43 | 44 | std::string getEffectName() override { return kEffectName; } 45 | 46 | private: 47 | std::shared_ptr mContext GUARDED_BY(mImplMutex); 48 | ndk::ScopedAStatus getParameterLoudnessEnhancer(const LoudnessEnhancer::Tag& tag, 49 | Parameter::Specific* specific) 50 | REQUIRES(mImplMutex); 51 | }; 52 | 53 | } // namespace aidl::android::hardware::audio::effect 54 | -------------------------------------------------------------------------------- /audio/libeffects/visualizer/aidl/Visualizer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include "effect-impl/EffectImpl.h" 22 | 23 | #include "VisualizerContext.h" 24 | 25 | namespace aidl::android::hardware::audio::effect { 26 | 27 | class VisualizerImpl final : public EffectImpl { 28 | public: 29 | static const std::string kEffectName; 30 | static const Capability kCapability; 31 | static const Descriptor kDescriptor; 32 | VisualizerImpl() = default; 33 | ~VisualizerImpl() { cleanUp(); } 34 | 35 | ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override; 36 | ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) 37 | REQUIRES(mImplMutex) override; 38 | ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific) 39 | REQUIRES(mImplMutex) override; 40 | IEffect::Status effectProcessImpl(float* in, float* out, int process) 41 | REQUIRES(mImplMutex) override; 42 | std::shared_ptr createContext(const Parameter::Common& common) 43 | REQUIRES(mImplMutex) override; 44 | RetCode releaseContext() REQUIRES(mImplMutex) override; 45 | 46 | std::string getEffectName() override { return kEffectName; } 47 | 48 | private: 49 | static const std::vector kRanges; 50 | std::shared_ptr mContext GUARDED_BY(mImplMutex); 51 | ndk::ScopedAStatus getParameterVisualizer(const Visualizer::Tag& tag, 52 | Parameter::Specific* specific) REQUIRES(mImplMutex); 53 | }; 54 | 55 | } // namespace aidl::android::hardware::audio::effect 56 | -------------------------------------------------------------------------------- /audio/libeffects/downmix/aidl/EffectDownmix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include "DownmixContext.h" 23 | #include "effect-impl/EffectImpl.h" 24 | 25 | namespace aidl::android::hardware::audio::effect { 26 | 27 | class DownmixImpl final : public EffectImpl { 28 | public: 29 | static const std::string kEffectName; 30 | static const Descriptor kDescriptor; 31 | DownmixImpl() = default; 32 | ~DownmixImpl() { cleanUp(); } 33 | 34 | ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override; 35 | ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) 36 | REQUIRES(mImplMutex) override; 37 | ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific) 38 | REQUIRES(mImplMutex) override; 39 | IEffect::Status effectProcessImpl(float* in, float* out, int process) 40 | REQUIRES(mImplMutex) override; 41 | std::shared_ptr createContext(const Parameter::Common& common) 42 | REQUIRES(mImplMutex) override; 43 | RetCode releaseContext() REQUIRES(mImplMutex) override; 44 | 45 | std::string getEffectName() override { return kEffectName; } 46 | 47 | // downmix override the process because of different input/output sample size requirement 48 | void process() override; 49 | 50 | private: 51 | std::shared_ptr mContext GUARDED_BY(mImplMutex); 52 | ndk::ScopedAStatus getParameterDownmix(const Downmix::Tag& tag, Parameter::Specific* specific) 53 | REQUIRES(mImplMutex); 54 | }; 55 | } // namespace aidl::android::hardware::audio::effect 56 | -------------------------------------------------------------------------------- /audio/include/effect-impl/EffectThread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include "effect-impl/EffectContext.h" 28 | #include "effect-impl/EffectTypes.h" 29 | 30 | namespace aidl::android::hardware::audio::effect { 31 | 32 | class EffectThread { 33 | public: 34 | virtual ~EffectThread(); 35 | 36 | // called by effect implementation 37 | RetCode createThread(const std::string& name, int priority = ANDROID_PRIORITY_URGENT_AUDIO); 38 | RetCode destroyThread(); 39 | RetCode startThread(); 40 | RetCode stopThread(); 41 | RetCode startDraining(); 42 | RetCode finishDraining(); 43 | 44 | // Will call process() in a loop if the thread is running. 45 | void threadLoop(); 46 | 47 | /** 48 | * process() call effectProcessImpl() for effect data processing, it is necessary for the 49 | * processing to be called under Effect thread mutex mThreadMutex, to avoid the effect state 50 | * change before/during data processing, and keep the thread and effect state consistent. 51 | */ 52 | virtual void process() = 0; 53 | 54 | protected: 55 | bool mDraining GUARDED_BY(mThreadMutex) = false; 56 | 57 | private: 58 | static constexpr int kMaxTaskNameLen = 15; 59 | 60 | std::mutex mThreadMutex; 61 | std::condition_variable mCv; 62 | bool mStop GUARDED_BY(mThreadMutex) = true; 63 | bool mExit GUARDED_BY(mThreadMutex) = false; 64 | 65 | std::thread mThread; 66 | int mPriority; 67 | std::string mName; 68 | }; 69 | } // namespace aidl::android::hardware::audio::effect 70 | -------------------------------------------------------------------------------- /audio/include/core-impl/ChildInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace aidl::android::hardware::audio::core { 27 | 28 | // Helper used for interfaces that require a persistent instance. We hold them via a strong 29 | // pointer. The binder token is retained for a call to 'setMinSchedulerPolicy'. 30 | template 31 | struct ChildInterface : private std::pair, ndk::SpAIBinder> { 32 | ChildInterface() = default; 33 | ChildInterface& operator=(const std::shared_ptr& c) { 34 | return operator=(std::shared_ptr(c)); 35 | } 36 | ChildInterface& operator=(std::shared_ptr&& c) { 37 | this->first = std::move(c); 38 | return *this; 39 | } 40 | explicit operator bool() const { return !!this->first; } 41 | C& operator*() const { return *(this->first); } 42 | C* operator->() const { return this->first; } 43 | std::shared_ptr getPtr() { return this->first; } 44 | // Use 'getInstance' when returning the interface instance. 45 | std::shared_ptr getInstance() { 46 | (void)getBinder(); 47 | return this->first; 48 | } 49 | AIBinder* getBinder() { 50 | if (this->second.get() == nullptr) { 51 | const auto binder = this->second = this->first->asBinder(); 52 | AIBinder_setMinSchedulerPolicy(binder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO); 53 | AIBinder_setInheritRt(binder.get(), true); 54 | } 55 | return this->second.get(); 56 | } 57 | }; 58 | 59 | } // namespace aidl::android::hardware::audio::core 60 | -------------------------------------------------------------------------------- /audio/stub/ApeHeader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace aidl::android::hardware::audio::core { 22 | 23 | // Simplified APE (Monkey Audio) header definition sufficient to figure out 24 | // the basic parameters of the encoded file. Only supports the "current" 25 | // versions of the header (>= 3980). 26 | 27 | #pragma pack(push, 4) 28 | 29 | // Only the beginning of the descriptor is needed to find the header which 30 | // follows the descriptor. 31 | struct ApeDescriptor { 32 | uint32_t signature; // 'MAC ' or 'MACF' 33 | uint16_t version; 34 | uint16_t padding; 35 | uint32_t descriptorSizeBytes; 36 | uint32_t headerSizeBytes; 37 | }; 38 | 39 | struct ApeHeader { 40 | uint16_t compressionLevel; 41 | uint16_t flags; 42 | uint32_t blocksPerFrame; // "frames" are encoder frames, while "blocks" are audio frames 43 | uint32_t lastFrameBlocks; // number of "blocks" in the last encoder "frame" 44 | uint32_t totalFrames; // total number of encoder "frames" 45 | uint16_t bitsPerSample; 46 | uint16_t channelCount; 47 | uint32_t sampleRate; 48 | }; 49 | 50 | #pragma pack(pop) 51 | 52 | // Tries to find APE descriptor and header in the buffer. Returns the position 53 | // after the header or nullptr if it was not found. 54 | void* findApeHeader(void* buffer, size_t bufferSizeBytes, ApeHeader** header); 55 | 56 | // Clip duration in audio frames ("blocks" in the APE terminology). 57 | inline int64_t getApeClipDurationFrames(const ApeHeader* header) { 58 | return header->totalFrames != 0 59 | ? (header->totalFrames - 1) * header->blocksPerFrame + header->lastFrameBlocks 60 | : 0; 61 | } 62 | 63 | } // namespace aidl::android::hardware::audio::core 64 | -------------------------------------------------------------------------------- /car/car_audio_configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /overlay/WifiRpiOverlay/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 25 | true 26 | 27 | 31 | true 32 | 33 | 34 | true 35 | 36 | 37 | Raspberry Pi 4 38 | 39 | 40 | 43 | 0 44 | 45 | 46 | -------------------------------------------------------------------------------- /audio/AidlConversionXsdc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "AHAL_AidlXsdc" 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "core-impl/AidlConversionXsdc.h" 24 | 25 | using aidl::android::media::audio::common::AudioFormatDescription; 26 | 27 | namespace xsd = android::audio::policy::configuration; 28 | 29 | namespace aidl::android::hardware::audio::core::internal { 30 | 31 | ConversionResult xsdc2aidl_AudioFormatDescription(const std::string& xsdc) { 32 | return legacy2aidl_audio_format_t_AudioFormatDescription(::android::formatFromString(xsdc)); 33 | } 34 | 35 | ConversionResult xsdc2aidl_SurroundFormatFamily( 36 | const ::xsd::SurroundFormats::Format& xsdc) { 37 | SurroundSoundConfig::SurroundFormatFamily aidl; 38 | aidl.primaryFormat = VALUE_OR_RETURN(xsdc2aidl_AudioFormatDescription(xsdc.getName())); 39 | if (xsdc.hasSubformats()) { 40 | aidl.subFormats = VALUE_OR_RETURN(convertContainer>( 41 | xsdc.getSubformats(), xsdc2aidl_AudioFormatDescription)); 42 | } 43 | return aidl; 44 | } 45 | 46 | ConversionResult xsdc2aidl_SurroundSoundConfig( 47 | const ::xsd::SurroundSound& xsdc) { 48 | SurroundSoundConfig aidl; 49 | if (!xsdc.hasFormats() || !xsdc.getFirstFormats()->hasFormat()) return aidl; 50 | aidl.formatFamilies = VALUE_OR_RETURN( 51 | convertContainer>( 52 | xsdc.getFirstFormats()->getFormat(), xsdc2aidl_SurroundFormatFamily)); 53 | return aidl; 54 | } 55 | 56 | } // namespace aidl::android::hardware::audio::core::internal 57 | -------------------------------------------------------------------------------- /hdmi/connection/HdmiConnection.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * Copyright (C) 2025 KonstaKANG 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | using namespace std; 24 | 25 | namespace android { 26 | namespace hardware { 27 | namespace tv { 28 | namespace hdmi { 29 | namespace connection { 30 | namespace implementation { 31 | 32 | using ::aidl::android::hardware::tv::hdmi::connection::BnHdmiConnection; 33 | using ::aidl::android::hardware::tv::hdmi::connection::HdmiPortInfo; 34 | using ::aidl::android::hardware::tv::hdmi::connection::HdmiPortType; 35 | using ::aidl::android::hardware::tv::hdmi::connection::HpdSignal; 36 | using ::aidl::android::hardware::tv::hdmi::connection::IHdmiConnection; 37 | using ::aidl::android::hardware::tv::hdmi::connection::IHdmiConnectionCallback; 38 | using ::aidl::android::hardware::tv::hdmi::connection::Result; 39 | 40 | struct HdmiConnection : public BnHdmiConnection { 41 | HdmiConnection(); 42 | ~HdmiConnection(); 43 | ::ndk::ScopedAStatus getPortInfo(std::vector* _aidl_return) override; 44 | ::ndk::ScopedAStatus isConnected(int32_t portId, bool* _aidl_return) override; 45 | ::ndk::ScopedAStatus setCallback( 46 | const std::shared_ptr& callback) override; 47 | ::ndk::ScopedAStatus setHpdSignal(HpdSignal signal, int32_t portId) override; 48 | ::ndk::ScopedAStatus getHpdSignal(int32_t portId, HpdSignal* _aidl_return) override; 49 | 50 | private: 51 | std::vector mPortInfos; 52 | std::vector mHpdSignal; 53 | 54 | std::shared_ptr mCallback; 55 | }; 56 | 57 | } // namespace implementation 58 | } // namespace connection 59 | } // namespace hdmi 60 | } // Namespace tv 61 | } // namespace hardware 62 | } // namespace android 63 | -------------------------------------------------------------------------------- /audio/include/core-impl/ModulePrimary.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "core-impl/Module.h" 20 | 21 | namespace aidl::android::hardware::audio::core { 22 | 23 | class ModulePrimary final : public Module { 24 | public: 25 | ModulePrimary(std::unique_ptr&& config) 26 | : Module(Type::DEFAULT, std::move(config)) {} 27 | 28 | protected: 29 | ndk::ScopedAStatus getTelephony(std::shared_ptr* _aidl_return) override; 30 | 31 | ndk::ScopedAStatus calculateBufferSizeFrames( 32 | const ::aidl::android::media::audio::common::AudioFormatDescription& format, 33 | int32_t latencyMs, int32_t sampleRateHz, int32_t* bufferSizeFrames) override; 34 | ndk::ScopedAStatus createInputStream( 35 | StreamContext&& context, 36 | const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, 37 | const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones, 38 | std::shared_ptr* result) override; 39 | ndk::ScopedAStatus createOutputStream( 40 | StreamContext&& context, 41 | const ::aidl::android::hardware::audio::common::SourceMetadata& sourceMetadata, 42 | const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo>& 43 | offloadInfo, 44 | std::shared_ptr* result) override; 45 | ndk::ScopedAStatus createMmapBuffer( 46 | const ::aidl::android::media::audio::common::AudioPortConfig& portConfig, 47 | int32_t bufferSizeFrames, int32_t frameSizeBytes, MmapBufferDescriptor* desc) override; 48 | int32_t getNominalLatencyMs( 49 | const ::aidl::android::media::audio::common::AudioPortConfig& portConfig) override; 50 | 51 | private: 52 | ChildInterface mTelephony; 53 | }; 54 | 55 | } // namespace aidl::android::hardware::audio::core 56 | -------------------------------------------------------------------------------- /audio/libeffects/dynamicsproc/dsp/SHCircularBuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SHCIRCULARBUFFER_H 18 | #define SHCIRCULARBUFFER_H 19 | 20 | #include 21 | #include 22 | 23 | template 24 | class SHCircularBuffer { 25 | 26 | public: 27 | SHCircularBuffer() : mReadIndex(0), mWriteIndex(0), mReadAvailable(0) { 28 | } 29 | 30 | explicit SHCircularBuffer(size_t maxSize) { 31 | resize(maxSize); 32 | } 33 | void resize(size_t maxSize) { 34 | mBuffer.resize(maxSize); 35 | mReadIndex = 0; 36 | mWriteIndex = 0; 37 | mReadAvailable = 0; 38 | } 39 | inline void write(T value) { 40 | if (availableToWrite()) { 41 | mBuffer[mWriteIndex++] = value; 42 | if (mWriteIndex >= getSize()) { 43 | mWriteIndex = 0; 44 | } 45 | mReadAvailable++; 46 | } else { 47 | ALOGE("Error: SHCircularBuffer no space to write. allocated size %zu ", getSize()); 48 | } 49 | } 50 | inline T read() { 51 | T value = T(); 52 | if (availableToRead()) { 53 | value = mBuffer[mReadIndex++]; 54 | if (mReadIndex >= getSize()) { 55 | mReadIndex = 0; 56 | } 57 | mReadAvailable--; 58 | } else { 59 | ALOGW("Warning: SHCircularBuffer no data available to read. Default value returned"); 60 | } 61 | return value; 62 | } 63 | inline size_t availableToRead() const { 64 | return mReadAvailable; 65 | } 66 | inline size_t availableToWrite() const { 67 | return getSize() - mReadAvailable; 68 | } 69 | inline size_t getSize() const { 70 | return mBuffer.size(); 71 | } 72 | 73 | private: 74 | std::vector mBuffer; 75 | size_t mReadIndex; 76 | size_t mWriteIndex; 77 | size_t mReadAvailable; 78 | }; 79 | 80 | 81 | #endif //SHCIRCULARBUFFER_H 82 | -------------------------------------------------------------------------------- /bluetooth/BluetoothHci.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * Copyright (C) 2024 KonstaKANG 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | #include "async_fd_watcher.h" 24 | #include "h4_protocol.h" 25 | #include "net_bluetooth_mgmt.h" 26 | 27 | namespace aidl::android::hardware::bluetooth::impl { 28 | 29 | class BluetoothDeathRecipient; 30 | 31 | // This Bluetooth HAL implementation connects with a serial port at dev_path_. 32 | class BluetoothHci : public BnBluetoothHci { 33 | public: 34 | BluetoothHci(); 35 | 36 | ndk::ScopedAStatus initialize( 37 | const std::shared_ptr& cb) override; 38 | 39 | ndk::ScopedAStatus sendHciCommand( 40 | const std::vector& packet) override; 41 | 42 | ndk::ScopedAStatus sendAclData(const std::vector& packet) override; 43 | 44 | ndk::ScopedAStatus sendScoData(const std::vector& packet) override; 45 | 46 | ndk::ScopedAStatus sendIsoData(const std::vector& packet) override; 47 | 48 | ndk::ScopedAStatus close() override; 49 | 50 | private: 51 | int mFd{-1}; 52 | std::shared_ptr mCb = nullptr; 53 | 54 | std::shared_ptr<::android::hardware::bluetooth::hci::H4Protocol> mH4; 55 | 56 | std::shared_ptr mDeathRecipient; 57 | 58 | ::android::hardware::bluetooth::async::AsyncFdWatcher mFdWatcher; 59 | 60 | [[nodiscard]] ndk::ScopedAStatus send( 61 | ::android::hardware::bluetooth::hci::PacketType type, 62 | const std::vector& packet); 63 | std::unique_ptr management_{}; 64 | 65 | // Don't close twice or open before close is complete 66 | std::mutex mStateMutex; 67 | enum class HalState { 68 | READY, 69 | INITIALIZING, 70 | ONE_CLIENT, 71 | CLOSING, 72 | } mState{HalState::READY}; 73 | }; 74 | 75 | } // namespace aidl::android::hardware::bluetooth::impl 76 | -------------------------------------------------------------------------------- /vendor.prop: -------------------------------------------------------------------------------- 1 | # Audio 2 | persist.vendor.audio.device=jack 3 | ro.boot.audio.tinyalsa.simulate_input=true 4 | ro.config.media_vol_default=20 5 | ro.config.media_vol_steps=25 6 | 7 | # Bluetooth 8 | bluetooth.device.class_of_device?=90,2,12 9 | bluetooth.device.default_name=Raspberry Pi 4 10 | bluetooth.profile.a2dp.sink.enabled?=true 11 | bluetooth.profile.a2dp.source.enabled?=true 12 | bluetooth.profile.asha.central.enabled?=true 13 | bluetooth.profile.avrcp.controller.enabled?=true 14 | bluetooth.profile.avrcp.target.enabled?=true 15 | bluetooth.profile.bap.broadcast.assist.enabled?=true 16 | bluetooth.profile.bap.unicast.client.enabled?=true 17 | bluetooth.profile.bas.client.enabled?=true 18 | bluetooth.profile.ccp.server.enabled?=true 19 | bluetooth.profile.csip.set_coordinator.enabled?=true 20 | bluetooth.profile.gatt.enabled?=true 21 | bluetooth.profile.hap.client.enabled?=true 22 | bluetooth.profile.hfp.ag.enabled?=true 23 | bluetooth.profile.hid.device.enabled?=true 24 | bluetooth.profile.hid.host.enabled?=true 25 | bluetooth.profile.map.server.enabled?=true 26 | bluetooth.profile.mcp.server.enabled?=true 27 | bluetooth.profile.opp.enabled?=true 28 | bluetooth.profile.pan.nap.enabled?=true 29 | bluetooth.profile.pan.panu.enabled?=true 30 | bluetooth.profile.pbap.server.enabled?=true 31 | bluetooth.profile.sap.server.enabled?=true 32 | bluetooth.profile.vcp.controller.enabled?=true 33 | persist.bluetooth.a2dp_aac.vbr_supported=true 34 | 35 | # CEC 36 | persist.vendor.hdmi.cec_device=cec0 37 | ro.hdmi.cec_device_types=playback_device 38 | ro.hdmi.device_type=4 39 | 40 | # Chipset 41 | ro.soc.manufacturer=Broadcom 42 | ro.soc.model=BCM2711 43 | 44 | # FFmpeg 45 | persist.vendor.ffmpeg_codec2.rank.audio=16 46 | persist.vendor.ffmpeg_codec2.rank.video=256 47 | persist.vendor.ffmpeg_codec2.v4l2.h264=false 48 | persist.vendor.ffmpeg_codec2.v4l2.h265=true 49 | 50 | # Graphics 51 | vendor.hwc.drm.ctm=DRM_OR_IGNORE 52 | vendor.hwc.drm.disable_hdr=1 53 | vendor.hwc.drm.force_mode=1920x1080 54 | 55 | # Lockscreen 56 | ro.lockscreen.disable.default=true 57 | 58 | # Media 59 | debug.stagefright.c2inputsurface=-1 60 | media.c2.hal.selection=aidl 61 | 62 | # MGLRU 63 | persist.device_config.mglru_native.lru_gen_config=core 64 | 65 | # V4L2 66 | debug.stagefright.c2-poolmask=0xfc0000 67 | persist.vendor.v4l2_codec2.rank.decoder=128 68 | persist.vendor.v4l2_codec2.rank.encoder=128 69 | ro.vendor.v4l2_codec2.decode_concurrent_instances=8 70 | ro.vendor.v4l2_codec2.encode_concurrent_instances=8 71 | 72 | # Virtualization 73 | ro.boot.hypervisor.vm.supported=1 74 | 75 | # Wifi 76 | ro.boot.wificountrycode=00 77 | wifi.interface=wlan0 78 | 79 | # Window extensions 80 | persist.settings.large_screen_opt.enabled=true 81 | -------------------------------------------------------------------------------- /camera/external/external_camera_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 10 23 | 11 24 | 12 25 | 13 26 | 14 27 | 15 28 | 16 29 | 18 30 | 19 31 | 20 32 | 21 33 | 22 34 | 23 35 | 31 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /audio/libeffects/loudness/dsp/core/interpolator_linear.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef LE_FX_ENGINE_DSP_CORE_INTERPOLATOR_LINEAR_H_ 18 | #define LE_FX_ENGINE_DSP_CORE_INTERPOLATOR_LINEAR_H_ 19 | 20 | #include 21 | #include "dsp/core/interpolator_base.h" 22 | 23 | namespace le_fx { 24 | 25 | namespace sigmod { 26 | 27 | // Linear interpolation class. 28 | // 29 | // The main functionality of this class is provided by it's base-class, so 30 | // please refer to: InterpolatorBase 31 | // 32 | // Example: 33 | // InterpolatorLinear interp(x_data, y_data, data_length); 34 | // for (int n = 0; n < data_length; n++) Y[n] = interp.Interpolate(X[n]); 35 | // 36 | template 37 | class InterpolatorLinear: public InterpolatorBase > { 38 | public: 39 | InterpolatorLinear() = default; 40 | InterpolatorLinear(const InterpolatorLinear&) = delete; 41 | InterpolatorLinear& operator=(const InterpolatorLinear&) = delete; 42 | 43 | protected: 44 | // Provides the main implementation of the linear interpolation algorithm. 45 | // Assumes that: X[cached_index_] < x < X[cached_index_ + 1] 46 | 47 | T MethodSpecificInterpolation(T x) { 48 | const T dX = x_data_[cached_index_ + 1] - x_data_[cached_index_]; 49 | const T dY = y_data_[cached_index_ + 1] - y_data_[cached_index_]; 50 | const T dx = x - x_data_[cached_index_]; 51 | return y_data_[cached_index_] + (dY * dx) / dX; 52 | } 53 | 54 | // Pre-compute internal state_ parameters. 55 | bool SetInternalState() { 56 | state_ = nullptr; 57 | return true; 58 | } 59 | private: 60 | friend class InterpolatorBase>; 61 | typedef InterpolatorBase> BaseClass; 62 | using BaseClass::status_; 63 | using BaseClass::cached_index_; 64 | using BaseClass::x_data_; 65 | using BaseClass::y_data_; 66 | using BaseClass::data_length_; 67 | using BaseClass::state_; 68 | }; 69 | 70 | } // namespace sigmod 71 | 72 | } // namespace le_fx 73 | 74 | #endif // LE_FX_ENGINE_DSP_CORE_INTERPOLATOR_LINEAR_H_ 75 | -------------------------------------------------------------------------------- /audio/libeffects/dynamicsproc/aidl/DynamicsProcessing.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include "DynamicsProcessingContext.h" 22 | #include "EffectRangeSpecific.h" 23 | #include "effect-impl/EffectImpl.h" 24 | 25 | namespace aidl::android::hardware::audio::effect { 26 | 27 | class DynamicsProcessingImpl final : public EffectImpl { 28 | public: 29 | static const std::string kEffectName; 30 | static const Descriptor kDescriptor; 31 | static const Capability kCapability; 32 | 33 | DynamicsProcessingImpl() = default; 34 | ~DynamicsProcessingImpl() { cleanUp(); } 35 | 36 | ndk::ScopedAStatus open(const Parameter::Common& common, 37 | const std::optional& specific, 38 | OpenEffectReturn* ret) override; 39 | ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override; 40 | ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) 41 | REQUIRES(mImplMutex) override; 42 | ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific) 43 | REQUIRES(mImplMutex) override; 44 | IEffect::Status effectProcessImpl(float* in, float* out, int process) 45 | REQUIRES(mImplMutex) override; 46 | std::shared_ptr createContext(const Parameter::Common& common) 47 | REQUIRES(mImplMutex) override; 48 | RetCode releaseContext() REQUIRES(mImplMutex) override; 49 | 50 | std::string getEffectName() override { return kEffectName; } 51 | 52 | private: 53 | std::shared_ptr mContext GUARDED_BY(mImplMutex); 54 | ndk::ScopedAStatus getParameterDynamicsProcessing(const DynamicsProcessing::Tag& tag, 55 | Parameter::Specific* specific) 56 | REQUIRES(mImplMutex); 57 | bool isParamInRange(const Parameter::Specific& specific); 58 | }; 59 | 60 | } // namespace aidl::android::hardware::audio::effect 61 | -------------------------------------------------------------------------------- /audio/usb_audio_policy_configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 35 | 37 | 38 | 39 | 41 | 42 | 43 | 44 | 45 | 47 | 49 | 51 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /audio/alsa/ModuleAlsa.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "AHAL_ModuleAlsa" 18 | 19 | #include 20 | 21 | #include 22 | 23 | #include "Utils.h" 24 | #include "core-impl/ModuleAlsa.h" 25 | 26 | extern "C" { 27 | #include "alsa_device_profile.h" 28 | } 29 | 30 | using aidl::android::media::audio::common::AudioChannelLayout; 31 | using aidl::android::media::audio::common::AudioFormatType; 32 | using aidl::android::media::audio::common::AudioPort; 33 | using aidl::android::media::audio::common::AudioProfile; 34 | 35 | namespace aidl::android::hardware::audio::core { 36 | 37 | ndk::ScopedAStatus ModuleAlsa::populateConnectedDevicePort(AudioPort* audioPort, int32_t) { 38 | auto deviceProfile = alsa::getDeviceProfile(*audioPort); 39 | if (!deviceProfile.has_value()) { 40 | return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); 41 | } 42 | auto proxy = alsa::readAlsaDeviceInfo(*deviceProfile); 43 | if (proxy.get() == nullptr) { 44 | return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); 45 | } 46 | 47 | alsa_device_profile* profile = proxy.getProfile(); 48 | std::vector channels = alsa::getChannelMasksFromProfile(profile); 49 | std::vector sampleRates = alsa::getSampleRatesFromProfile(profile); 50 | 51 | for (size_t i = 0; i < std::min(MAX_PROFILE_FORMATS, AUDIO_PORT_MAX_AUDIO_PROFILES) && 52 | profile->formats[i] != PCM_FORMAT_INVALID; 53 | ++i) { 54 | auto audioFormatDescription = 55 | alsa::c2aidl_pcm_format_AudioFormatDescription(profile->formats[i]); 56 | if (audioFormatDescription.type == AudioFormatType::DEFAULT) { 57 | LOG(WARNING) << __func__ << ": unknown pcm type=" << profile->formats[i]; 58 | continue; 59 | } 60 | AudioProfile audioProfile = {.format = audioFormatDescription, 61 | .channelMasks = channels, 62 | .sampleRates = sampleRates}; 63 | audioPort->profiles.push_back(std::move(audioProfile)); 64 | } 65 | return ndk::ScopedAStatus::ok(); 66 | } 67 | 68 | } // namespace aidl::android::hardware::audio::core 69 | -------------------------------------------------------------------------------- /audio/include/core-impl/Bluetooth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace aidl::android::hardware::audio::core { 24 | 25 | class ParamChangeHandler { 26 | public: 27 | ParamChangeHandler() = default; 28 | void registerHandler(std::function handler) { mHandler = handler; } 29 | 30 | protected: 31 | std::function mHandler = nullptr; 32 | }; 33 | 34 | class Bluetooth : public BnBluetooth { 35 | public: 36 | Bluetooth(); 37 | 38 | private: 39 | ndk::ScopedAStatus setScoConfig(const ScoConfig& in_config, ScoConfig* _aidl_return) override; 40 | ndk::ScopedAStatus setHfpConfig(const HfpConfig& in_config, HfpConfig* _aidl_return) override; 41 | 42 | ScoConfig mScoConfig; 43 | HfpConfig mHfpConfig; 44 | }; 45 | 46 | class BluetoothA2dp : public BnBluetoothA2dp, public ParamChangeHandler { 47 | public: 48 | BluetoothA2dp() = default; 49 | ndk::ScopedAStatus isEnabled(bool* _aidl_return) override; 50 | 51 | private: 52 | ndk::ScopedAStatus setEnabled(bool in_enabled) override; 53 | ndk::ScopedAStatus supportsOffloadReconfiguration(bool* _aidl_return) override; 54 | ndk::ScopedAStatus reconfigureOffload( 55 | const std::vector<::aidl::android::hardware::audio::core::VendorParameter>& 56 | in_parameters) override; 57 | 58 | bool mEnabled = false; 59 | }; 60 | 61 | class BluetoothLe : public BnBluetoothLe, public ParamChangeHandler { 62 | public: 63 | BluetoothLe() = default; 64 | ndk::ScopedAStatus isEnabled(bool* _aidl_return) override; 65 | 66 | private: 67 | ndk::ScopedAStatus setEnabled(bool in_enabled) override; 68 | ndk::ScopedAStatus supportsOffloadReconfiguration(bool* _aidl_return) override; 69 | ndk::ScopedAStatus reconfigureOffload( 70 | const std::vector<::aidl::android::hardware::audio::core::VendorParameter>& 71 | in_parameters) override; 72 | 73 | bool mEnabled = false; 74 | }; 75 | 76 | } // namespace aidl::android::hardware::audio::core 77 | -------------------------------------------------------------------------------- /audio/libeffects/reverb/aidl/EffectReverb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include "effect-impl/EffectImpl.h" 22 | #include "ReverbContext.h" 23 | 24 | namespace aidl::android::hardware::audio::effect { 25 | 26 | class EffectReverb final : public EffectImpl { 27 | public: 28 | explicit EffectReverb(const AudioUuid& uuid); 29 | ~EffectReverb() override; 30 | 31 | ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override; 32 | 33 | ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) 34 | REQUIRES(mImplMutex) override; 35 | ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific) 36 | REQUIRES(mImplMutex) override; 37 | 38 | std::shared_ptr createContext(const Parameter::Common& common) 39 | REQUIRES(mImplMutex) override; 40 | RetCode releaseContext() REQUIRES(mImplMutex) override; 41 | 42 | IEffect::Status effectProcessImpl(float* in, float* out, int samples) 43 | REQUIRES(mImplMutex) override; 44 | 45 | std::string getEffectName() override { return *mEffectName; } 46 | 47 | private: 48 | std::shared_ptr mContext GUARDED_BY(mImplMutex); 49 | const Descriptor* mDescriptor; 50 | const std::string* mEffectName; 51 | lvm::ReverbEffectType mType; 52 | 53 | IEffect::Status status(binder_status_t status, size_t consumed, size_t produced); 54 | 55 | ndk::ScopedAStatus setParameterPresetReverb(const Parameter::Specific& specific) 56 | REQUIRES(mImplMutex); 57 | ndk::ScopedAStatus getParameterPresetReverb(const PresetReverb::Id& id, 58 | Parameter::Specific* specific) 59 | REQUIRES(mImplMutex); 60 | 61 | ndk::ScopedAStatus setParameterEnvironmentalReverb(const Parameter::Specific& specific) 62 | REQUIRES(mImplMutex); 63 | ndk::ScopedAStatus getParameterEnvironmentalReverb(const EnvironmentalReverb::Id& id, 64 | Parameter::Specific* specific) 65 | REQUIRES(mImplMutex); 66 | }; 67 | 68 | } // namespace aidl::android::hardware::audio::effect 69 | -------------------------------------------------------------------------------- /audio/include/core-impl/ModuleUsb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "core-impl/ModuleAlsa.h" 20 | 21 | namespace aidl::android::hardware::audio::core { 22 | 23 | class ModuleUsb final : public ModuleAlsa { 24 | public: 25 | ModuleUsb(std::unique_ptr&& config) : ModuleAlsa(Type::USB, std::move(config)) {} 26 | 27 | private: 28 | // IModule interfaces 29 | ndk::ScopedAStatus getTelephony(std::shared_ptr* _aidl_return) override; 30 | ndk::ScopedAStatus getBluetooth(std::shared_ptr* _aidl_return) override; 31 | ndk::ScopedAStatus getMicMute(bool* _aidl_return) override; 32 | ndk::ScopedAStatus setMicMute(bool in_mute) override; 33 | 34 | // Module interfaces 35 | ndk::ScopedAStatus createInputStream( 36 | StreamContext&& context, 37 | const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, 38 | const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones, 39 | std::shared_ptr* result) override; 40 | ndk::ScopedAStatus createOutputStream( 41 | StreamContext&& context, 42 | const ::aidl::android::hardware::audio::common::SourceMetadata& sourceMetadata, 43 | const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo>& 44 | offloadInfo, 45 | std::shared_ptr* result) override; 46 | ndk::ScopedAStatus populateConnectedDevicePort( 47 | ::aidl::android::media::audio::common::AudioPort* audioPort, 48 | int32_t nextPortId) override; 49 | ndk::ScopedAStatus checkAudioPatchEndpointsMatch( 50 | const std::vector<::aidl::android::media::audio::common::AudioPortConfig*>& sources, 51 | const std::vector<::aidl::android::media::audio::common::AudioPortConfig*>& sinks) 52 | override; 53 | void onExternalDeviceConnectionChanged( 54 | const ::aidl::android::media::audio::common::AudioPort& audioPort, 55 | bool connected) override; 56 | ndk::ScopedAStatus onMasterMuteChanged(bool mute) override; 57 | ndk::ScopedAStatus onMasterVolumeChanged(float volume) override; 58 | }; 59 | 60 | } // namespace aidl::android::hardware::audio::core 61 | -------------------------------------------------------------------------------- /audio/stub/ApeHeader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "AHAL_OffloadStream" 18 | #include 19 | 20 | #include "ApeHeader.h" 21 | 22 | namespace aidl::android::hardware::audio::core { 23 | 24 | static constexpr uint32_t kApeSignature1 = 0x2043414d; // 'MAC '; 25 | static constexpr uint32_t kApeSignature2 = 0x4643414d; // 'MACF'; 26 | static constexpr uint16_t kMinimumVersion = 3980; 27 | 28 | void* findApeHeader(void* buffer, size_t bufferSizeBytes, ApeHeader** header) { 29 | auto advanceBy = [&](size_t bytes) -> void* { 30 | buffer = static_cast(buffer) + bytes; 31 | bufferSizeBytes -= bytes; 32 | return buffer; 33 | }; 34 | 35 | while (bufferSizeBytes >= sizeof(ApeDescriptor) + sizeof(ApeHeader)) { 36 | ApeDescriptor* descPtr = static_cast(buffer); 37 | if (descPtr->signature != kApeSignature1 && descPtr->signature != kApeSignature2) { 38 | advanceBy(sizeof(descPtr->signature)); 39 | continue; 40 | } 41 | if (descPtr->version < kMinimumVersion) { 42 | LOG(ERROR) << __func__ << ": Unsupported APE version: " << descPtr->version 43 | << ", minimum supported version: " << kMinimumVersion; 44 | // Older versions only have a header, which is of the size similar to the modern header. 45 | advanceBy(sizeof(ApeHeader)); 46 | continue; 47 | } 48 | if (descPtr->descriptorSizeBytes > bufferSizeBytes) { 49 | LOG(ERROR) << __func__ 50 | << ": Invalid APE descriptor size: " << descPtr->descriptorSizeBytes 51 | << ", overruns remaining buffer size: " << bufferSizeBytes; 52 | advanceBy(sizeof(ApeDescriptor)); 53 | continue; 54 | } 55 | advanceBy(descPtr->descriptorSizeBytes); 56 | if (sizeof(ApeHeader) > bufferSizeBytes) { 57 | LOG(ERROR) << __func__ << ": APE header is incomplete, want: " << sizeof(ApeHeader) 58 | << " bytes, have: " << bufferSizeBytes; 59 | return nullptr; 60 | } 61 | *header = static_cast(buffer); 62 | return advanceBy(sizeof(ApeHeader)); 63 | } 64 | return nullptr; 65 | } 66 | 67 | } // namespace aidl::android::hardware::audio::core 68 | -------------------------------------------------------------------------------- /audio/include/core-impl/ModuleRemoteSubmix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "core-impl/Module.h" 20 | 21 | namespace aidl::android::hardware::audio::core { 22 | 23 | class ModuleRemoteSubmix : public Module { 24 | public: 25 | ModuleRemoteSubmix(std::unique_ptr&& config) 26 | : Module(Type::R_SUBMIX, std::move(config)) {} 27 | 28 | private: 29 | // IModule interfaces 30 | ndk::ScopedAStatus getMicMute(bool* _aidl_return) override; 31 | ndk::ScopedAStatus setMicMute(bool in_mute) override; 32 | ndk::ScopedAStatus setAudioPortConfig( 33 | const ::aidl::android::media::audio::common::AudioPortConfig& in_requested, 34 | ::aidl::android::media::audio::common::AudioPortConfig* out_suggested, 35 | bool* _aidl_return) override; 36 | 37 | // Module interfaces 38 | ndk::ScopedAStatus createInputStream( 39 | StreamContext&& context, 40 | const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, 41 | const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones, 42 | std::shared_ptr* result) override; 43 | ndk::ScopedAStatus createOutputStream( 44 | StreamContext&& context, 45 | const ::aidl::android::hardware::audio::common::SourceMetadata& sourceMetadata, 46 | const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo>& 47 | offloadInfo, 48 | std::shared_ptr* result) override; 49 | ndk::ScopedAStatus populateConnectedDevicePort( 50 | ::aidl::android::media::audio::common::AudioPort* audioPort, 51 | int32_t nextPortId) override; 52 | ndk::ScopedAStatus checkAudioPatchEndpointsMatch( 53 | const std::vector<::aidl::android::media::audio::common::AudioPortConfig*>& sources, 54 | const std::vector<::aidl::android::media::audio::common::AudioPortConfig*>& sinks) 55 | override; 56 | ndk::ScopedAStatus onMasterMuteChanged(bool mute) override; 57 | ndk::ScopedAStatus onMasterVolumeChanged(float volume) override; 58 | int32_t getNominalLatencyMs( 59 | const ::aidl::android::media::audio::common::AudioPortConfig& portConfig) override; 60 | binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; 61 | }; 62 | 63 | } // namespace aidl::android::hardware::audio::core 64 | -------------------------------------------------------------------------------- /audio/Config.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "AHAL_Config" 18 | #include 19 | 20 | #include 21 | 22 | #include "core-impl/AudioPolicyConfigXmlConverter.h" 23 | #include "core-impl/Config.h" 24 | #include "core-impl/EngineConfigXmlConverter.h" 25 | 26 | using aidl::android::media::audio::common::AudioHalEngineConfig; 27 | 28 | namespace aidl::android::hardware::audio::core { 29 | ndk::ScopedAStatus Config::getSurroundSoundConfig(SurroundSoundConfig* _aidl_return) { 30 | static const auto& func = __func__; 31 | static const SurroundSoundConfig surroundSoundConfig = [this]() { 32 | SurroundSoundConfig surroundCfg = mAudioPolicyConverter.getSurroundSoundConfig(); 33 | if (mAudioPolicyConverter.getStatus() != ::android::OK) { 34 | LOG(WARNING) << func << ": " << mAudioPolicyConverter.getError(); 35 | } 36 | return surroundCfg; 37 | }(); 38 | *_aidl_return = surroundSoundConfig; 39 | LOG(DEBUG) << __func__ << ": returning " << _aidl_return->toString(); 40 | return ndk::ScopedAStatus::ok(); 41 | } 42 | 43 | ndk::ScopedAStatus Config::getEngineConfig(AudioHalEngineConfig* _aidl_return) { 44 | static const auto& func = __func__; 45 | static const AudioHalEngineConfig returnEngCfg = [this]() { 46 | AudioHalEngineConfig engConfig; 47 | if (mEngConfigConverter.getStatus() == ::android::OK) { 48 | engConfig = mEngConfigConverter.getAidlEngineConfig(); 49 | } else { 50 | LOG(INFO) << func << ": " << mEngConfigConverter.getError(); 51 | if (mAudioPolicyConverter.getStatus() == ::android::OK) { 52 | engConfig = mAudioPolicyConverter.getAidlEngineConfig(); 53 | } else { 54 | LOG(WARNING) << func << ": " << mAudioPolicyConverter.getError(); 55 | } 56 | } 57 | // Logging full contents of the config is an overkill, just provide statistics. 58 | LOG(DEBUG) << func 59 | << ": number of strategies parsed: " << engConfig.productStrategies.size() 60 | << ", default strategy: " << engConfig.defaultProductStrategyId 61 | << ", number of volume groups parsed: " << engConfig.volumeGroups.size(); 62 | return engConfig; 63 | }(); 64 | *_aidl_return = returnEngCfg; 65 | return ndk::ScopedAStatus::ok(); 66 | } 67 | } // namespace aidl::android::hardware::audio::core 68 | -------------------------------------------------------------------------------- /audio/EffectMain.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "effectFactory-impl/EffectFactory.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #ifdef __ANDROID_APEX__ 25 | #include 26 | #endif 27 | 28 | /** Default name of effect configuration file. */ 29 | static const char* kDefaultConfigName = "audio_effects_config.xml"; 30 | 31 | static inline std::string config_file_path() { 32 | if constexpr (__ANDROID_VENDOR_API__ >= 202404) { 33 | AApexInfo *apexInfo; 34 | if (AApexInfo_create(&apexInfo) == AAPEXINFO_OK) { 35 | std::string apexName(AApexInfo_getName(apexInfo)); 36 | AApexInfo_destroy(apexInfo); 37 | std::string candidatePath("/apex/"); 38 | candidatePath.append(apexName).append("/etc/").append(kDefaultConfigName); 39 | LOG(DEBUG) << __func__ << " effect lib path " << candidatePath; 40 | if (access(candidatePath.c_str(), R_OK) == 0) { 41 | return candidatePath; 42 | } 43 | } 44 | } else { 45 | LOG(DEBUG) << __func__ << " libapexsupport is not supported"; 46 | } 47 | LOG(DEBUG) << __func__ << ": Unable to resolve config file path in APEX"; 48 | return android::audio_find_readable_configuration_file(kDefaultConfigName); 49 | } 50 | 51 | int main() { 52 | // This is a debug implementation, always enable debug logging. 53 | android::base::SetMinimumLogSeverity(::android::base::DEBUG); 54 | ABinderProcess_setThreadPoolMaxThreadCount(0); 55 | 56 | auto configFile = config_file_path(); 57 | if (configFile == "") { 58 | LOG(ERROR) << __func__ << ": config file " << kDefaultConfigName << " not found!"; 59 | return EXIT_FAILURE; 60 | } 61 | LOG(DEBUG) << __func__ << ": start factory with configFile:" << configFile; 62 | auto effectFactory = 63 | ndk::SharedRefBase::make(configFile); 64 | 65 | std::string serviceName = std::string() + effectFactory->descriptor + "/default"; 66 | binder_status_t status = 67 | AServiceManager_addService(effectFactory->asBinder().get(), serviceName.c_str()); 68 | CHECK_EQ(STATUS_OK, status); 69 | 70 | LOG(DEBUG) << __func__ << ": effectFactory: " << serviceName << " start"; 71 | ABinderProcess_joinThreadPool(); 72 | return EXIT_FAILURE; // should not reach 73 | } 74 | -------------------------------------------------------------------------------- /audio/include/core-impl/StreamUsb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | #include "StreamAlsa.h" 26 | 27 | namespace aidl::android::hardware::audio::core { 28 | 29 | class StreamUsb : public StreamAlsa { 30 | public: 31 | StreamUsb(StreamContext* context, const Metadata& metadata); 32 | 33 | // Methods of 'DriverInterface'. 34 | ::android::status_t transfer(void* buffer, size_t frameCount, size_t* actualFrameCount, 35 | int32_t* latencyMs) override; 36 | 37 | // Overridden methods of 'StreamCommonImpl', called on a Binder thread. 38 | ndk::ScopedAStatus setConnectedDevices(const ConnectedDevices& devices) override; 39 | 40 | protected: 41 | std::vector getDeviceProfiles() override; 42 | 43 | mutable std::mutex mLock; 44 | std::vector mConnectedDeviceProfiles GUARDED_BY(mLock); 45 | std::atomic mConnectedDevicesUpdated = false; 46 | }; 47 | 48 | class StreamInUsb final : public StreamIn, public StreamUsb { 49 | public: 50 | friend class ndk::SharedRefBase; 51 | StreamInUsb( 52 | StreamContext&& context, 53 | const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, 54 | const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones); 55 | 56 | private: 57 | void onClose(StreamDescriptor::State) override { defaultOnClose(); } 58 | ndk::ScopedAStatus getActiveMicrophones( 59 | std::vector<::aidl::android::media::audio::common::MicrophoneDynamicInfo>* _aidl_return) 60 | override; 61 | }; 62 | 63 | class StreamOutUsb final : public StreamOut, public StreamUsb, public StreamOutHwVolumeHelper { 64 | public: 65 | friend class ndk::SharedRefBase; 66 | StreamOutUsb(StreamContext&& context, 67 | const ::aidl::android::hardware::audio::common::SourceMetadata& sourceMetadata, 68 | const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo>& 69 | offloadInfo); 70 | 71 | private: 72 | void onClose(StreamDescriptor::State) override { defaultOnClose(); } 73 | ndk::ScopedAStatus getHwVolume(std::vector* _aidl_return) override; 74 | ndk::ScopedAStatus setHwVolume(const std::vector& in_channelVolumes) override; 75 | }; 76 | 77 | } // namespace aidl::android::hardware::audio::core 78 | -------------------------------------------------------------------------------- /mkimg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright (C) 2021-2022 KonstaKANG 5 | # 6 | # SPDX-License-Identifier: Apache-2.0 7 | # 8 | 9 | exit_with_error() { 10 | echo $@ 11 | exit 1 12 | } 13 | 14 | if [ -z ${TARGET_PRODUCT} ]; then 15 | exit_with_error "TARGET_PRODUCT environment variable is not set. Run lunch first." 16 | fi 17 | 18 | if [ -z ${ANDROID_PRODUCT_OUT} ]; then 19 | exit_with_error "ANDROID_PRODUCT_OUT environment variable is not set. Run lunch first." 20 | fi 21 | 22 | for PARTITION in "boot" "system" "vendor"; do 23 | if [ ! -f ${ANDROID_PRODUCT_OUT}/${PARTITION}.img ]; then 24 | exit_with_error "Partition image not found. Run 'make ${PARTITION}image' first." 25 | fi 26 | done 27 | 28 | VERSION=RaspberryVanillaAOSP16 29 | DATE=$(date +%Y%m%d) 30 | TARGET=$(echo ${TARGET_PRODUCT} | sed 's/^aosp_//') 31 | IMGNAME=${VERSION}-${DATE}-${TARGET}.img 32 | IMGSIZE=15360000000 33 | 34 | BOOT_PARTITION_SIZE=128 35 | SYSTEM_PARTITION_SIZE=3072 36 | VENDOR_PARTITION_SIZE=384 37 | METADATA_PARTITION_SIZE=16 38 | EXTENDED_PARTITION_SIZE=$((${SYSTEM_PARTITION_SIZE}+${VENDOR_PARTITION_SIZE}+${METADATA_PARTITION_SIZE}+4)) 39 | 40 | if [ -f ${ANDROID_PRODUCT_OUT}/${IMGNAME} ]; then 41 | exit_with_error "${ANDROID_PRODUCT_OUT}/${IMGNAME} already exists!" 42 | fi 43 | 44 | echo "Creating image file ${ANDROID_PRODUCT_OUT}/${IMGNAME}..." 45 | sudo fallocate -l ${IMGSIZE} ${ANDROID_PRODUCT_OUT}/${IMGNAME} 46 | sync 47 | 48 | echo "Creating partitions..." 49 | ( 50 | echo o 51 | 52 | echo n 53 | echo p 54 | echo 1 55 | echo 56 | echo +${BOOT_PARTITION_SIZE}M 57 | 58 | echo n 59 | echo e 60 | echo 2 61 | echo 62 | echo +${EXTENDED_PARTITION_SIZE}M 63 | 64 | echo n 65 | echo l 66 | echo 67 | echo +${SYSTEM_PARTITION_SIZE}M 68 | 69 | echo n 70 | echo l 71 | echo 72 | echo +${VENDOR_PARTITION_SIZE}M 73 | 74 | echo n 75 | echo l 76 | echo 77 | echo +${METADATA_PARTITION_SIZE}M 78 | 79 | echo n 80 | echo p 81 | echo 3 82 | echo 83 | echo 84 | 85 | echo t 86 | echo 1 87 | echo c 88 | echo a 89 | echo 1 90 | 91 | echo w 92 | ) | sudo fdisk ${ANDROID_PRODUCT_OUT}/${IMGNAME} 93 | sync 94 | 95 | LOOPDEV=$(sudo kpartx -av ${ANDROID_PRODUCT_OUT}/${IMGNAME} | awk 'NR==1{ sub(/p[0-9]$/, "", $3); print $3 }') 96 | if [ -z ${LOOPDEV} ]; then 97 | exit_with_error "Unable to find loop device!" 98 | fi 99 | echo "Image mounted as /dev/${LOOPDEV}" 100 | sleep 1 101 | 102 | echo "Copying boot..." 103 | sudo dd if=${ANDROID_PRODUCT_OUT}/boot.img of=/dev/mapper/${LOOPDEV}p1 bs=1M 104 | echo "Copying system..." 105 | sudo dd if=${ANDROID_PRODUCT_OUT}/system.img of=/dev/mapper/${LOOPDEV}p5 bs=1M 106 | echo "Copying vendor..." 107 | sudo dd if=${ANDROID_PRODUCT_OUT}/vendor.img of=/dev/mapper/${LOOPDEV}p6 bs=1M 108 | echo "Creating metadata..." 109 | sudo mkfs.ext4 /dev/mapper/${LOOPDEV}p7 -I 512 -L metadata 110 | echo "Creating userdata..." 111 | sudo mkfs.ext4 /dev/mapper/${LOOPDEV}p3 -I 512 -L userdata 112 | sync 113 | 114 | sudo kpartx -d "/dev/${LOOPDEV}" 115 | sudo losetup -d "/dev/${LOOPDEV}" 116 | sudo chown ${USER}:${USER} ${ANDROID_PRODUCT_OUT}/${IMGNAME} 117 | 118 | echo "Done, created ${ANDROID_PRODUCT_OUT}/${IMGNAME}!" 119 | exit 0 120 | --------------------------------------------------------------------------------