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

Commit 5ff37a01 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Optimize the flow for checking [Duration Available]" into main

parents ca310cd5 09e7bdc6
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -717,7 +717,10 @@ public class HdmiCecMessageValidator {
            // Programmed
            int programedInfo = params[offset] & 0x0F;
            if (isValidProgrammedInfo(programedInfo)) {
                if (programedInfo == 0x09 || programedInfo == 0x0B) {
                offset = offset + 1;
                // Duration Available (2 bytes)
                if ((programedInfo == 0x09 || programedInfo == 0x0B)
                        && params.length - offset >= 2) {
                    durationAvailable = true;
                } else {
                    return true;
@@ -727,16 +730,17 @@ public class HdmiCecMessageValidator {
            // Non programmed
            int nonProgramedErrorInfo = params[offset] & 0x0F;
            if (isValidNotProgrammedErrorInfo(nonProgramedErrorInfo)) {
                if (nonProgramedErrorInfo == 0x0E) {
                offset = offset + 1;
                // Duration Available (2 bytes)
                if (nonProgramedErrorInfo == 0x0E && params.length - offset >= 2) {
                    durationAvailable = true;
                } else {
                    return true;
                }
            }
        }
        offset = offset + 1;
        // Duration Available (2 bytes)
        if (durationAvailable && params.length - offset >= 2) {
        if (durationAvailable) {
            return (isValidDurationHours(params[offset]) && isValidMinute(params[offset + 1]));
        }
        return false;