Merge "blank_screen: shut off all lights" into pi-dev
diff --git a/light/utils/main.cpp b/light/utils/main.cpp
index 1f9cb9c..d07e799 100644
--- a/light/utils/main.cpp
+++ b/light/utils/main.cpp
@@ -26,6 +26,7 @@
}
int main() {
+ using ::android::hardware::hidl_vec;
using ::android::hardware::light::V2_0::Brightness;
using ::android::hardware::light::V2_0::Flash;
using ::android::hardware::light::V2_0::ILight;
@@ -44,9 +45,15 @@
.color = 0u, .flashMode = Flash::NONE, .brightnessMode = Brightness::USER,
};
- Status ret = service->setLight(Type::BACKLIGHT, off).withDefault(Status::UNKNOWN);
- if (ret != Status::SUCCESS) {
- error("Failed to shut off screen");
- }
+ service->getSupportedTypes([&](const hidl_vec<Type>& types) {
+ for (Type type : types) {
+ Status ret = service->setLight(type, off);
+ if (ret != Status::SUCCESS) {
+ error("Failed to shut off screen for type " +
+ std::to_string(static_cast<int>(type)));
+ }
+ }
+ });
+
return 0;
}