15 Commits

Author SHA1 Message Date
Konsta
ff8c9e0aec sepolicy: escape dots 2023-09-27 19:43:36 +03:00
Konsta
af52e8b4e1 sepolicy: define cec hal domain 2023-08-22 19:16:39 +03:00
Konsta
9c62ce999b add hdmi cec hal
* Based on AOSP yukawa HDMI-CEC HAL
  https://android.googlesource.com/device/amlogic/yukawa/+/refs/heads/main/hal/hdmicec/
2023-07-25 15:26:48 +03:00
Konsta
acc4b35086 add generic keylayout
* Copy from frameworks/base/data/keyboards/Generic.kl
2023-07-25 15:26:30 +03:00
Konsta
4e10f632e1 overlay: mark device as not mobile data capable
* d1e1b35604
  291415806f
2023-07-24 13:50:58 +03:00
Konsta
1adc59b4db ueventd: adjust media/video node permissions for ffmpeg
* ffmpeg_codec2 now runs as user media
2023-04-27 17:09:39 +03:00
Konsta
c5c3e50da2 sepolicy: remove alsa_loop 2023-04-11 10:55:06 +03:00
Konsta
556e2c3278 hdmi audio: remove local VC4 HDMI configuration
* This was updated in alsa-lib v1.2.7 so use the upstream config.
2023-03-12 17:41:25 +02:00
nename0
95838474b1 hdmi audio: add default values to vendor.prop 2023-03-06 11:05:02 +02:00
nename0
ba68930423 hdmi audio: remove alsa_loop service 2023-03-06 11:04:54 +02:00
nename0
2960d80f8d hdmi audio: add new audio HAL module with alsa instead of tinyalsa 2023-03-06 11:04:45 +02:00
Konsta
f724b0f13a sepolicy: add ffmpeg service
* Fixes https://github.com/raspberry-vanilla/android_local_manifest/issues/7
* ABC OCD
2023-02-22 20:34:15 +02:00
Konsta
71e3493aa7 ffmpeg: integrate into build and enable h.265 hw decoder by default
* Use codec ranks to switch between decoders.
2023-01-30 14:36:00 +02:00
Konsta
6cd5b54d6e v4l2: enable h.264 hw decoder & encoder by default
* Use codec ranks to switch between decoders/encoders.
2023-01-30 14:34:46 +02:00
Konsta
842583bff1 v4l2: enable h264 hardware encoder 2023-01-09 17:47:19 +02:00
67 changed files with 523 additions and 1546 deletions

View File

@@ -1,15 +1,11 @@
#
# Copyright (C) 2021-2023 KonstaKANG
# Copyright (C) 2021-2022 KonstaKANG
#
# SPDX-License-Identifier: Apache-2.0
#
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/aosp_rpi4.mk \
$(LOCAL_DIR)/aosp_rpi4_car.mk \
$(LOCAL_DIR)/aosp_rpi4_tv.mk
$(LOCAL_DIR)/aosp_rpi4.mk
COMMON_LUNCH_CHOICES := \
aosp_rpi4-userdebug \
aosp_rpi4_car-userdebug \
aosp_rpi4_tv-userdebug
aosp_rpi4-userdebug

View File

@@ -26,18 +26,19 @@ TARGET_2ND_CPU_VARIANT := cortex-a72
# Bluetooth
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(DEVICE_PATH)/bluetooth
BOARD_CUSTOM_BT_CONFIG := $(DEVICE_PATH)/bluetooth/vnd_rpi4.txt
BOARD_HAVE_BLUETOOTH := true
BOARD_HAVE_BLUETOOTH_BCM := true
# Camera
BOARD_LIBCAMERA_IPAS := rpi/vc4
BOARD_LIBCAMERA_PIPELINES := rpi/vc4
BOARD_LIBCAMERA_IPAS := raspberrypi
BOARD_LIBCAMERA_PIPELINES := raspberrypi
BOARD_LIBCAMERA_USES_MESON_BUILD := true
# Display
TARGET_SCREEN_DENSITY := 240
# Graphics
BOARD_MESA3D_BUILD_LIBGBM := true
BOARD_MESA3D_USES_MESON_BUILD := true
BOARD_MESA3D_GALLIUM_DRIVERS := vc4 v3d
BOARD_MESA3D_VULKAN_DRIVERS := broadcom
@@ -48,10 +49,12 @@ BOARD_CUSTOM_BOOTIMG_MK := $(DEVICE_PATH)/mkbootimg.mk
BOARD_KERNEL_CMDLINE := console=ttyS0,115200 no_console_suspend root=/dev/ram0 rootwait androidboot.hardware=rpi4
# Manifest
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := $(DEVICE_PATH)/framework_compatibility_matrix.xml
DEVICE_MANIFEST_FILE := $(DEVICE_PATH)/manifest.xml
DEVICE_MATRIX_FILE := $(DEVICE_PATH)/compatibility_matrix.xml
# Media
TARGET_ENABLE_MEDIADRM_64 := true
# Partition sizes
BOARD_FLASH_BLOCK_SIZE := 4096
BOARD_BOOTIMAGE_PARTITION_SIZE := 134217728 # 128M

View File

@@ -1 +1 @@
Raspberry Vanilla AOSP 14 device configuration for Raspberry Pi 4.
Raspberry Vanilla AOSP 12 device configuration for Raspberry Pi 4.

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2021-2023 KonstaKANG
# Copyright (C) 2021-2022 KonstaKANG
#
# SPDX-License-Identifier: Apache-2.0
#
@@ -7,23 +7,6 @@
# Inherit device configuration
$(call inherit-product, device/brcm/rpi4/device.mk)
PRODUCT_AAPT_CONFIG := normal mdpi hdpi
PRODUCT_AAPT_PREF_CONFIG := hdpi
PRODUCT_CHARACTERISTICS := tablet,nosdcard
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
# Overlays
PRODUCT_PACKAGES += \
AndroidRpiOverlay \
SettingsRpiOverlay \
SettingsProviderRpiOverlay \
SystemUIRpiOverlay \
WifiRpiOverlay
# Permissions
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/tablet_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/tablet_core_hardware.xml
# Device identifier. This must come after all inclusions.
PRODUCT_DEVICE := rpi4
PRODUCT_NAME := aosp_rpi4

View File

@@ -1,79 +0,0 @@
#
# Copyright (C) 2021-2023 KonstaKANG
#
# SPDX-License-Identifier: Apache-2.0
#
# Inherit device configuration
$(call inherit-product, device/brcm/rpi4/device.mk)
PRODUCT_AAPT_CONFIG := normal mdpi hdpi
PRODUCT_AAPT_PREF_CONFIG := hdpi
PRODUCT_CHARACTERISTICS := automotive,nosdcard
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
$(call inherit-product, packages/services/Car/car_product/build/car.mk)
# Bluetooth
PRODUCT_VENDOR_PROPERTIES += \
bluetooth.device.class_of_device=38,4,8 \
bluetooth.profile.a2dp.source.enabled=false \
bluetooth.profile.asha.central.enabled=false \
bluetooth.profile.bap.broadcast.assist.enabled=false \
bluetooth.profile.bap.unicast.client.enabled=false \
bluetooth.profile.bas.client.enabled=false \
bluetooth.profile.ccp.server.enabled=false \
bluetooth.profile.csip.set_coordinator.enabled=false \
bluetooth.profile.hap.client.enabled=false \
bluetooth.profile.hfp.ag.enabled=false \
bluetooth.profile.hid.device.enabled=false \
bluetooth.profile.hid.host.enabled=false \
bluetooth.profile.map.client.enabled=false \
bluetooth.profile.map.server.enabled=false \
bluetooth.profile.mcp.server.enabled=false \
bluetooth.profile.opp.enabled=false \
bluetooth.profile.pbap.server.enabled=false \
bluetooth.profile.sap.server.enabled=false \
bluetooth.profile.vcp.controller.enabled=false
# Broadcast radio
PRODUCT_PACKAGES += \
android.hardware.broadcastradio-service.default
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.broadcastradio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.broadcastradio.xml
# Camera
ENABLE_CAMERA_SERVICE := true
# EVS
ENABLE_CAREVSSERVICE_SAMPLE := true
ENABLE_EVS_SAMPLE := true
ENABLE_EVS_SERVICE := true
ENABLE_REAR_VIEW_CAMERA_SAMPLE := true
PRODUCT_COPY_FILES += \
device/brcm/rpi4/camera/evs_config_override.json:${TARGET_COPY_OUT_VENDOR}/etc/automotive/evs/config_override.json
# Overlays
PRODUCT_PACKAGES += \
AndroidRpiOverlay \
CarServiceRpiOverlay \
SettingsProviderRpiOverlay \
WifiRpiOverlay
# Permissions
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.activities_on_secondary_displays.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.activities_on_secondary_displays.xml \
frameworks/native/data/etc/car_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/car_core_hardware.xml
# Vehicle
PRODUCT_PACKAGES += \
android.hardware.automotive.vehicle@2.0-default-service
# Device identifier. This must come after all inclusions.
PRODUCT_DEVICE := rpi4
PRODUCT_NAME := aosp_rpi4_car
PRODUCT_BRAND := Raspberry
PRODUCT_MODEL := Raspberry Pi 4
PRODUCT_MANUFACTURER := Raspberry
PRODUCT_RELEASE_NAME := Raspberry Pi 4

View File

@@ -1,42 +0,0 @@
#
# Copyright (C) 2021-2023 KonstaKANG
#
# SPDX-License-Identifier: Apache-2.0
#
# Inherit device configuration
$(call inherit-product, device/brcm/rpi4/device.mk)
PRODUCT_AAPT_PREF_CONFIG := tvdpi
PRODUCT_CHARACTERISTICS := tv
$(call inherit-product, device/google/atv/products/atv_base.mk)
# Android TV
PRODUCT_PACKAGES += \
DocumentsUI \
LeanbackIME \
TvProvision \
TvSampleLeanbackLauncher \
TvSettingsTwoPanel
# Bluetooth
PRODUCT_VENDOR_PROPERTIES += \
bluetooth.device.class_of_device=34,4,36
# Boot animation
PRODUCT_COPY_FILES += \
device/google/atv/products/bootanimations/bootanimation.zip:$(TARGET_COPY_OUT_SYSTEM)/media/bootanimation.zip
# Overlays
PRODUCT_PACKAGES += \
AndroidTvRpiOverlay \
SettingsProviderTvRpiOverlay \
WifiRpiOverlay
# Device identifier. This must come after all inclusions.
PRODUCT_DEVICE := rpi4
PRODUCT_NAME := aosp_rpi4_tv
PRODUCT_BRAND := Raspberry
PRODUCT_MODEL := Raspberry Pi 4
PRODUCT_MANUFACTURER := Raspberry
PRODUCT_RELEASE_NAME := Raspberry Pi 4

