android.app.cts.SystemFeaturesTest#testSensorFeatures fail
junit.framework.AssertionFailedError: PackageManager#hasSystemFeature(android.hardware.sensor.compass) returns true but SensorManager#getSensorList(2) shows sensors [] expected:<true> but was:<false>
无compass
device\qcom\msm8909go\msm8909go.mk
# Feature definition files for msm8909go
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:system/etc/permissions/android.hardware.sensor.accelerometer.xml \
删除 frameworks/native/data/etc/android.hardware.sensor.compass.xml:system/etc/permissions/android.hardware.sensor.compass.xml \
frameworks\native\data\etc\tablet_core_hardware.xml
或
frameworks\native\data\etc\handheld_core_hardware.xml
注释掉相关的项目
<!-- <feature name="android.hardware.sensor.compass" /> -->
./device/qcom/common/base.mk
注释掉相关的项目
frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \
frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \
android.app.cts.SystemFeaturesTest#testSensorFeatures FAIL
junit.framework.AssertionFailedError: PackageManager#hasSystemFeature(android.hardware.sensor.light) returns true but SensorManager#getSensorList(5) shows sensors [] expected:<true> but was:<false>
原因:手机无光感
解决方法:去除..\mediatek\config\{PROJECT}\android.hardware.sensor.light.xml及
android.hardware.sensor.proximity.xml文件中相应选项
gsenor proximity 类似。

本文详细解析了Android设备上传感器测试失败的问题,特别是在系统特性测试中出现的错误。通过修改配置文件,如移除或注释掉特定传感器的特征声明,可以解决因设备不支持某些传感器(如指南针、光线传感器)导致的测试失败。
5849

被折叠的 条评论
为什么被折叠?



