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

Commit 5472d802 authored by Nathan Harold's avatar Nathan Harold
Browse files

Log Invalid Level as an Error in SignalStrength

If one of the CellSignalStrength classes returns a
level value that's out of range, it should be logged
as an error. This CL adds loge() to SignalStrength
and logs this event at the correct level.

Bug: 8675309
Test: compilation
Change-Id: Ic4bd706ae83e647cd782a60d94db7077c6d0fc1b
parent ffdd9054
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -369,7 +369,7 @@ public class SignalStrength implements Parcelable {
    public int getLevel() {
        int level = getPrimary().getLevel();
        if (level < SIGNAL_STRENGTH_NONE_OR_UNKNOWN || level > SIGNAL_STRENGTH_GREAT) {
            log("Invalid Level " + level + ", this=" + this);
            loge("Invalid Level " + level + ", this=" + this);
            return SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
        }
        return getPrimary().getLevel();
@@ -657,9 +657,16 @@ public class SignalStrength implements Parcelable {
    }

    /**
     * log
     * log warning
     */
    private static void log(String s) {
        Rlog.w(LOG_TAG, s);
    }

    /**
     * log error
     */
    private static void loge(String s) {
        Rlog.e(LOG_TAG, s);
    }
}