View File

@@ -84,44 +84,9 @@ struct alsa_stream_out {
unsigned int written;
};
static int probe_pcm_out_card() {
FILE *fp;
char card_node[] = "/proc/asound/card0/id";
char card_id[64];
char card_prop[PROPERTY_VALUE_MAX];
property_get("persist.audio.device", card_prop, "");
for (int i = 0; i < 5; i++) {
card_node[17] = i + '0';
if ((fp = fopen(card_node, "r")) != NULL) {
fgets(card_id, sizeof(card_id), fp);
ALOGV("%s: %s", card_node, card_id);
if (!strcmp(card_prop, "jack") && !strncmp(card_id, "Headphones", 10)) {
fclose(fp);
ALOGI("Using PCM card %d for 3.5mm audio jack", i);
return i;
} else if (!strcmp(card_prop, "dac") && strncmp(card_id, "Headphones", 10)
&& strncmp(card_id, "vc4hdmi", 7)) {
fclose(fp);
ALOGI("Using PCM card %d for audio DAC %s", i, card_id);
return i;
}
fclose(fp);
}
}
ALOGE("Could not probe PCM card for %s, using PCM card 0", card_prop);
return 0;
}
static int get_pcm_card()
{
char card[PROPERTY_VALUE_MAX];
property_get("persist.audio.pcm.card.auto", card, "false");
if (!strcmp(card, "true"))
return probe_pcm_out_card();
property_get("persist.audio.pcm.card", card, "0");
return atoi(card);
}

View File

@@ -86,11 +86,11 @@ struct alsa_stream_out {
};
static void get_alsa_device_name(char *name) {
char hdmi_device[PROPERTY_VALUE_MAX];
property_get("persist.audio.hdmi.device", hdmi_device, "vc4hdmi0");
char hdmiDevice[PROPERTY_VALUE_MAX];
property_get("persist.audio.hdmi.device", hdmiDevice, "vc4hdmi0");
// use card configured in vc4-hdmi.conf to get IEC958 subframe conversion
sprintf(name, "default:CARD=%s", hdmi_device);
sprintf(name, "default:CARD=%s", hdmiDevice);
}
/* must be called with hw device and output stream mutexes locked */

14
bluetooth/vnd_rpi4.txt Normal file
View File

@@ -0,0 +1,14 @@
BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyAMA0"
FW_PATCHFILE_LOCATION = "/vendor/firmware/brcm/"
FW_PATCH_SETTLEMENT_DELAY_MS = 200
BT_WAKE_VIA_PROC = FALSE
BT_WAKE_VIA_USERIAL_IOCTL = FALSE
LPM_IDLE_TIMEOUT_MULTIPLE = 5
SCO_CFG_INCLUDED = FALSE
SCO_PCM_IF_CLOCK_RATE = 2
BTVND_DBG = FALSE
BTHW_DBG = FALSE
VNDUSERIAL_DBG = FALSE
UPIO_DBG = FALSE
UART_TARGET_BAUD_RATE = 3000000
USE_CONTROLLER_BDADDR = FALSE

View File

@@ -12,9 +12,6 @@ dtparam=audio=on
camera_auto_detect=1
start_x=1
# CPU
arm_boost=1
# Display
disable_overscan=1
@@ -23,8 +20,8 @@ disable_overscan=1
#dtoverlay=rpi-backlight
# Graphics acceleration
disable_fw_kms_setup=1
dtoverlay=vc4-kms-v3d
dtoverlay=cma,cma-512
# I2C
#dtparam=i2c_arm=on
@@ -43,3 +40,6 @@ dtoverlay=dwc2,dr_mode=peripheral
[cm4]
dtoverlay=dwc2,dr_mode=otg
[all]
# V4L2
dtoverlay=rpivid-v4l2

View File

@@ -1,10 +0,0 @@
service vendor.camera-provider-2-5 /vendor/bin/hw/android.hardware.camera.provider@2.5-service_64
class hal
user cameraserver
group audio camera input drmrpc
ioprio rt 4
capabilities SYS_NICE
task_profiles CameraServiceCapacity MaxPerformance
override
setenv LIBCAMERA_LOG_LEVELS *:WARN
setenv LIBCAMERA_LOG_FILE syslog

View File

@@ -2,15 +2,9 @@ cameras:
"/base/soc/i2c0mux/i2c@1/imx219@10":
location: back
rotation: 0
"/base/soc/i2c0mux/i2c@1/imx296@1a":
location: back
rotation: 0
"/base/soc/i2c0mux/i2c@1/imx477@1a":
location: back
rotation: 0
"/base/soc/i2c0mux/i2c@1/imx708@1a":
location: back
rotation: 0
"/base/soc/i2c0mux/i2c@1/ov5647@36":
location: back
rotation: 0

View File

@@ -1,85 +0,0 @@
{
"car" : {
"width" : 76.7,
"wheelBase" : 117.9,
"frontExtent" : 44.7,
"rearExtent" : 40
},
"displays" : [
{
"_comment": "Display0",
"displayPort" : 0,
"frontRange" : 100,
"rearRange" : 100
},
{
"_comment": "Display1",
"displayPort" : 1,
"frontRange" : 100,
"rearRange" : 100
}
],
"graphic" : {
"frontPixel" : -20,
"rearPixel" : 260
},
"cameras" : [
{
"cameraId" : "/dev/video0",
"function" : "reverse",
"x" : 0.0,
"y" : 20.0,
"z" : 48,
"yaw" : 180,
"pitch" : -10,
"roll" : 0,
"hfov" : 115,
"vfov" : 80,
"hflip" : true,
"vflip" : false
},
{
"cameraId" : "1",
"function" : "front",
"x" : 0.0,
"y" : 100.0,
"z" : 48,
"yaw" : 0,
"pitch" : -10,
"roll" : 0,
"hfov" : 115,
"vfov" : 80,
"hflip" : false,
"vflip" : false
},
{
"cameraId" : "2",
"function" : "right",
"x" : -25.0,
"y" : 60.0,
"z" : 88,
"yaw" : -90,
"pitch" : -10,
"roll" : 0,
"hfov" : 60,
"vfov" : 62,
"hflip" : false,
"vflip" : false
},
{
"cameraId" : "3",
"function" : "left",
"x" : 20.0,
"y" : 60.0,
"z" : 88,
"yaw" : 90,
"pitch" : -10,
"roll" : 0,
"hfov" : 60,
"vfov" : 62,
"hflip" : false,
"vflip" : false
}
]
}

View File

@@ -32,7 +32,6 @@
<id>21</id>
<id>22</id>
<id>23</id>
<id>31</id>
</ignore>
</Provider>
<!-- See ExternalCameraUtils.cpp for default values of Device configurations below -->

View File

@@ -248,10 +248,8 @@ static void hdmicec_get_port_info(const struct hdmi_cec_device *dev,
ctx->port_info.arc_supported,
ctx->port_info.physical_address);
if (ctx->port_info.physical_address != CEC_PHYS_ADDR_INVALID) {
*list = &ctx->port_info;
*total = 1;
}
*list = &ctx->port_info;
*total = 1;
}
static void hdmicec_set_option(const struct hdmi_cec_device *dev, int flag, int value)

View File

@@ -1,4 +1,12 @@
<compatibility-matrix version="1.0" type="device">
<hal format="hidl" optional="false">
<name>android.frameworks.displayservice</name>
<version>1.0</version>
<interface>
<name>IDisplayService</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="false">
<name>android.frameworks.sensorservice</name>
<version>1.0</version>
@@ -31,4 +39,20 @@
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="false">
<name>android.system.net.netd</name>
<version>1.1</version>
<interface>
<name>INetd</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl" optional="false">
<name>android.system.wifi.keystore</name>
<version>1.0</version>
<interface>
<name>IKeystore</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>

