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

Commit da3ce175 authored by Neil Fuller's avatar Neil Fuller
Browse files

Remove unnecessary overriding capability

This change modifies the signature of several internal
methods of ServiceStateTracker to remove the possibility
of subclasses overriding them. Where possible the methods
have been made private (thus implicitly final) and where
not possible the methods have been left protected but
made final. Only shared logging and time/time zone related
methods have been changed to limit the scope.

The use of protected is apparently a legacy of earlier
Android releases where there were several subclasses of
ServiceStateTracker.

None of these methods are referenced in tests using mocking
frameworks which might require the methods remain virtual
and non-final.

The use of protected for the log methods appears to be to
increase visiblity to subclasses but not to allow
overriding / redirection of logging to alternative log
destinations. One subclass still existings in the codebase
that relies on log() and loge().

The goal of this change is to reduce the possibility of
unintended side effects from later time / time zone detection
refactoring.

Bug: 63743683
Test: make droid
Change-Id: I57c9dd8d45fc4cfac8996c1879b93d3886be82a5
parent 8b8f2d0e
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -2530,11 +2530,11 @@ public class ServiceStateTracker extends Handler {
        mRatLog.log(mSS.toString());
    }

    protected void log(String s) {
    protected final void log(String s) {
        Rlog.d(LOG_TAG, s);
    }

    protected void loge(String s) {
    protected final void loge(String s) {
        Rlog.e(LOG_TAG, s);
    }

@@ -3132,12 +3132,12 @@ public class ServiceStateTracker extends Handler {
        }
    }

    protected boolean isInvalidOperatorNumeric(String operatorNumeric) {
    private boolean isInvalidOperatorNumeric(String operatorNumeric) {
        return operatorNumeric == null || operatorNumeric.length() < 5 ||
                operatorNumeric.startsWith(INVALID_MCC);
    }

    protected String fixUnknownMcc(String operatorNumeric, int sid) {
    private String fixUnknownMcc(String operatorNumeric, int sid) {
        if (sid <= 0) {
            // no cdma information is available, do nothing
            return operatorNumeric;
@@ -3168,7 +3168,7 @@ public class ServiceStateTracker extends Handler {
        return operatorNumeric;
    }

    protected void fixTimeZone(String isoCountryCode) {
    private void fixTimeZone(String isoCountryCode) {
        TimeZone zone = null;
        // If the offset is (0, false) and the time zone property
        // is set, use the time zone property rather than GMT.
@@ -4483,7 +4483,7 @@ public class ServiceStateTracker extends Handler {
     * @param needToFixTimeZone
     * @return true if time zone needs to be fixed
     */
    protected boolean shouldFixTimeZoneNow(Phone phone, String operatorNumeric,
    private boolean shouldFixTimeZoneNow(Phone phone, String operatorNumeric,
            String prevOperatorNumeric, boolean needToFixTimeZone) {
        // Return false if the mcc isn't valid as we don't know where we are.
        // Return true if we have an IccCard and the mcc changed or we