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

Commit 73f70b46 authored by Kweku Adams's avatar Kweku Adams
Browse files

Treating all FileSection files as device specific.

Arc++ devices don't have the /d/wakeup_sources file. There's a chance
other devices won't have it either, and there may be other files that we
thought were standard but are actually not, so it's safer to just assume
that not every file will be available on every device and not treat a
missing file as an error.

Bug: 110109543
Test: atest incidentd_test
Change-Id: Ie0ce0b1b18f97e6421137c2ad350c644399e6d41
Merged-In: Ief09427f08d18aee611d057ddafdb9a3466744db
(cherry picked from commit c112f8d7c607501f0fa8894ab42ad228684a96c7)
parent 9343b88b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -255,7 +255,9 @@ status_t FileSection::Execute(ReportRequestSet* requests) const {
    unique_fd fd(open(mFilename, O_RDONLY | O_CLOEXEC));
    if (fd.get() == -1) {
        ALOGW("FileSection '%s' failed to open file", this->name.string());
        return this->deviceSpecific ? NO_ERROR : -errno;
        // There may be some devices/architectures that won't have the file.
        // Just return here without an error.
        return NO_ERROR;
    }

    FdBuffer buffer;
+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ TEST_F(SectionTest, FileSection) {

TEST_F(SectionTest, FileSectionNotExist) {
    FileSection fs1(NOOP_PARSER, "notexist", false, QUICK_TIMEOUT_MS);
    ASSERT_EQ(NAME_NOT_FOUND, fs1.Execute(&requests));
    ASSERT_EQ(NO_ERROR, fs1.Execute(&requests));

    FileSection fs2(NOOP_PARSER, "notexist", true, QUICK_TIMEOUT_MS);
    ASSERT_EQ(NO_ERROR, fs2.Execute(&requests));