107
device.mk
View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2021-2023 KonstaKANG
# Copyright (C) 2021-2022 KonstaKANG
#
# SPDX-License-Identifier: Apache-2.0
#
@@ -8,19 +8,21 @@ DEVICE_PATH := device/brcm/rpi4
PRODUCT_SOONG_NAMESPACES += $(DEVICE_PATH)
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
$(call inherit-product, frameworks/native/build/tablet-7in-xhdpi-2048-dalvik-heap.mk)
$(call inherit-product, vendor/brcm/rpi4/rpi4-vendor.mk)
# APEX
$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
PRODUCT_AAPT_CONFIG := normal mdpi hdpi
PRODUCT_AAPT_PREF_CONFIG := hdpi
PRODUCT_CHARACTERISTICS := tablet,nosdcard
# API level
PRODUCT_SHIPPING_API_LEVEL := 34
PRODUCT_SHIPPING_API_LEVEL := 32
# Audio
PRODUCT_PACKAGES += \
android.hardware.audio.service \
android.hardware.audio@7.1-impl \
android.hardware.audio@7.0-impl \
android.hardware.audio.effect@7.0-impl \
audio.primary.rpi \
audio.primary.rpi_hdmi \
@@ -74,14 +76,17 @@ PRODUCT_COPY_FILES += \
# Bluetooth
PRODUCT_PACKAGES += \
android.hardware.bluetooth@1.1-service.btlinux
android.hardware.bluetooth@1.0-impl \
android.hardware.bluetooth@1.0-service \
libbt-vendor
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml
PRODUCT_PACKAGES += \
android.hardware.bluetooth.audio-impl \
android.hardware.bluetooth.audio@2.0-impl \
audio.a2dp.default \
audio.bluetooth.default
PRODUCT_COPY_FILES += \
@@ -90,7 +95,7 @@ PRODUCT_COPY_FILES += \
# Camera
PRODUCT_PACKAGES += \
android.hardware.camera.provider-V1-external-service
android.hardware.camera.provider@2.5-external-service
PRODUCT_COPY_FILES += \
$(DEVICE_PATH)/camera/external_camera_config.xml:$(TARGET_COPY_OUT_VENDOR)/etc/external_camera_config.xml
@@ -101,34 +106,19 @@ PRODUCT_COPY_FILES += \
PRODUCT_PACKAGES += \
android.hardware.camera.provider@2.5-service_64 \
camera.libcamera \
ipa_rpi_vc4
PRODUCT_COPY_FILES += \
$(DEVICE_PATH)/camera/android.hardware.camera.provider@2.5-service_64.rpi.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/android.hardware.camera.provider@2.5-service_64.rpi.rc
ipa_rpi
PRODUCT_COPY_FILES += \
$(DEVICE_PATH)/camera/camera_hal.yaml:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/camera_hal.yaml \
external/libcamera/src/ipa/rpi/vc4/data/imx219.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx219.json \
external/libcamera/src/ipa/rpi/vc4/data/imx219_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx219_noir.json \
external/libcamera/src/ipa/rpi/vc4/data/imx296.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx296.json \
external/libcamera/src/ipa/rpi/vc4/data/imx296_mono.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx296_mono.json \
external/libcamera/src/ipa/rpi/vc4/data/imx477.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx477.json \
external/libcamera/src/ipa/rpi/vc4/data/imx477_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx477_noir.json \
external/libcamera/src/ipa/rpi/vc4/data/imx477_scientific.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx477_scientific.json \
external/libcamera/src/ipa/rpi/vc4/data/imx708.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx708.json \
external/libcamera/src/ipa/rpi/vc4/data/imx708_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx708_noir.json \
external/libcamera/src/ipa/rpi/vc4/data/imx708_wide.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx708_wide.json \
external/libcamera/src/ipa/rpi/vc4/data/imx708_wide_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx708_wide_noir.json \
external/libcamera/src/ipa/rpi/vc4/data/ov5647.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/ov5647.json \
external/libcamera/src/ipa/rpi/vc4/data/ov5647_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/ov5647_noir.json
external/libcamera/src/ipa/raspberrypi/data/imx219.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx219.json \
external/libcamera/src/ipa/raspberrypi/data/imx219_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx219_noir.json \
external/libcamera/src/ipa/raspberrypi/data/imx477.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx477.json \
external/libcamera/src/ipa/raspberrypi/data/imx477_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx477_noir.json \
external/libcamera/src/ipa/raspberrypi/data/ov5647.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/ov5647.json \
external/libcamera/src/ipa/raspberrypi/data/ov5647_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/ov5647_noir.json
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.camera.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.xml \
frameworks/native/data/etc/android.hardware.camera.concurrent.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.concurrent.xml \
frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.flash-autofocus.xml \
frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \
frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \
frameworks/native/data/etc/android.hardware.camera.raw.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.raw.xml
frameworks/native/data/etc/android.hardware.camera.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.xml
PRODUCT_COPY_FILES += \
$(DEVICE_PATH)/camera/media_profiles_V1_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_V1_0.xml
@@ -147,11 +137,9 @@ PRODUCT_SET_DEBUGFS_RESTRICTIONS := false
# DRM
PRODUCT_PACKAGES += \
android.hardware.drm-service.clearkey
# Emergency info
PRODUCT_PACKAGES += \
EmergencyInfo
android.hardware.drm@1.0-impl \
android.hardware.drm@1.0-service \
android.hardware.drm@1.4-service.clearkey
# Ethernet
PRODUCT_COPY_FILES += \
@@ -168,8 +156,7 @@ PRODUCT_PACKAGES += \
# Graphics
PRODUCT_PACKAGES += \
android.hardware.graphics.allocator@4.0-service.minigbm_gbm_mesa \
android.hardware.graphics.mapper@4.0-impl.minigbm_gbm_mesa \
libgbm_mesa_wrapper
android.hardware.graphics.mapper@4.0-impl.minigbm_gbm_mesa
PRODUCT_PACKAGES += \
android.hardware.graphics.composer@2.4-service \
@@ -183,19 +170,19 @@ PRODUCT_PACKAGES += \
libglapi
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.opengles.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml
frameworks/native/data/etc/android.software.opengles.deqp.level-2021-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml
PRODUCT_PACKAGES += \
vulkan.broadcom
PRODUCT_COPY_FILES += \
$(DEVICE_PATH)/vulkan/android.hardware.vulkan.version-1_2.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \
frameworks/native/data/etc/android.hardware.vulkan.level-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \
frameworks/native/data/etc/android.software.vulkan.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml
frameworks/native/data/etc/android.hardware.vulkan.version-1_0_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \
frameworks/native/data/etc/android.software.vulkan.deqp.level-2021-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml
# Health
PRODUCT_PACKAGES += \
android.hardware.health-service.rpi
android.hardware.health@2.0-service.rpi
# Kernel
PRODUCT_COPY_FILES += \
@@ -207,11 +194,12 @@ PRODUCT_COPY_FILES += \
# Keymaster
PRODUCT_PACKAGES += \
android.hardware.keymaster@4.1-service
android.hardware.keymaster@3.0-impl \
android.hardware.keymaster@3.0-service
# Lights
PRODUCT_PACKAGES += \
android.hardware.light-service.rpi
android.hardware.light@2.0-service.rpi
# Media
PRODUCT_COPY_FILES += \
@@ -220,6 +208,18 @@ PRODUCT_COPY_FILES += \
frameworks/av/media/libstagefright/data/media_codecs_google_c2_tv.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_c2_tv.xml \
frameworks/av/media/libstagefright/data/media_codecs_google_c2_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_c2_video.xml
# Overlays
PRODUCT_PACKAGES += \
AndroidRpiOverlay \
SettingsRpiOverlay \
SettingsProviderRpiOverlay \
SystemUIRpiOverlay \
WifiRpiOverlay
# Permissions
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/tablet_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/tablet_core_hardware.xml
# Power
PRODUCT_PACKAGES += \
android.hardware.power-service.example
@@ -238,6 +238,10 @@ PRODUCT_COPY_FILES += \
$(DEVICE_PATH)/seccomp_policy/mediacodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediacodec.policy \
$(DEVICE_PATH)/seccomp_policy/mediaswcodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaswcodec.policy
# Settings
PRODUCT_PACKAGES += \
androidx.window.extensions
# Storage
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)
@@ -245,14 +249,9 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)
PRODUCT_PACKAGES += \
suspend_blocker_rpi
# Thermal
PRODUCT_PACKAGES += \
android.hardware.thermal-service.example
# USB
PRODUCT_PACKAGES += \
android.hardware.usb-service.example \
android.hardware.usb.gadget@1.2-service.rpi
android.hardware.usb@1.0-service
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \
@@ -269,12 +268,9 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \
$(DEVICE_PATH)/media/media_codecs_v4l2_c2_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_v4l2_c2_video.xml
# Virtualization
$(call inherit-product, packages/modules/Virtualization/apex/product_packages.mk)
# Wifi
PRODUCT_PACKAGES += \
android.hardware.wifi-service \
android.hardware.wifi@1.0-service \
hostapd \
hostapd_cli \
libwpa_client \
@@ -288,6 +284,3 @@ PRODUCT_COPY_FILES += \
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml
# Window extensions
$(call inherit-product, $(SRC_TARGET_DIR)/product/window_extensions.mk)

View File

@@ -1,12 +0,0 @@
<compatibility-matrix version="1.0" type="framework">
<hal format="hidl" optional="true">
<name>android.hardware.media.c2</name>
<transport>hwbinder</transport>
<version>1.0-2</version>
<interface>
<name>IComponentStore</name>
<instance>ffmpeg</instance>
<instance>v4l2</instance>
</interface>
</hal>
</compatibility-matrix>

View File

@@ -1,32 +1,33 @@
// Copyright (C) 2018 The Android Open Source Project
// Copyright (C) 2023 KonstaKANG
// Copyright (C) 2021-2022 KonstaKANG
//
// SPDX-License-Identifier: Apache-2.0
cc_binary {
name: "android.hardware.health-service.rpi",
name: "android.hardware.health@2.0-service.rpi",
init_rc: ["android.hardware.health@2.0-service.rpi.rc"],
vintf_fragments: ["android.hardware.health@2.0-service.rpi.xml"],
proprietary: true,
relative_install_path: "hw",
vendor: true,
init_rc: ["android.hardware.health-service.rpi.rc"],
vintf_fragments: ["android.hardware.health-service.rpi.xml"],
srcs: [
"HealthImpl.cpp",
"main.cpp",
"HealthService.cpp",
],
cflags: [
"-Wall",
"-Werror",
],
static_libs: [
"android.hardware.health-translate-ndk",
"android.hardware.health@2.0-impl",
"android.hardware.health@1.0-convert",
"libhealthservice",
"libbatterymonitor",
"libhealthloop",
"libhealth_aidl_impl",
"libhealthstoragedefault",
],
shared_libs: [
"libbase",
"libbinder_ndk",
"libcutils",
"libhidlbase",
"liblog",
"libutils",
"android.hardware.health-V2-ndk",
"android.hardware.health@2.0",
],
overrides: ["charger"],
header_libs: ["libhealthd_headers"],
}

View File

