Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ced82836 authored by Steven Moreland's avatar Steven Moreland Committed by android-build-merger
Browse files

blank_screen: shut off all lights

am: b944d695

Change-Id: I0d6a77630967410ef4a773f087fb40cecc2a57ed
parents 92058f95 b944d695
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -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);
    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");
                error("Failed to shut off screen for type " +
                      std::to_string(static_cast<int>(type)));
            }
        }
    });

    return 0;
}