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

Commit 56cf26ef authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge "Early return when state has not changed"

parents 3d358dba a206f653
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ import com.android.settingslib.graph.SignalDrawable;
import com.android.systemui.DualToneHandler;
import com.android.systemui.R;

import java.util.Objects;

public class QSCarrier extends LinearLayout {

    private View mMobileGroup;
@@ -39,6 +41,7 @@ public class QSCarrier extends LinearLayout {
    private DualToneHandler mDualToneHandler;
    private ColorStateList mColorForegroundStateList;
    private float mColorForegroundIntensity;
    private QSCarrierGroupController.CellSignalState mLastSignalState;

    public QSCarrier(Context context) {
        super(context);
@@ -74,6 +77,8 @@ public class QSCarrier extends LinearLayout {
    }

    public void updateState(QSCarrierGroupController.CellSignalState state) {
        if (Objects.equals(state, mLastSignalState)) return;
        mLastSignalState = state;
        mMobileGroup.setVisibility(state.visible ? View.VISIBLE : View.GONE);
        if (state.visible) {
            mMobileRoaming.setVisibility(state.roaming ? View.VISIBLE : View.GONE);
+23 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import com.android.keyguard.CarrierTextController;
@@ -37,6 +38,7 @@ import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.policy.NetworkController;

import java.util.Objects;
import java.util.function.Consumer;

import javax.inject.Inject;
@@ -297,6 +299,27 @@ public class QSCarrierGroupController {
        String contentDescription;
        String typeContentDescription;
        boolean roaming;

        @Override
        public boolean equals(@Nullable Object obj) {
            if (this == obj) return true;
            if (!(obj instanceof CellSignalState)) return false;
            CellSignalState other = (CellSignalState) obj;
            return this.visible == other.visible
                    && this.mobileSignalIconId == other.mobileSignalIconId
                    && Objects.equals(this.contentDescription, other.contentDescription)
                    && Objects.equals(this.typeContentDescription, other.typeContentDescription)
                    && this.roaming == other.roaming;
        }

        @Override
        public int hashCode() {
            return Objects.hash(visible,
                    mobileSignalIconId,
                    contentDescription,
                    typeContentDescription,
                    roaming);
        }
    }

    public static class Builder {