@@ -1,38 +0,0 @@
/*
* Copyright (C) 2021 The Android Open Source Project
* Copyright (C) 2023 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "HealthImpl.h"
using ::aidl::android::hardware::health::BatteryHealth;
using ::aidl::android::hardware::health::BatteryStatus;
using ::aidl::android::hardware::health::HealthInfo;
namespace aidl::android::hardware::health {
void HealthImpl::UpdateHealthInfo(HealthInfo* health_info) {
health_info->chargerAcOnline = true;
health_info->batteryLevel = 100;
health_info->batteryStatus = BatteryStatus::CHARGING;
health_info->batteryHealth = BatteryHealth::GOOD;
}
ndk::ScopedAStatus HealthImpl::getChargeStatus(BatteryStatus* out) {
*out = BatteryStatus::CHARGING;
return ndk::ScopedAStatus::ok();
}
} // namespace aidl::android::hardware::health

View File

@@ -1,37 +0,0 @@
/*
* Copyright (C) 2021 The Android Open Source Project
* Copyright (C) 2023 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <health-impl/Health.h>
using ::aidl::android::hardware::health::Health;
namespace aidl::android::hardware::health {
class HealthImpl : public Health {
public:
using Health::Health;
virtual ~HealthImpl() {}
ndk::ScopedAStatus getChargeStatus(BatteryStatus* out) override;
protected:
void UpdateHealthInfo(HealthInfo* health_info) override;
};
} // namespace aidl::android::hardware::health

20
health/HealthService.cpp Normal file
View File

@@ -0,0 +1,20 @@
/*
* Copyright (C) 2021-2022 KonstaKANG
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <health2/service.h>
#include <healthd/healthd.h>
int main() {
return health_service_main();
}
void healthd_board_init(struct healthd_config*) {}
int healthd_board_battery_update(struct android::BatteryProperties* battery_props) {
battery_props->chargerAcOnline = true;
battery_props->batteryLevel = 100;
return 0;
}

View File

@@ -1,6 +0,0 @@
service vendor.health-default /vendor/bin/hw/android.hardware.health-service.rpi
class hal
user system
group system
capabilities WAKE_ALARM BLOCK_SUSPEND
file /dev/kmsg w

View File

@@ -1,7 +0,0 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.health</name>
<version>2</version>
<fqname>IHealth/default</fqname>
</hal>
</manifest>

View File

@@ -0,0 +1,5 @@
service vendor.health-hal-2-0 /vendor/bin/hw/android.hardware.health@2.0-service.rpi
class hal
user system
group system
file /dev/kmsg w

View File

@@ -1,10 +1,10 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>android.hardware.usb.gadget</name>
<name>android.hardware.health</name>
<transport>hwbinder</transport>
<version>1.2</version>
<version>2.0</version>
<interface>
<name>IUsbGadget</name>
<name>IHealth</name>
<instance>default</instance>
</interface>
</hal>

View File

@@ -1,32 +0,0 @@
/*
* Copyright (C) 2021 The Android Open Source Project
* Copyright (C) 2023 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "HealthImpl.h"
#include <android/binder_interface_utils.h>
#include <health/utils.h>
using ::aidl::android::hardware::health::HalHealthLoop;
using ::aidl::android::hardware::health::HealthImpl;
int main() {
auto config = std::make_unique<healthd_config>();
android::hardware::health::InitHealthdConfig(config.get());
auto binder = ndk::SharedRefBase::make<HealthImpl>("default", std::move(config));
auto hal_health_loop = std::make_shared<HalHealthLoop>(binder, binder);
return hal_health_loop->StartLoop();
}

View File

@@ -139,7 +139,7 @@ key 116 POWER
key 117 NUMPAD_EQUALS
# key 118 "KEY_KPPLUSMINUS"
key 119 BREAK
key 120 RECENT_APPS
# key 120 (undefined)
key 121 NUMPAD_COMMA
key 122 KANA
key 123 EISU
@@ -246,10 +246,6 @@ key 217 SEARCH
key 224 BRIGHTNESS_DOWN
key 225 BRIGHTNESS_UP
key 226 HEADSETHOOK
key 228 KEYBOARD_BACKLIGHT_TOGGLE
key 229 KEYBOARD_BACKLIGHT_DOWN
key 230 KEYBOARD_BACKLIGHT_UP
key 248 MUTE
key 256 BUTTON_1
key 257 BUTTON_2
@@ -303,11 +299,6 @@ key 317 BUTTON_THUMBL
key 318 BUTTON_THUMBR
key 329 STYLUS_BUTTON_TERTIARY
key 331 STYLUS_BUTTON_PRIMARY
key 332 STYLUS_BUTTON_SECONDARY
# key 352 "KEY_OK"
key 353 DPAD_CENTER
# key 354 "KEY_GOTO"
@@ -372,11 +363,6 @@ key 405 LAST_CHANNEL
# key 413 "KEY_DIGITS"
# key 414 "KEY_TEEN"
# key 415 "KEY_TWEN"
# key 418 "KEY_ZOOM_IN"
key 418 ZOOM_IN
# key 419 "KEY_ZOOM_OUT"
key 419 ZOOM_OUT
key 528 FOCUS
key 429 CONTACTS
@@ -424,10 +410,6 @@ key 580 APP_SWITCH
key 582 VOICE_ASSIST
# Linux KEY_ASSISTANT
key 583 ASSIST
key 656 MACRO_1
key 657 MACRO_2
key 658 MACRO_3
key 659 MACRO_4
# CEC
key 352 ENTER
@@ -439,14 +421,7 @@ key 174 BACK
key usage 0x0c0067 WINDOW
key usage 0x0c006F BRIGHTNESS_UP
key usage 0x0c0070 BRIGHTNESS_DOWN
key usage 0x0c0079 KEYBOARD_BACKLIGHT_UP
key usage 0x0c007A KEYBOARD_BACKLIGHT_DOWN
key usage 0x0c007C KEYBOARD_BACKLIGHT_TOGGLE
key usage 0x0c0173 MEDIA_AUDIO_TRACK
key usage 0x0c019C PROFILE_SWITCH
key usage 0x0c01A2 ALL_APPS
key usage 0x0d0044 STYLUS_BUTTON_PRIMARY
key usage 0x0d005a STYLUS_BUTTON_SECONDARY
# Joystick and game controller axes.
# Axes that are not mapped will be assigned generic axis numbers by the input subsystem.
@@ -459,8 +434,8 @@ axis 0x05 RZ
axis 0x06 THROTTLE
axis 0x07 RUDDER
axis 0x08 WHEEL
axis 0x09 RTRIGGER
axis 0x0a LTRIGGER
axis 0x09 GAS
axis 0x0a BRAKE
axis 0x10 HAT_X
axis 0x11 HAT_Y

View File

@@ -1,21 +1,24 @@
// Copyright (C) 2020 The Android Open Source Project
// Copyright (C) 2023 KonstaKANG
// Copyright (C) 2018 The LineageOS Project
// Copyright (C) 2021-2022 KonstaKANG
//
// SPDX-License-Identifier: Apache-2.0
cc_binary {
name: "android.hardware.light-service.rpi",
name: "android.hardware.light@2.0-service.rpi",
init_rc: ["android.hardware.light@2.0-service.rpi.rc"],
vintf_fragments: ["android.hardware.light@2.0-service.rpi.xml"],
proprietary: true,
relative_install_path: "hw",
vendor: true,
init_rc: ["android.hardware.light-service.rpi.rc"],
vintf_fragments: ["android.hardware.light-service.rpi.xml"],
srcs: [
"Lights.cpp",
"main.cpp",
"Light.cpp",
"service.cpp",
],
shared_libs: [
"libbase",
"libbinder_ndk",
"android.hardware.light-V2-ndk",
"libcutils",
"libhardware",
"libhidlbase",
"libutils",
"android.hardware.light@2.0",
],
}

93
light/Light.cpp Normal file
View File

@@ -0,0 +1,93 @@
/*
* Copyright (C) 2018 The LineageOS Project
* Copyright (C) 2021-2022 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LightService"
#include "Light.h"
#include <android-base/logging.h>
namespace {
using android::hardware::light::V2_0::LightState;
static constexpr int DEFAULT_MAX_BRIGHTNESS = 255;
static uint32_t rgbToBrightness(const LightState& state) {
uint32_t color = state.color & 0x00ffffff;
return ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) +
(29 * (color & 0xff))) >> 8;
}
} // anonymous namespace
namespace android {
namespace hardware {
namespace light {
namespace V2_0 {
namespace implementation {
Light::Light(std::pair<std::ofstream, uint32_t>&& lcd_backlight)
: mLcdBacklight(std::move(lcd_backlight)) {
auto backlightFn(std::bind(&Light::setLcdBacklight, this, std::placeholders::_1));
mLights.emplace(std::make_pair(Type::BACKLIGHT, backlightFn));
}
// Methods from ::android::hardware::light::V2_0::ILight follow.
Return<Status> Light::setLight(Type type, const LightState& state) {
auto it = mLights.find(type);
if (it == mLights.end()) {
return Status::LIGHT_NOT_SUPPORTED;
}
it->second(state);
return Status::SUCCESS;
}
Return<void> Light::getSupportedTypes(getSupportedTypes_cb _hidl_cb) {
std::vector<Type> types;
for (auto const& light : mLights) {
types.push_back(light.first);
}
_hidl_cb(types);
return Void();
}
void Light::setLcdBacklight(const LightState& state) {
std::lock_guard<std::mutex> lock(mLock);
uint32_t brightness = rgbToBrightness(state);
// If max panel brightness is not the default (255),
// apply linear scaling across the accepted range.
if (mLcdBacklight.second != DEFAULT_MAX_BRIGHTNESS) {
int old_brightness = brightness;
brightness = brightness * mLcdBacklight.second / DEFAULT_MAX_BRIGHTNESS;
LOG(VERBOSE) << "scaling brightness " << old_brightness << " => " << brightness;
}
mLcdBacklight.first << brightness << std::endl;
}
} // namespace implementation
} // namespace V2_0
} // namespace light
} // namespace hardware
} // namespace android

56
light/Light.h Normal file
View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2018 The LineageOS Project
* Copyright (C) 2021-2022 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
#define ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
#include <android/hardware/light/2.0/ILight.h>
#include <hidl/Status.h>
#include <fstream>
#include <mutex>
#include <unordered_map>
namespace android {
namespace hardware {
namespace light {
namespace V2_0 {
namespace implementation {
struct Light : public ILight {
Light(std::pair<std::ofstream, uint32_t>&& lcd_backlight);
// Methods from ::android::hardware::light::V2_0::ILight follow.
Return<Status> setLight(Type type, const LightState& state) override;
Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb) override;
private:
void setLcdBacklight(const LightState& state);
std::pair<std::ofstream, uint32_t> mLcdBacklight;
std::unordered_map<Type, std::function<void(const LightState&)>> mLights;
std::mutex mLock;
};
} // namespace implementation
} // namespace V2_0
} // namespace light
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H

View File

@@ -1,67 +0,0 @@
/*
* Copyright (C) 2019 The Android Open Source Project
* Copyright (C) 2023 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "Lights.h"
#include <android-base/file.h>
using ::android::base::WriteStringToFile;
namespace aidl::android::hardware::light {
static const std::string backlightFiles[] = {
"/sys/class/backlight/rpi_backlight/brightness"
};
const static std::vector<HwLight> availableLights = {
{.id = (int)LightType::BACKLIGHT, .type = LightType::BACKLIGHT, .ordinal = 0}
};
ndk::ScopedAStatus Lights::setLightState(int id, const HwLightState& state) {
HwLight const& light = availableLights[id];
std::string const brightness = std::to_string(rgbToBrightness(state));
switch (light.type) {
case LightType::BACKLIGHT:
for (auto &file : backlightFiles) {
if (!access(file.c_str(), W_OK)) {
WriteStringToFile(brightness, file);
}
}
break;
default:
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Lights::getLights(std::vector<HwLight>* lights) {
for (auto i = availableLights.begin(); i != availableLights.end(); i++) {
lights->push_back(*i);
}
return ndk::ScopedAStatus::ok();
}
uint32_t Lights::rgbToBrightness(const HwLightState& state) {
uint32_t color = state.color & 0x00ffffff;
return ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) +
(29 * (color & 0xff))) >> 8;
}
} // aidl::android::hardware::light

View File

@@ -1,33 +0,0 @@
/*
* Copyright (C) 2020 The Android Open Source Project
* Copyright (C) 2023 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <aidl/android/hardware/light/BnLights.h>
namespace aidl::android::hardware::light {
class Lights : public BnLights {
public:
ndk::ScopedAStatus setLightState(int id, const HwLightState& state) override;
ndk::ScopedAStatus getLights(std::vector<HwLight>* types) override;
private:
uint32_t rgbToBrightness(const HwLightState& state);
};
} // aidl::android::hardware::light

View File

@@ -1,7 +0,0 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.light</name>
<version>2</version>
<fqname>ILights/default</fqname>
</hal>
</manifest>

View File

@@ -1,9 +1,11 @@
on early-boot
on init
chown system system /sys/class/backlight/rpi_backlight/brightness
chmod 660 /sys/class/backlight/rpi_backlight/brightness
service vendor.light-default /vendor/bin/hw/android.hardware.light-service.rpi
service vendor.light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service.rpi
interface android.hardware.light@2.0::ILight default
class hal
user system
group system
# shutting off lights while powering-off
shutdown critical

View File

@@ -0,0 +1,11 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>android.hardware.light</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>ILight</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View File

@@ -1,35 +0,0 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "Lights.h"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
using ::aidl::android::hardware::light::Lights;
int main() {
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<Lights> lights = ndk::SharedRefBase::make<Lights>();
const std::string instance = std::string() + Lights::descriptor + "/default";
binder_status_t status = AServiceManager_addService(lights->asBinder().get(), instance.c_str());
CHECK(status == STATUS_OK);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reached
}

63
light/service.cpp Normal file
View File

@@ -0,0 +1,63 @@
/*
* Copyright (C) 2018 The LineageOS Project
* Copyright (C) 2021-2022 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "android.hardware.light@2.0-service.rpi"
#include <android-base/logging.h>
#include <hidl/HidlTransportSupport.h>
#include <utils/Errors.h>
#include "Light.h"
// libhwbinder:
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
// Generated HIDL files
using android::hardware::light::V2_0::ILight;
using android::hardware::light::V2_0::implementation::Light;
const static std::string kLcdBacklightPath = "/sys/class/backlight/rpi_backlight/brightness";
int main() {
uint32_t lcdMaxBrightness = 255;
std::ofstream lcdBacklight(kLcdBacklightPath);
if (!lcdBacklight) {
LOG(ERROR) << "Failed to open " << kLcdBacklightPath << ", error=" << errno
<< " (" << strerror(errno) << ")";
//return -errno;
}
android::sp<ILight> service = new Light(
{std::move(lcdBacklight), lcdMaxBrightness});
configureRpcThreadpool(1, true);
android::status_t status = service->registerAsService();
if (status != android::OK) {
LOG(ERROR) << "Cannot register Light HAL service";
//return 1;
}
LOG(INFO) << "Light HAL Ready.";
joinRpcThreadpool();
// Under normal cases, execution will not reach this line.
LOG(ERROR) << "Light HAL failed to join thread pool.";
return 1;
}

View File

@@ -1,8 +1,8 @@
<manifest version="1.0" type="device" target-level="8">
<manifest version="1.0" type="device" target-level="6">
<hal format="hidl">
<name>android.hardware.audio</name>
<transport>hwbinder</transport>
<version>7.1</version>
<version>7.0</version>
<interface>
<name>IDevicesFactory</name>
<instance>default</instance>
@@ -20,18 +20,19 @@
<hal format="hidl">
<name>android.hardware.bluetooth</name>
<transport>hwbinder</transport>
<version>1.1</version>
<version>1.0</version>
<interface>
<name>IBluetoothHci</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl">
<name>android.hardware.camera.provider</name>
<version>1</version>
<hal format="hidl">
<name>android.hardware.bluetooth.audio</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>ICameraProvider</name>
<instance>external/0</instance>
<name>IBluetoothAudioProvidersFactory</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
@@ -40,9 +41,23 @@
<version>2.5</version>
<interface>
<name>ICameraProvider</name>
<instance>external/0</instance>
<instance>legacy/0</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.drm</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>ICryptoFactory</name>
<instance>default</instance>
</interface>
<interface>
<name>IDrmFactory</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.graphics.composer</name>
<transport>hwbinder</transport>
@@ -52,6 +67,28 @@
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.keymaster</name>
<transport>hwbinder</transport>
<version>3.0</version>
<interface>
<name>IKeymasterDevice</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.media.omx</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IOmx</name>
<instance>default</instance>
</interface>
<interface>
<name>IOmxStore</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.tv.cec</name>
<transport>hwbinder</transport>

View File

@@ -6,7 +6,7 @@
# SPDX-License-Identifier: Apache-2.0
#
VERSION=RaspberryVanillaAOSP14
VERSION=RaspberryVanillaAOSP12
DATE=$(date +%Y%m%d)
IMGNAME=${VERSION}-${DATE}-rpi4.img
IMGSIZE=7
@@ -63,6 +63,7 @@ echo "Copying vendor..."
sudo dd if=${OUTDIR}/vendor.img of=/dev/mapper/${LOOPDEV}p3 bs=1M
echo "Creating userdata..."
sudo mkfs.ext4 /dev/mapper/${LOOPDEV}p4 -I 512 -L userdata
sudo resize2fs /dev/mapper/${LOOPDEV}p4 1212156
sync
sudo kpartx -d "/dev/${LOOPDEV}"

View File

@@ -117,8 +117,4 @@
-->
<integer name="config_defaultNightMode">2</integer>
<!-- CEC Configuration -->
<bool name="config_cecTvSendStandbyOnSleepEnabled_default">false</bool>
<bool name="config_cecTvSendStandbyOnSleepDisabled_default">true</bool>
</resources>

View File

@@ -1,10 +0,0 @@
// Copyright (C) 2021-2022 KonstaKANG
//
// SPDX-License-Identifier: Apache-2.0
runtime_resource_overlay {
name: "AndroidTvRpiOverlay",
resource_dirs: ["res"],
sdk_version: "current",
proprietary: true
}

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2021-2022 KonstaKANG
**
** SPDX-License-Identifier: Apache-2.0
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.rpi.tv"
android:versionCode="1"
android:versionName="1.0" >
<application android:hasCode="false" />
<overlay
android:targetPackage="android"
android:isStatic="true"
android:priority="0" />
</manifest>

View File

@@ -1,62 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2009 The Android Open Source Project
Copyright (C) 2021-2022 KonstaKANG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<!-- User activity timeout: Minimum screen off timeout in milliseconds.
Sets a lower bound for the {@link Settings.System#SCREEN_OFF_TIMEOUT} setting
which determines how soon the device will go to sleep when there is no
user activity.
This value must be greater than zero, otherwise the device will immediately
fall asleep again as soon as it is awoken.
-->
<integer name="config_minimumScreenOffTimeout">86400000</integer>
<!-- Default screen brightness setting.
Must be in the range specified by minimum and maximum. -->
<integer name="config_screenBrightnessSettingDefault">128</integer>
<!-- Minimum screen brightness setting allowed by the power manager.
The user is forbidden from setting the brightness below this level. -->
<integer name="config_screenBrightnessSettingMinimum">20</integer>
<!-- Screen brightness used to dim the screen when the user activity
timeout expires. May be less than the minimum allowed brightness setting
that can be set by the user. -->
<integer name="config_screenBrightnessDim">20</integer>
<!-- If true, then we do not ask user for permission for apps to connect to USB devices.
Do not set this to true for production devices. Doing so will cause you to fail CTS. -->
<bool name="config_disableUsbPermissionDialogs">true</bool>
<!-- Control the behavior when the user long presses the power button.
0 - Nothing
1 - Global actions menu
2 - Power off (with confirmation)
3 - Power off (without confirmation)
4 - Go to voice assist
5 - Go to assistant (Settings.Secure.ASSISTANT)
-->
<integer name="config_longPressOnPowerBehavior">1</integer>
<!-- CEC Configuration -->
<bool name="config_cecTvSendStandbyOnSleepEnabled_default">false</bool>
<bool name="config_cecTvSendStandbyOnSleepDisabled_default">true</bool>
</resources>

View File

@@ -1,10 +0,0 @@
// Copyright (C) 2021-2023 KonstaKANG
//
// SPDX-License-Identifier: Apache-2.0
runtime_resource_overlay {
name: "CarServiceRpiOverlay",
resource_dirs: ["res"],
sdk_version: "current",
proprietary: true
}

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2021-2023 KonstaKANG
**
** SPDX-License-Identifier: Apache-2.0
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.car.resources.rpi"
android:versionCode="1"
android:versionName="1.0">
<application android:hasCode="false" />
<overlay
android:targetPackage="com.android.car.updatable"
android:targetName="CarServiceCustomization"
android:isStatic="true"
android:priority="0" />
</manifest>

View File

@@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Copyright (C) 2021-2023 KonstaKANG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Specifies notice UI that will be launched when user starts a car or do user
switching. It is recommended to use dialog with at least TYPE_APPLICATION_OVERLAY window
type to show the UI regardless of activity launches. Target package will be auto-granted
necessary permission for TYPE_APPLICATION_OVERLAY window type. The UI package should
resolve permission by itself to use any higher priority window type.
Setting this string to empty will disable the feature. -->
<string name="config_userNoticeUiService" translatable="false"></string>
<!-- A name of a camera device that provides the rearview through EVS service -->
<string name="config_evsRearviewCameraId" translatable="false">/dev/video0</string>
<!-- The camera Activity name for EVS, if defined, the Activity will be launched by
CarEvsService. -->
<string name="config_evsCameraActivity" translatable="false">
com.google.android.car.evs/com.google.android.car.evs.CarEvsCameraPreviewActivity
</string>
</resources>

View File

@@ -33,6 +33,9 @@
<!-- Keep screen on at all times by default -->
<bool name="def_stay_on_while_plugged_in">true</bool>
<!-- Disable HDMI-CEC power off -->
<bool name="def_hdmiControlAutoDeviceOff">false</bool>
<!-- No setup wizard -->
<bool name="def_device_provisioned">true</bool>
<bool name="def_user_setup_complete">true</bool>

View File

@@ -1,10 +0,0 @@
// Copyright (C) 2021-2022 KonstaKANG
//
// SPDX-License-Identifier: Apache-2.0
runtime_resource_overlay {
name: "SettingsProviderTvRpiOverlay",
resource_dirs: ["res"],
sdk_version: "current",
proprietary: true
}

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2021-2022 KonstaKANG
**
** SPDX-License-Identifier: Apache-2.0
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.providers.settings.rpi.tv"
android:versionCode="1"
android:versionName="1.0" >
<application android:hasCode="false" />
<overlay
android:targetPackage="com.android.providers.settings"
android:isStatic="true"
android:priority="0" />
</manifest>

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2009 The Android Open Source Project
Copyright (C) 2021-2022 KonstaKANG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<!-- Default screen brightness -->
<integer name="def_screen_brightness">128</integer>
<!-- Disable location by default -->
<integer name="def_location_mode">0</integer>
<!-- No setup wizard -->
<bool name="def_device_provisioned">true</bool>
<bool name="def_user_setup_complete">true</bool>
</resources>

View File

@@ -24,16 +24,7 @@
<!-- Whether charging_sounds should be shown or not. -->
<bool name="config_show_charging_sounds">false</bool>
<!-- Whether data_saver should be shown or not. -->
<bool name="config_show_data_saver">false</bool>
<!-- Whether battery from app_info_settings is available or not. -->
<bool name="config_show_app_info_settings_battery">false</bool>
<!-- Whether top_level_battery should be shown or not. -->
<bool name="config_show_top_level_battery">false</bool>
<!-- Whether sim related information is visible to the end user. -->
<bool name="config_show_sim_info">false</bool>
</resources>

View File

@@ -5,6 +5,6 @@
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/mmcblk0p2 /system ext4 ro,barrier=1 wait,first_stage_mount
/dev/block/mmcblk0p3 /vendor ext4 ro,barrier=1 wait,first_stage_mount
/dev/block/mmcblk0p4 /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,formattable,quota
/dev/block/mmcblk0p4 /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,formattable,encryptable=footer,quota
/devices/platform/scb/*.pcie/*/*/*/usb* auto auto defaults voldmanaged=usb:auto
/devices/platform/soc/*.usb/usb* auto auto defaults voldmanaged=usb:auto

View File

@@ -1,8 +1,8 @@
on boot
mount configfs none /config
mkdir /config/usb_gadget/g1 0770
mkdir /config/usb_gadget/g1/strings/0x409 0770
write /config/usb_gadget/g1/bcdDevice 0x0440
mkdir /config/usb_gadget/g1 0770 shell shell
mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell
write /config/usb_gadget/g1/bcdDevice 0x0223
write /config/usb_gadget/g1/bcdUSB 0x0200
write /config/usb_gadget/g1/idVendor 0x18d1
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
@@ -15,8 +15,8 @@ on boot
mkdir /config/usb_gadget/g1/functions/audio_source.gs3
mkdir /config/usb_gadget/g1/functions/rndis.gs4
mkdir /config/usb_gadget/g1/functions/midi.gs5
mkdir /config/usb_gadget/g1/configs/b.1 0770
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770
mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
write /config/usb_gadget/g1/configs/b.1/MaxPower 500
write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
@@ -25,65 +25,66 @@ on boot
mkdir /dev/usb-ffs/mtp 0770 mtp mtp
mkdir /dev/usb-ffs/ptp 0770 mtp mtp
setprop sys.usb.mtp.device_type 3
setprop sys.usb.mtp.batchcancel true
setprop vendor.usb.rndis.config rndis.gs4
symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
chown system system /config/usb_gadget/
chown system system /config/usb_gadget/g1
chown system system /config/usb_gadget/g1/UDC
chown system system /config/usb_gadget/g1/bDeviceClass
chown system system /config/usb_gadget/g1/bDeviceProtocol
chown system system /config/usb_gadget/g1/bDeviceSubClass
chown system system /config/usb_gadget/g1/bMaxPacketSize0
chown system system /config/usb_gadget/g1/bcdDevice
chown system system /config/usb_gadget/g1/bcdUSB
chown system system /config/usb_gadget/g1/configs
chown system system /config/usb_gadget/g1/configs/b.1
chown system system /config/usb_gadget/g1/configs/b.1/MaxPower
chown system system /config/usb_gadget/g1/configs/b.1/bmAttributes
chown system system /config/usb_gadget/g1/configs/b.1/strings
chown system system /config/usb_gadget/g1/functions
chown system system /config/usb_gadget/g1/functions/accessory.gs2
chown system system /config/usb_gadget/g1/functions/audio_source.gs3
chown system system /config/usb_gadget/g1/functions/ffs.adb
chown system system /config/usb_gadget/g1/functions/ffs.mtp
chown system system /config/usb_gadget/g1/functions/ffs.ptp
chown system system /config/usb_gadget/g1/functions/midi.gs5
chown system system /config/usb_gadget/g1/functions/midi.gs5/buflen
chown system system /config/usb_gadget/g1/functions/midi.gs5/id
chown system system /config/usb_gadget/g1/functions/midi.gs5/in_ports
chown system system /config/usb_gadget/g1/functions/midi.gs5/index
chown system system /config/usb_gadget/g1/functions/midi.gs5/out_ports
chown system system /config/usb_gadget/g1/functions/midi.gs5/qlen
chown system system /config/usb_gadget/g1/functions/rndis.gs4
chown system system /config/usb_gadget/g1/functions/rndis.gs4/class
chown system system /config/usb_gadget/g1/functions/rndis.gs4/dev_addr
chown system system /config/usb_gadget/g1/functions/rndis.gs4/host_addr
chown system system /config/usb_gadget/g1/functions/rndis.gs4/ifname
chown system system /config/usb_gadget/g1/functions/rndis.gs4/os_desc
chown system system /config/usb_gadget/g1/functions/rndis.gs4/os_desc/interface.rndis
chown system system /config/usb_gadget/g1/functions/rndis.gs4/os_desc/interface.rndis/compatible_id
chown system system /config/usb_gadget/g1/functions/rndis.gs4/os_desc/interface.rndis/sub_compatible_id
chown system system /config/usb_gadget/g1/functions/rndis.gs4/protocol
chown system system /config/usb_gadget/g1/functions/rndis.gs4/qmult
chown system system /config/usb_gadget/g1/functions/rndis.gs4/subclass
chown system system /config/usb_gadget/g1/idProduct
chown system system /config/usb_gadget/g1/idVendor
chown system system /config/usb_gadget/g1/max_speed
chown system system /config/usb_gadget/g1/os_desc
chown system system /config/usb_gadget/g1/os_desc/b.1
chown system system /config/usb_gadget/g1/os_desc/b_vendor_code
chown system system /config/usb_gadget/g1/os_desc/qw_sign
chown system system /config/usb_gadget/g1/os_desc/use
chown system system /config/usb_gadget/g1/strings
chown system system /config/usb_gadget/g1/strings/0x409
chown system system /config/usb_gadget/g1/strings/0x409/manufacturer
chown system system /config/usb_gadget/g1/strings/0x409/product
chown system system /config/usb_gadget/g1/strings/0x409/serialnumber
on property:sys.usb.controller=*
mount functionfs adb /dev/usb-ffs/adb rmode=0770,fmode=0660,uid=2000,gid=2000,no_disconnect=1
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
setprop sys.usb.configfs 2
setprop sys.usb.configfs 1
on property:sys.usb.config=none && property:sys.usb.configfs=1
write /config/usb_gadget/g1/os_desc/use 0
on property:sys.usb.config=mtp && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee1
write /config/usb_gadget/g1/os_desc/use 1
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee2
write /config/usb_gadget/g1/os_desc/use 1
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
on property:sys.usb.config=rndis && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee3
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee4
on property:sys.usb.config=ptp && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee5
write /config/usb_gadget/g1/os_desc/use 1
symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee6
write /config/usb_gadget/g1/os_desc/use 1
symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee7
on property:sys.usb.config=midi && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee8
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee9
on property:sys.usb.config=accessory && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2d00
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2d01
on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2d02
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2d03
on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2d04
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2d05

View File

@@ -1,5 +1,7 @@
# Bluetooth
/dev/ttyAMA0 0660 bluetooth bluetooth
/dev/rfkill 0660 bluetooth bluetooth
/dev/vcio 0660 system bluetooth
# Camera
/dev/media* 0660 system camera
@@ -16,15 +18,10 @@
# ION
/dev/ion 0664 system system
# USB
/sys/class/udc/fe980000.usb current_speed 0664 system system
# V4L2
/dev/media0 0660 media media
/dev/media1 0660 media media
/dev/video10 0660 media media
/dev/video11 0660 media media
/dev/video12 0660 media media
/dev/video18 0660 media media
/dev/video19 0660 media media
/dev/video31 0660 media media

1
sepolicy/bluetooth.te Normal file
View File

@@ -0,0 +1 @@
allow bluetooth vcio_device:chr_file rw_file_perms;

View File

@@ -1 +1,2 @@
type cec_device, dev_type;
type vcio_device, dev_type, mlstrustedobject;

1
sepolicy/file.te Normal file
View File

@@ -0,0 +1 @@
type sysfs_gpu, fs_type, sysfs_type;

View File

@@ -1,4 +1,6 @@
# Bluetooth
/dev/ttyAMA0 u:object_r:hci_attach_dev:s0
/dev/vcio u:object_r:vcio_device:s0
/sys/class/rfkill/rfkill[0-9]/state u:object_r:sysfs_bluetooth_writable:s0
# CEC
@@ -6,11 +8,11 @@
/dev/cec1 u:object_r:cec_device:s0
# DRM
/vendor/bin/hw/android\.hardware\.drm-service\.clearkey u:object_r:hal_drm_clearkey_exec:s0
/vendor/bin/hw/android\.hardware\.drm-service\.widevine(.*)? u:object_r:hal_drm_widevine_exec:s0
/vendor/bin/hw/android\.hardware\.drm@1\.4-service\.clearkey u:object_r:hal_drm_clearkey_exec:s0
/vendor/bin/hw/android\.hardware\.drm@1\.4-service\.widevine u:object_r:hal_drm_widevine_exec:s0
# FFmpeg
/vendor/bin/hw/android\.hardware\.media\.c2@1\.2-service-ffmpeg u:object_r:mediacodec_exec:s0
/vendor/bin/hw/android\.hardware\.media\.c2@1\.2-service-ffmpeg(.*)? u:object_r:mediacodec_exec:s0
# Gatekeeper
/vendor/bin/hw/android\.hardware\.gatekeeper@1\.0-service\.software u:object_r:hal_gatekeeper_default_exec:s0
@@ -31,12 +33,12 @@
/vendor/lib(64)?/libminigbm_gralloc_gbm_mesa\.so u:object_r:same_process_hal_file:s0
# Health
/vendor/bin/hw/android\.hardware\.health-service\.rpi u:object_r:hal_health_default_exec:s0
/vendor/bin/hw/android\.hardware\.health@2\.0-service\.rpi u:object_r:hal_health_default_exec:s0
# Lights
/sys/class/backlight/rpi_backlight/brightness u:object_r:sysfs_leds:s0
/sys/devices/platform/rpi_backlight/backlight/rpi_backlight/brightness u:object_r:sysfs_leds:s0
/vendor/bin/hw/android\.hardware\.light-service\.rpi u:object_r:hal_light_default_exec:s0
/vendor/bin/hw/android\.hardware\.light@2\.0-service\.rpi u:object_r:hal_light_default_exec:s0
# Partitions
/dev/block/mmcblk0p1 u:object_r:boot_block_device:s0
@@ -47,8 +49,5 @@
# Suspend
/vendor/bin/suspend_blocker_rpi u:object_r:suspend_blocker_exec:s0
# USB
/vendor/bin/hw/android\.hardware\.usb\.gadget@1\.2-service\.rpi u:object_r:hal_usb_gadget_default_exec:s0
# V4L2
/vendor/bin/hw/android\.hardware\.media\.c2@1\.0-service-v4l2(.*)? u:object_r:mediacodec_exec:s0

View File

@@ -1 +0,0 @@
android.hardware.drm.IDrmFactory/widevine u:object_r:hal_drm_service:s0

View File

@@ -1,29 +0,0 @@
// Copyright (C) 2020 The Android Open Source Project
// Copyright (C) 2023 KonstaKANG
//
// SPDX-License-Identifier: Apache-2.0
cc_binary {
name: "android.hardware.usb.gadget@1.2-service.rpi",
defaults: ["hidl_defaults"],
relative_install_path: "hw",
init_rc: ["android.hardware.usb.gadget@1.2-service.rpi.rc"],
vintf_fragments: ["android.hardware.usb.gadget@1.2-service.rpi.xml"],
vendor: true,
srcs: [
"service.cpp",
"UsbGadget.cpp",
],
shared_libs: [
"android.hardware.usb.gadget@1.0",
"android.hardware.usb.gadget@1.1",
"android.hardware.usb.gadget@1.2",
"libbase",
"libcutils",
"libhardware",
"libhidlbase",
"liblog",
"libutils",
],
static_libs: ["libusbconfigfs-2"],
}

View File

@@ -1,287 +0,0 @@
/*
* Copyright (C) 2020 The Android Open Source Project
* Copyright (C) 2023 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "android.hardware.usb.gadget@1.2-service.rpi"
#include "UsbGadget.h"
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/inotify.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
namespace android {
namespace hardware {
namespace usb {
namespace gadget {
namespace V1_2 {
namespace implementation {
UsbGadget::UsbGadget() {
if (access(OS_DESC_PATH, R_OK) != 0) {
ALOGE("configfs setup not done yet");
abort();
}
}
void currentFunctionsAppliedCallback(bool functionsApplied, void* payload) {
UsbGadget* gadget = (UsbGadget*)payload;
gadget->mCurrentUsbFunctionsApplied = functionsApplied;
}
Return<void> UsbGadget::getCurrentUsbFunctions(const sp<V1_0::IUsbGadgetCallback>& callback) {
Return<void> ret = callback->getCurrentUsbFunctionsCb(
mCurrentUsbFunctions, mCurrentUsbFunctionsApplied ? Status::FUNCTIONS_APPLIED
: Status::FUNCTIONS_NOT_APPLIED);
if (!ret.isOk()) ALOGE("Call to getCurrentUsbFunctionsCb failed %s", ret.description().c_str());
return Void();
}
Return<void> UsbGadget::getUsbSpeed(const sp<V1_2::IUsbGadgetCallback>& callback) {
std::string current_speed;
if (ReadFileToString(SPEED_PATH, &current_speed)) {
current_speed = Trim(current_speed);
ALOGI("current USB speed is %s", current_speed.c_str());
if (current_speed == "low-speed")
mUsbSpeed = UsbSpeed::LOWSPEED;
else if (current_speed == "full-speed")
mUsbSpeed = UsbSpeed::FULLSPEED;
else if (current_speed == "high-speed")
mUsbSpeed = UsbSpeed::HIGHSPEED;
else if (current_speed == "super-speed")
mUsbSpeed = UsbSpeed::SUPERSPEED;
else if (current_speed == "super-speed-plus")
mUsbSpeed = UsbSpeed::SUPERSPEED_10Gb;
else if (current_speed == "UNKNOWN")
mUsbSpeed = UsbSpeed::UNKNOWN;
else {
/**
* This part is used for USB4 or reserved speed.
*
* If reserved speed is detected, it needs to convert to other speeds.
* For example:
* If the bandwidth of new speed is 7G, adding new if
* statement and set mUsbSpeed to SUPERSPEED.
* If the bandwidth of new speed is 80G, adding new if
* statement and set mUsbSpeed to USB4_GEN3_40Gb.
*/
mUsbSpeed = UsbSpeed::RESERVED_SPEED;
}
} else {
ALOGE("Fail to read current speed");
mUsbSpeed = UsbSpeed::UNKNOWN;
}
if (callback) {
Return<void> ret = callback->getUsbSpeedCb(mUsbSpeed);
if (!ret.isOk()) ALOGE("Call to getUsbSpeedCb failed %s", ret.description().c_str());
}
return Void();
}
V1_0::Status UsbGadget::tearDownGadget() {
if (resetGadget() != V1_0::Status::SUCCESS) return V1_0::Status::ERROR;
if (monitorFfs.isMonitorRunning()) {
monitorFfs.reset();
} else {
ALOGI("mMonitor not running");
}
return V1_0::Status::SUCCESS;
}
Return<Status> UsbGadget::reset() {
if (!WriteStringToFile("none", PULLUP_PATH)) {
ALOGI("Gadget cannot be pulled down");
return Status::ERROR;
}
usleep(kDisconnectWaitUs);
if (!WriteStringToFile(kGadgetName, PULLUP_PATH)) {
ALOGI("Gadget cannot be pulled up");
return Status::ERROR;
}
return Status::SUCCESS;
}
static V1_0::Status validateAndSetVidPid(uint64_t functions) {
V1_0::Status ret = V1_0::Status::SUCCESS;
switch (functions) {
case static_cast<uint64_t>(V1_2::GadgetFunction::MTP):
ret = setVidPid("0x18d1", "0x4ee1");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::MTP:
ret = setVidPid("0x18d1", "0x4ee2");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::RNDIS):
ret = setVidPid("0x18d1", "0x4ee3");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::RNDIS:
ret = setVidPid("0x18d1", "0x4ee4");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::PTP):
ret = setVidPid("0x18d1", "0x4ee5");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::PTP:
ret = setVidPid("0x18d1", "0x4ee6");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::ADB):
ret = setVidPid("0x18d1", "0x4ee7");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::MIDI):
ret = setVidPid("0x18d1", "0x4ee8");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::MIDI:
ret = setVidPid("0x18d1", "0x4ee9");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::NCM):
ret = setVidPid("0x18d1", "0x4eeb");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::NCM:
ret = setVidPid("0x18d1", "0x4eec");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::ACCESSORY):
ret = setVidPid("0x18d1", "0x2d00");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::ACCESSORY:
ret = setVidPid("0x18d1", "0x2d01");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::AUDIO_SOURCE):
ret = setVidPid("0x18d1", "0x2d02");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::AUDIO_SOURCE:
ret = setVidPid("0x18d1", "0x2d03");
break;
case V1_2::GadgetFunction::ACCESSORY | V1_2::GadgetFunction::AUDIO_SOURCE:
ret = setVidPid("0x18d1", "0x2d04");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::ACCESSORY |
V1_2::GadgetFunction::AUDIO_SOURCE:
ret = setVidPid("0x18d1", "0x2d05");
break;
default:
ALOGE("Combination not supported");
ret = V1_0::Status::CONFIGURATION_NOT_SUPPORTED;
}
return ret;
}
V1_0::Status UsbGadget::setupFunctions(uint64_t functions,
const sp<V1_0::IUsbGadgetCallback>& callback,
uint64_t timeout) {
bool ffsEnabled = false;
int i = 0;
if (addGenericAndroidFunctions(&monitorFfs, functions, &ffsEnabled, &i) !=
V1_0::Status::SUCCESS)
return V1_0::Status::ERROR;
if ((functions & V1_2::GadgetFunction::ADB) != 0) {
ffsEnabled = true;
if (addAdb(&monitorFfs, &i) != V1_0::Status::SUCCESS) return V1_0::Status::ERROR;
}
// Pull up the gadget right away when there are no ffs functions.
if (!ffsEnabled) {
if (!WriteStringToFile(kGadgetName, PULLUP_PATH)) return V1_0::Status::ERROR;
mCurrentUsbFunctionsApplied = true;
if (callback) callback->setCurrentUsbFunctionsCb(functions, V1_0::Status::SUCCESS);
return V1_0::Status::SUCCESS;
}
monitorFfs.registerFunctionsAppliedCallback(&currentFunctionsAppliedCallback, this);
// Monitors the ffs paths to pull up the gadget when descriptors are written.
// Also takes of the pulling up the gadget again if the userspace process
// dies and restarts.
monitorFfs.startMonitor();
if (kDebug) ALOGI("Mainthread in Cv");
if (callback) {
bool pullup = monitorFfs.waitForPullUp(timeout);
Return<void> ret = callback->setCurrentUsbFunctionsCb(
functions, pullup ? V1_0::Status::SUCCESS : V1_0::Status::ERROR);
if (!ret.isOk()) ALOGE("setCurrentUsbFunctionsCb error %s", ret.description().c_str());
}
return V1_0::Status::SUCCESS;
}
Return<void> UsbGadget::setCurrentUsbFunctions(uint64_t functions,
const sp<V1_0::IUsbGadgetCallback>& callback,
uint64_t timeout) {
std::unique_lock<std::mutex> lk(mLockSetCurrentFunction);
mCurrentUsbFunctions = functions;
mCurrentUsbFunctionsApplied = false;
// Unlink the gadget and stop the monitor if running.
V1_0::Status status = tearDownGadget();
if (status != V1_0::Status::SUCCESS) {
goto error;
}
ALOGI("Returned from tearDown gadget");
// Leave the gadget pulled down to give time for the host to sense disconnect.
usleep(kDisconnectWaitUs);
if (functions == static_cast<uint64_t>(V1_2::GadgetFunction::NONE)) {
if (callback == NULL) return Void();
Return<void> ret = callback->setCurrentUsbFunctionsCb(functions, V1_0::Status::SUCCESS);
if (!ret.isOk())
ALOGE("Error while calling setCurrentUsbFunctionsCb %s", ret.description().c_str());
return Void();
}
status = validateAndSetVidPid(functions);
if (status != V1_0::Status::SUCCESS) {
goto error;
}
status = setupFunctions(functions, callback, timeout);
if (status != V1_0::Status::SUCCESS) {
goto error;
}
ALOGI("Usb Gadget setcurrent functions called successfully");
return Void();
error:
ALOGI("Usb Gadget setcurrent functions failed");
if (callback == NULL) return Void();
Return<void> ret = callback->setCurrentUsbFunctionsCb(functions, status);
if (!ret.isOk())
ALOGE("Error while calling setCurrentUsbFunctionsCb %s", ret.description().c_str());
return Void();
}
} // namespace implementation
} // namespace V1_2
} // namespace gadget
} // namespace usb
} // namespace hardware
} // namespace android

