赞
踩
/frameworks/base/services/core/java/com/android/server/lights/LightsService.java
1 | public class LightsService extends SystemService { |
一、通过jni的方式:
1. 8.0之前jni->hal
\frameworks\base\services\core\Android.mk
LOCAL_MODULE := services.core
\frameworks\base\services\core\jni\Android.mk
LOCAL_SRC_FILES += \
$(LOCAL_REL_DIR)/com_android_server_lights_LightsService.cpp \
... ...
/frameworks/base/services/core/jni/com_android_server_lights_LightsService.cpp
1 | /* |
2. 8.0之后jni->HIDL->HAL
JNI:
\frameworks\base\services\core\jni\Android.mk
cc_library_static {
name: "libservices.core",
... ...
srcs: [
":lib_alarmManagerService_native",
"com_android_server_lights_LightsService.cpp",
... ...
":lib_networkStatsFactory_native",
}
/frameworks/base/services/core/jni/com_android_server_lights_LightsService.cpp
1 | #define LOG_TAG "LightsService" |
HIDL interface:
/hardware/interfaces/light/2.0/Android.bp
1 | // This file is autogenerated by hidl-gen -Landroidbp. |
/hardware/interfaces/light/2.0/types.hal
1 | package android.hardware.light@2.0; |
/hardware/interfaces/light/2.0/ILight.hal
1 | package android.hardware.light@2.0; |
HIDL:
/vendor/mediatek/proprietary/hardware/liblights/2.0/default/android.hardware.light@2.0-service-mediatek.rc
service light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service-mediatek
interface android.hardware.light@2.0::ILight default
class hal
user system
group system
# shutting off lights while powering-off
shutdown critical
/vendor/mediatek/proprietary/hardware/liblights/2.0/default/service.cpp
1 | #define NDEBUG 1 |
/vendor/mediatek/proprietary/hardware/liblights/2.0/default/Android.mk
LOCAL_PATH := $(call my-dir) //用于返回当前mk文件路径,由build system提供
include $(CLEAR_VARS)
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE := android.hardware.light@2.0-service-mediatek
LOCAL_INIT_RC := android.hardware.light@2.0-service-mediatek.rc
LOCAL_SRC_FILES := service.cpp //生成在\out\target\product\tb8321p3_bsp\vendor\bin\hw\android.hardware.light@2.0-service-mediatek
... ...
include $(BUILD_EXECUTABLE) //对应Android.bp的 cc_binary{
include $(CLEAR_VARS) //让GNU MAKEFILE为你清除除LOCAL_PATH以外的所有LOCAL_XXX变量,因为所有的编译控制文件都在同一个GNU MAKE执行环境中,所有的变量都是全局的。
LOCAL_MODULE := android.hardware.light@2.0-impl-mediatek
LOCAL_MODULE_RELATIVE_PATH := hw //生成在\out\target\product\tb8321p3_bsp\vendor\lib\hw\android.hardware.light@2.0-impl-mediatek.so
LOCAL_SRC_FILES := \
Light.cpp \
... ...
include $(BUILD_SHARED_LIBRARY) //对应Android.bp的 cc_library_shared{
/vendor/mediatek/proprietary/hardware/liblights/2.0/default/Light.h
1 | #ifndef ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H |
/vendor/mediatek/proprietary/hardware/liblights/2.0/default/Light.cpp
1 | /* |
HAL:
/vendor/mediatek/proprietary/hardware/liblights/Android.mk
LOCAL_PATH:= $(call my-dir)
# HAL module implemenation, not prelinked and stored in
# hw/<COPYPIX_HARDWARE_MODULE_ID>.<ro.board.platform>.so
include $(CLEAR_VARS)
LOCAL_HEADER_LIBRARIES := libhardware_headers
LOCAL_MULTILIB := both
LOCAL_MODULE_TAGS := optional
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_MODULE := lights.$(TARGET_BOARD_PLATFORM)
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_OWNER := mtk
include $(MTK_SHARED_LIBRARY)
include $(call all-makefiles-under, $(LOCAL_PATH))
./tb8321p3_bsp/vendor/lib/hw/lights.mt6580.so
./tb8321p3_bsp/symbols/vendor/lib/hw/lights.mt6580.so
/hardware/libhardware/include/hardware/lights.h
1 | /* |
/vendor/mediatek/proprietary/hardware/liblights/lights.c
1 | #define LOG_TAG "lights"
|
/vendor/mediatek/proprietary/hardware/liblights/lights.c
1 | static int write_int(char const* path, int value) |
二、通过aidl的方式:
/hardware/interfaces/light/aidl/android/hardware/light/ILights.aidl
1 | package android.hardware.light; |
/vendor/mediatek/proprietary/hardware/liblights/aidl/default/Android.bp
1 | cc_binary { |
androidgroup04@androidgroup04:~/disk00/Isaac/MT8168_alps-mp-r0.mp5/alps/out/target/product/tb8168p1_64_bsp$ find -name "*android.hardware.lights-service.mediatek*"
./vendor/bin/hw/android.hardware.lights-service.mediatek
./obj/EXECUTABLES/android.hardware.lights-service.mediatek_intermediates
./obj/EXECUTABLES/android.hardware.lights-service.mediatek_intermediates/android.hardware.lights-service.mediatek
./obj/PACKAGING/vendor_target_files_intermediates/vnd_tb8168p1_64_bsp-vendor_target_files-mp5V4381/VENDOR/bin/hw/android.hardware.lights-service.mediatek
./symbols/vendor/bin/hw/android.hardware.lights-service.mediatek
/vendor/mediatek/proprietary/hardware/liblights/aidl/default/Lights.cpp
1 | #include "Lights.h" |
/vendor/mediatek/proprietary/hardware/liblights/aidl/default/Lights.h
1 | /* LCD BACKLIGHT */ |
/vendor/mediatek/proprietary/hardware/liblights/aidl/default/Lights.cpp
1 | static int |
/vendor/mediatek/proprietary/hardware/liblights/aidl/default/Lights.cpp
1 | static int write_int(char const* path, int value) |
==================================================================
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。