diff options
author | Steven Moreland <smoreland@google.com> | 2018-03-16 10:27:18 -0700 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2018-03-16 13:04:53 -0700 |
commit | b944d69508cc4a790512d21a1219d9a1cd54c93b (patch) | |
tree | bb49728aee5991b9a37ec8e428a5ed3ff81ed404 /light/utils/main.cpp | |
parent | b25202527e9886b63461b051e577e2e6ce763257 (diff) |
blank_screen: shut off all lights
This is used to make the phone appear off by init
during late boot (e.x. fsck for disk health), so
it should shut off all lights (not just the screen).
Bug: 74976325
Test: blank_screen
Change-Id: I790cc3dd856c2c2095fa3cf82519fd30834304ca
Merged-In: I790cc3dd856c2c2095fa3cf82519fd30834304ca
Diffstat (limited to 'light/utils/main.cpp')
-rw-r--r-- | light/utils/main.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/light/utils/main.cpp b/light/utils/main.cpp index 1f9cb9ce45..d07e799ab9 100644 --- a/light/utils/main.cpp +++ b/light/utils/main.cpp @@ -26,6 +26,7 @@ void error(const std::string& msg) { } 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 @@ int main() { .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; } |