View File

@@ -1,109 +0,0 @@
/*
* Copyright (C) 2020 The Android Open Source Project
* Copyright (C) 2023 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_USB_GADGET_V1_2_USBGADGET_H
#define ANDROID_HARDWARE_USB_GADGET_V1_2_USBGADGET_H
#include <UsbGadgetCommon.h>
#include <android-base/file.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <android/hardware/usb/gadget/1.2/IUsbGadget.h>
#include <android/hardware/usb/gadget/1.2/types.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
#include <utils/Log.h>
#include <chrono>
#include <condition_variable>
#include <mutex>
#include <string>
#include <thread>
namespace android {
namespace hardware {
namespace usb {
namespace gadget {
namespace V1_2 {
namespace implementation {
using ::android::sp;
using ::android::base::GetProperty;
using ::android::base::ReadFileToString;
using ::android::base::SetProperty;
using ::android::base::Trim;
using ::android::base::unique_fd;
using ::android::base::WriteStringToFile;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::usb::gadget::addAdb;
using ::android::hardware::usb::gadget::addEpollFd;
using ::android::hardware::usb::gadget::getVendorFunctions;
using ::android::hardware::usb::gadget::kDebug;
using ::android::hardware::usb::gadget::kDisconnectWaitUs;
using ::android::hardware::usb::gadget::linkFunction;
using ::android::hardware::usb::gadget::MonitorFfs;
using ::android::hardware::usb::gadget::resetGadget;
using ::android::hardware::usb::gadget::setVidPid;
using ::android::hardware::usb::gadget::unlinkFunctions;
using ::std::string;
constexpr char kGadgetName[] = "fe980000.usb";
static MonitorFfs monitorFfs(kGadgetName);
#define UDC_PATH "/sys/class/udc/fe980000.usb/"
#define SPEED_PATH UDC_PATH "current_speed"
struct UsbGadget : public IUsbGadget {
UsbGadget();
// Makes sure that only one request is processed at a time.
std::mutex mLockSetCurrentFunction;
uint64_t mCurrentUsbFunctions;
bool mCurrentUsbFunctionsApplied;
UsbSpeed mUsbSpeed;
Return<void> setCurrentUsbFunctions(uint64_t functions,
const sp<V1_0::IUsbGadgetCallback>& callback,
uint64_t timeout) override;
Return<void> getCurrentUsbFunctions(const sp<V1_0::IUsbGadgetCallback>& callback) override;
Return<Status> reset() override;
Return<void> getUsbSpeed(const sp<V1_2::IUsbGadgetCallback>& callback) override;
private:
V1_0::Status tearDownGadget();
V1_0::Status setupFunctions(uint64_t functions, const sp<V1_0::IUsbGadgetCallback>& callback,
uint64_t timeout);
};
} // namespace implementation
} // namespace V1_2
} // namespace gadget
} // namespace usb
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_USB_V1_2_USBGADGET_H

View File

@@ -1,7 +0,0 @@
service vendor.usb-gadget-hal-1-2 /vendor/bin/hw/android.hardware.usb.gadget@1.2-service.rpi
interface android.hardware.usb.gadget@1.0::IUsbGadget default
interface android.hardware.usb.gadget@1.1::IUsbGadget default
interface android.hardware.usb.gadget@1.2::IUsbGadget default
class hal
user system
group system shell mtp

View File

@@ -1,53 +0,0 @@
/*
* Copyright (C) 2020 The Android Open Source Project
* Copyright (C) 2023 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "android.hardware.usb.gadget@1.2-service.rpi"
#include <hidl/HidlTransportSupport.h>
#include "UsbGadget.h"
using android::sp;
// libhwbinder:
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
// Generated HIDL files
using android::hardware::usb::gadget::V1_2::IUsbGadget;
using android::hardware::usb::gadget::V1_2::implementation::UsbGadget;
using android::OK;
using android::status_t;
int main() {
configureRpcThreadpool(1, true /*callerWillJoin*/);
android::sp<IUsbGadget> service = new UsbGadget();
status_t status = service->registerAsService();
if (status != OK) {
ALOGE("Cannot register USB Gadget HAL service");
return 1;
}
ALOGI("USB Gadget HAL Ready.");
joinRpcThreadpool();
// Under noraml cases, execution will not reach this line.
ALOGI("USB Gadget HAL failed to join thread pool.");
return 1;
}

