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

Commit bcc71c55 authored by Bookatz's avatar Bookatz
Browse files

Resupport long compare

In ag/3554499 we made it so that comparisons of longs was supported.
That support was apparantly deleted by accident during a refactoring of
code, so this adds it back.

Bug: 73509837
Test: it gets used in run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.alert.AnomalyDetectionTests#testCountAnomalyDetection
Change-Id: I3dbe7da61bbfb3e9982fd1e0cc7d4658b0168690
parent 100d494b
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -233,6 +233,11 @@ bool matchesSimple(const UidMap& uidMap, const FieldValueMatcher& matcher,
                    (matcher.eq_int() == values[i].mValue.int_value)) {
                    return true;
                }
                // eq_int covers both int and long.
                if (values[i].mValue.getType() == LONG &&
                    (matcher.eq_int() == values[i].mValue.long_value)) {
                    return true;
                }
            }
            return false;
        case FieldValueMatcher::ValueMatcherCase::kLtInt:
@@ -241,6 +246,11 @@ bool matchesSimple(const UidMap& uidMap, const FieldValueMatcher& matcher,
                    (values[i].mValue.int_value < matcher.lt_int())) {
                    return true;
                }
                // lt_int covers both int and long.
                if (values[i].mValue.getType() == LONG &&
                    (values[i].mValue.long_value < matcher.lt_int())) {
                    return true;
                }
            }
            return false;
        case FieldValueMatcher::ValueMatcherCase::kGtInt:
@@ -249,6 +259,11 @@ bool matchesSimple(const UidMap& uidMap, const FieldValueMatcher& matcher,
                    (values[i].mValue.int_value > matcher.gt_int())) {
                    return true;
                }
                // gt_int covers both int and long.
                if (values[i].mValue.getType() == LONG &&
                    (values[i].mValue.long_value > matcher.gt_int())) {
                    return true;
                }
            }
            return false;
        case FieldValueMatcher::ValueMatcherCase::kLtFloat:
@@ -273,6 +288,11 @@ bool matchesSimple(const UidMap& uidMap, const FieldValueMatcher& matcher,
                    (values[i].mValue.int_value <= matcher.lte_int())) {
                    return true;
                }
                // lte_int covers both int and long.
                if (values[i].mValue.getType() == LONG &&
                    (values[i].mValue.long_value <= matcher.lte_int())) {
                    return true;
                }
            }
            return false;
        case FieldValueMatcher::ValueMatcherCase::kGteInt:
@@ -281,6 +301,11 @@ bool matchesSimple(const UidMap& uidMap, const FieldValueMatcher& matcher,
                    (values[i].mValue.int_value >= matcher.gte_int())) {
                    return true;
                }
                // gte_int covers both int and long.
                if (values[i].mValue.getType() == LONG &&
                    (values[i].mValue.long_value >= matcher.gte_int())) {
                    return true;
                }
            }
            return false;
        default: