summaryrefslogtreecommitdiffstats
path: root/light
diff options
context:
space:
mode:
authorSteven Moreland2018-03-16 12:27:18 -0500
committerSteven Moreland2018-03-16 12:31:07 -0500
commit04f859a9b96bcd3b0deee6b84f20fcb841156e08 (patch)
treed0264556fa9bf60934fb7ccc7a22e54ee8c47087 /light
parent31857339ef1178ea1c83c3288c636ae313a12105 (diff)
downloadplatform-hardware-interfaces-04f859a9b96bcd3b0deee6b84f20fcb841156e08.tar.gz
platform-hardware-interfaces-04f859a9b96bcd3b0deee6b84f20fcb841156e08.tar.xz
platform-hardware-interfaces-04f859a9b96bcd3b0deee6b84f20fcb841156e08.zip
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
Diffstat (limited to 'light')
-rw-r--r--light/utils/main.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/light/utils/main.cpp b/light/utils/main.cpp
index 1f9cb9ce..d07e799a 100644
--- a/light/utils/main.cpp
+++ b/light/utils/main.cpp
@@ -26,6 +26,7 @@ void error(const std::string& msg) {
26} 26}
27 27
28int main() { 28int main() {
29 using ::android::hardware::hidl_vec;
29 using ::android::hardware::light::V2_0::Brightness; 30 using ::android::hardware::light::V2_0::Brightness;
30 using ::android::hardware::light::V2_0::Flash; 31 using ::android::hardware::light::V2_0::Flash;
31 using ::android::hardware::light::V2_0::ILight; 32 using ::android::hardware::light::V2_0::ILight;
@@ -44,9 +45,15 @@ int main() {
44 .color = 0u, .flashMode = Flash::NONE, .brightnessMode = Brightness::USER, 45 .color = 0u, .flashMode = Flash::NONE, .brightnessMode = Brightness::USER,
45 }; 46 };
46 47
47 Status ret = service->setLight(Type::BACKLIGHT, off).withDefault(Status::UNKNOWN); 48 service->getSupportedTypes([&](const hidl_vec<Type>& types) {
48 if (ret != Status::SUCCESS) { 49 for (Type type : types) {
49 error("Failed to shut off screen"); 50 Status ret = service->setLight(type, off);
50 } 51 if (ret != Status::SUCCESS) {
52 error("Failed to shut off screen for type " +
53 std::to_string(static_cast<int>(type)));
54 }
55 }
56 });
57
51 return 0; 58 return 0;
52} 59}