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

Commit 189c0f81 authored by Bernie Innocenti's avatar Bernie Innocenti
Browse files

Add explicit Result::ok() checks where needed

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: Iec637c7019927485dd1d814d38471e617276764f
parent 147c86e7
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ protected:
                                                                  KEY_LAYOUT);
        ASSERT_FALSE(path.empty());
        base::Result<std::shared_ptr<KeyLayoutMap>> ret = KeyLayoutMap::load(path);
        ASSERT_TRUE(ret) << "Cannot load KeyLayout at " << path;
        ASSERT_TRUE(ret.ok()) << "Cannot load KeyLayout at " << path;
        mKeyMap.keyLayoutMap = std::move(*ret);
        mKeyMap.keyLayoutFile = path;
    }
@@ -58,7 +58,7 @@ protected:
        ASSERT_FALSE(path.empty()) << "KeyCharacterMap for " << name << " not found";
        base::Result<std::shared_ptr<KeyCharacterMap>> ret =
                KeyCharacterMap::load(path, KeyCharacterMap::Format::BASE);
        ASSERT_TRUE(ret) << "Cannot load KeyCharacterMap at " << path;
        ASSERT_TRUE(ret.ok()) << "Cannot load KeyCharacterMap at " << path;
        mKeyMap.keyCharacterMap = *ret;
        mKeyMap.keyCharacterMapFile = path;
    }
+1 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ binder::Status InputManager::createInputChannel(const std::string& name, InputCh
    }

    base::Result<std::unique_ptr<InputChannel>> channel = mDispatcher->createInputChannel(name);
    if (!channel) {
    if (!channel.ok()) {
        return binder::Status::fromExceptionCode(exceptionCodeFromStatusT(channel.error().code()),
                                                 channel.error().message().c_str());
    }