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

Commit f5b3e36c authored by Rambo Wang's avatar Rambo Wang
Browse files

Fix stack overflow when log the invalid SignalStrength level

The change fixes the issue by not logging "this" in SignalStrength.getLevel().

SignalStrengthTestable calls SignalStrength.getLevel in its toString(). An invalid SignalStrength level in SignalStrength.getLevel will log "this" which calls SignalStrengthTestable.toString(), causing stack overflow due to cyclic calls.

Bug: 256874469
Test: Manual test for API used via adb shell
Flag: EXEMPT(test only)
Change-Id: Id70275119efc2e9507483f426c7ecc136e6c05f5
parent b1a389df
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -489,7 +489,7 @@ public class SignalStrength implements Parcelable {
    public int getLevel() {
        int level = getPrimary().getLevel();
        if (level < SIGNAL_STRENGTH_NONE_OR_UNKNOWN || level > SIGNAL_STRENGTH_GREAT) {
            loge("Invalid Level " + level + ", this=" + this);
            loge("Invalid Level " + level);
            return SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
        }
        return getPrimary().getLevel();