From da183ac9c35160efda1be8850437e7026bfd29c6 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Wed, 2 Nov 2016 14:29:46 -0700 Subject: [PATCH] LightService: log errors. Test: lights work Bug: 32022100 Change-Id: I7ac7de63e378ca37665859e4d45b09bf99313d10 --- ...om_android_server_lights_LightsService.cpp | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/services/core/jni/com_android_server_lights_LightsService.cpp b/services/core/jni/com_android_server_lights_LightsService.cpp index e6072bb03ccc1..a3ab8f67d2fa3 100644 --- a/services/core/jni/com_android_server_lights_LightsService.cpp +++ b/services/core/jni/com_android_server_lights_LightsService.cpp @@ -34,6 +34,9 @@ using Brightness = ::android::hardware::light::V2_0::Brightness; using Flash = ::android::hardware::light::V2_0::Flash; using Type = ::android::hardware::light::V2_0::Type; using LightState = ::android::hardware::light::V2_0::LightState; +using Status = ::android::hardware::light::V2_0::Status; +template +using Return = ::android::hardware::Return; static sp gLight; @@ -108,9 +111,33 @@ static void setLight_native( state.brightnessMode = brightness; + Status status; + { ALOGD_IF_SLOW(50, "Excessive delay setting light"); - gLight->setLight(type, state); + Return ret = gLight->setLight(type, state); + + // TODO(b/31348667): this is transport specific status + if (!ret.getStatus().isOk()) { + ALOGE("Failed to issue set light command."); + return; + } + + status = static_cast(ret); // hal status + } + + switch (status) { + case Status::SUCCESS: + break; + case Status::LIGHT_NOT_SUPPORTED: + ALOGE("Light requested not availale on this device."); + break; + case Status::BRIGHTNESS_NOT_SUPPORTED: + ALOGE("Brightness parameter not supported on this device."); + break; + case Status::UNKNOWN: + default: + ALOGE("Unknown error setting light."); } }