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

Commit a212555a authored by Malcolm Chen's avatar Malcolm Chen
Browse files

Fix bug that getBaseBandVersion() may write the value incorrectly.

getBaseBandVersion tries to get value from a legacy API and rewrites it
back. However the read value is the full list but the write is to a
specific phone, causing the list to grow unexpectedly.

Bug: 149342541
Test: manual - using test app, call API and check result.
Change-Id: I78b0443c5e38a30010796fcb69f01a8c7ebaf160
parent dc4985f4
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -9818,22 +9818,6 @@ public class TelephonyManager {
        return getBasebandVersionForPhone(phoneId);
    }

    /**
     * Get baseband version for the default phone using the legacy approach.
     * This change was added in P, to ensure backward compatiblity.
     *
     * @return baseband version.
     * @hide
     */
    private String getBasebandVersionLegacy(int phoneId) {
        if (SubscriptionManager.isValidPhoneId(phoneId)) {
            String prop = "gsm.version.baseband"
                    + ((phoneId == 0) ? "" : Integer.toString(phoneId));
            return SystemProperties.get(prop);
        }
        return null;
    }

    /**
     * Get baseband version by phone id.
     *
@@ -9841,10 +9825,6 @@ public class TelephonyManager {
     * @hide
     */
    public String getBasebandVersionForPhone(int phoneId) {
        String version = getBasebandVersionLegacy(phoneId);
        if (version != null && !version.isEmpty()) {
            setBasebandVersionForPhone(phoneId, version);
        }
        return getTelephonyProperty(phoneId, TelephonyProperties.baseband_version(), "");
    }