View File

@@ -8,29 +8,7 @@ ro.config.media_vol_steps=25
ro.hardware.audio.primary=rpi
# Bluetooth
bluetooth.device.class_of_device?=90,2,12
bluetooth.profile.a2dp.source.enabled?=true
bluetooth.profile.asha.central.enabled?=true
bluetooth.profile.avrcp.target.enabled?=true
bluetooth.profile.bap.broadcast.assist.enabled?=true
bluetooth.profile.bap.unicast.client.enabled?=true
bluetooth.profile.bas.client.enabled?=true
bluetooth.profile.ccp.server.enabled?=true
bluetooth.profile.csip.set_coordinator.enabled?=true
bluetooth.profile.gatt.enabled?=true
bluetooth.profile.hap.client.enabled?=true
bluetooth.profile.hfp.ag.enabled?=true
bluetooth.profile.hid.device.enabled?=true
bluetooth.profile.hid.host.enabled?=true
bluetooth.profile.map.server.enabled?=true
bluetooth.profile.mcp.server.enabled?=true
bluetooth.profile.opp.enabled?=true
bluetooth.profile.pan.nap.enabled?=true
bluetooth.profile.pan.panu.enabled?=true
bluetooth.profile.pbap.server.enabled?=true
bluetooth.profile.sap.server.enabled?=true
bluetooth.profile.vcp.controller.enabled?=true
persist.bluetooth.a2dp_aac.vbr_supported=true
ro.rfkilldisabled=1
# Camera
media.settings.xml=/vendor/etc/media_profiles_V1_0.xml
@@ -50,11 +28,9 @@ persist.ffmpeg_codec2.v4l2.h264=false
persist.ffmpeg_codec2.v4l2.h265=true
# Graphics
ro.hardware.egl=mesa
ro.hardware.hwcomposer=drm
ro.hardware.vulkan=broadcom
ro.opengles.version=196609
vendor.hwc.drm.ctm=DRM_OR_IGNORE
# LMKD
ro.lmk.critical=0
@@ -68,15 +44,6 @@ ro.lmk.medium=800
ro.lmk.upgrade_pressure=100
ro.lmk.use_minfree_levels=true
# Lockscreen
ro.lockscreen.disable.default=true
# Media
debug.stagefright.c2inputsurface=-1
# MGLRU
persist.device_config.mglru_native.lru_gen_config=core
# V4L2
debug.stagefright.c2-poolmask=0xf50000
persist.v4l2_codec2.rank.decoder=128

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- This is the standard feature indicating that the device has a Vulkan
driver that supports API version 1.2 (0x00402000) -->
<permissions>
<feature name="android.hardware.vulkan.version" version="4202496" />
</permissions>