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

Commit d5f6582f authored by Bernie Innocenti's avatar Bernie Innocenti
Browse files

Add explicit Result::ok() where missing

This is part of a large-scale cleanup to remove operator bool() from
android::base::expected. For more details, see aosp/1533001.

Bug: 176148206
Test: m checkbuild continuous_instrumentation_tests continuous_instrumentation_tests_api_coverage continuous_native_tests device-tests platform_tests
Exempt-From-Owner-Approval: mechanical large-scale change
Change-Id: Ie67a688b2827d66e585c87f881cce7851b0a60b5
parent 51ab47ec
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -695,7 +695,7 @@ std::shared_ptr<KeyCharacterMap> NativeInputManager::getKeyboardLayoutOverlay(
        base::Result<std::shared_ptr<KeyCharacterMap>> ret =
                KeyCharacterMap::loadContents(filenameChars.c_str(), contentsChars.c_str(),
                                              KeyCharacterMap::Format::OVERLAY);
        if (ret) {
        if (ret.ok()) {
            result = *ret;
        }
    }
@@ -1487,7 +1487,7 @@ static jobject nativeCreateInputChannel(JNIEnv* env, jclass /* clazz */, jlong p

    base::Result<std::unique_ptr<InputChannel>> inputChannel = im->createInputChannel(env, name);

    if (!inputChannel) {
    if (!inputChannel.ok()) {
        std::string message = inputChannel.error().message();
        message += StringPrintf(" Status=%d", inputChannel.error().code());
        jniThrowRuntimeException(env, message.c_str());
@@ -1521,7 +1521,7 @@ static jobject nativeCreateInputMonitor(JNIEnv* env, jclass /* clazz */, jlong p
    base::Result<std::unique_ptr<InputChannel>> inputChannel =
            im->createInputMonitor(env, displayId, isGestureMonitor, name, pid);

    if (!inputChannel) {
    if (!inputChannel.ok()) {
        std::string message = inputChannel.error().message();
        message += StringPrintf(" Status=%d", inputChannel.error().code());
        jniThrowRuntimeException(env, message.c_str());