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

Commit 9273f914 authored by Evan Laird's avatar Evan Laird
Browse files

Revert^2 "Remove support for COMBINED_SIGNAL_ICONS"

This change removes all of the branches associated with the combined
signal iconography implemented for the provider model behavior for the
following reasons:

1. This flag has been false for a while now, ever since the split out into
   two parts (provider model behavior + provider model setting).
2. The original implementation of this behavior sits at the wrong level
   of abstraction for maintainability and understandability, due to the
   constraints on building that feature out.
3. In order to put the domain logic for this iconography into a better
   place, it makes sense to remove these unused branches now, and
   re-implement in the future if we need to bring it back

Test: atest SystemUITests
Bug: 238425913

6a9d2b06

Change-Id: Ib959707632d55373cda1c8d6c5c0d215e27891f9
parent 14b52cb7
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ public class MobileStatusTracker {
    private final Handler mReceiverHandler;
    private final MobileTelephonyCallback mTelephonyCallback;

    private boolean mListening = false;

    /**
     * MobileStatusTracker constructors
     *
@@ -76,6 +78,7 @@ public class MobileStatusTracker {
     * Config the MobileStatusTracker to start or stop monitoring platform signals.
     */
    public void setListening(boolean listening) {
        mListening = listening;
        if (listening) {
            mPhone.registerTelephonyCallback(mReceiverHandler::post, mTelephonyCallback);
        } else {
@@ -83,6 +86,10 @@ public class MobileStatusTracker {
        }
    }

    public boolean isListening() {
        return mListening;
    }

    private void updateDataSim() {
        int activeDataSubId = mDefaults.getActiveDataSubId();
        if (SubscriptionManager.isValidSubscriptionId(activeDataSubId)) {
+3 −12
Original line number Diff line number Diff line
@@ -134,18 +134,9 @@ class QuickStatusBarHeaderController extends ViewController<QuickStatusBarHeader
        mQSCarrierGroupController
                .setOnSingleCarrierChangedListener(mView::setIsSingleCarrier);

        List<String> rssiIgnoredSlots;

        if (mFeatureFlags.isEnabled(Flags.COMBINED_STATUS_BAR_SIGNAL_ICONS)) {
            rssiIgnoredSlots = List.of(
                    getResources().getString(com.android.internal.R.string.status_bar_no_calling),
                    getResources().getString(com.android.internal.R.string.status_bar_call_strength)
            );
        } else {
            rssiIgnoredSlots = List.of(
        List<String> rssiIgnoredSlots = List.of(
                getResources().getString(com.android.internal.R.string.status_bar_mobile)
        );
        }

        mView.onAttach(mIconManager, mQSExpansionPathInterpolator, rssiIgnoredSlots,
                mInsetsProvider, mFeatureFlags.isEnabled(Flags.COMBINED_QS_HEADERS));
+1 −2
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ data class CellSignalState(
    @JvmField val contentDescription: String? = null,
    @JvmField val typeContentDescription: String? = null,
    @JvmField val roaming: Boolean = false,
    @JvmField val providerModelBehavior: Boolean = false
) {
    /**
     * Changes the visibility of this state by returning a copy with the visibility changed.
+19 −29
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ public class QSCarrier extends LinearLayout {
    private View mSpacer;
    @Nullable
    private CellSignalState mLastSignalState;
    private boolean mProviderModelInitialized = false;
    private boolean mMobileSignalInitialized = false;
    private boolean mIsSingleCarrier;

    public QSCarrier(Context context) {
@@ -96,17 +96,8 @@ public class QSCarrier extends LinearLayout {
            mMobileRoaming.setImageTintList(colorStateList);
            mMobileSignal.setImageTintList(colorStateList);

            if (state.providerModelBehavior) {
                if (!mProviderModelInitialized) {
                    mProviderModelInitialized = true;
                    mMobileSignal.setImageDrawable(
                            mContext.getDrawable(R.drawable.ic_qs_no_calling_sms));
                }
                mMobileSignal.setImageDrawable(mContext.getDrawable(state.mobileSignalIconId));
                mMobileSignal.setContentDescription(state.contentDescription);
            } else {
                if (!mProviderModelInitialized) {
                    mProviderModelInitialized = true;
            if (!mMobileSignalInitialized) {
                mMobileSignalInitialized = true;
                mMobileSignal.setImageDrawable(new SignalDrawable(mContext));
            }
            mMobileSignal.setImageLevel(state.mobileSignalIconId);
@@ -125,7 +116,6 @@ public class QSCarrier extends LinearLayout {
            }
            mMobileSignal.setContentDescription(contentDescription);
        }
        }
        return true;
    }

+6 −103
Original line number Diff line number Diff line
@@ -42,10 +42,7 @@ import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.connectivity.IconState;
import com.android.systemui.statusbar.connectivity.MobileDataIndicators;
import com.android.systemui.statusbar.connectivity.NetworkController;
import com.android.systemui.statusbar.connectivity.SignalCallback;
@@ -78,7 +75,6 @@ public class QSCarrierGroupController {
    private QSCarrier[] mCarrierGroups = new QSCarrier[SIM_SLOTS];
    private int[] mLastSignalLevel = new int[SIM_SLOTS];
    private String[] mLastSignalLevelDescription = new String[SIM_SLOTS];
    private final boolean mProviderModel;
    private final CarrierConfigTracker mCarrierConfigTracker;

    private boolean mIsSingleCarrier;
@@ -90,9 +86,6 @@ public class QSCarrierGroupController {
    private final SignalCallback mSignalCallback = new SignalCallback() {
                @Override
                public void setMobileDataIndicators(@NonNull MobileDataIndicators indicators) {
                    if (mProviderModel) {
                        return;
                    }
                    int slotIndex = getSlotIndex(indicators.subId);
                    if (slotIndex >= SIM_SLOTS) {
                        Log.w(TAG, "setMobileDataIndicators - slot: " + slotIndex);
@@ -107,90 +100,11 @@ public class QSCarrierGroupController {
                            indicators.statusIcon.icon,
                            indicators.statusIcon.contentDescription,
                            indicators.typeContentDescription.toString(),
                            indicators.roaming,
                            mProviderModel
                            indicators.roaming
                    );
                    mMainHandler.obtainMessage(H.MSG_UPDATE_STATE).sendToTarget();
                }

                @Override
                public void setCallIndicator(@NonNull IconState statusIcon, int subId) {
                    if (!mProviderModel) {
                        return;
                    }
                    int slotIndex = getSlotIndex(subId);
                    if (slotIndex >= SIM_SLOTS) {
                        Log.w(TAG, "setMobileDataIndicators - slot: " + slotIndex);
                        return;
                    }
                    if (slotIndex == SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
                        Log.e(TAG, "Invalid SIM slot index for subscription: " + subId);
                        return;
                    }

                    boolean displayCallStrengthIcon =
                            mCarrierConfigTracker.getCallStrengthConfig(subId);

                    if (statusIcon.icon == R.drawable.ic_qs_no_calling_sms) {
                        if (statusIcon.visible) {
                            mInfos[slotIndex] = new CellSignalState(
                                    true,
                                    statusIcon.icon,
                                    statusIcon.contentDescription,
                                    "",
                                    false,
                                    mProviderModel);
                        } else {
                            // Whenever the no Calling & SMS state is cleared, switched to the last
                            // known call strength icon.
                            if (displayCallStrengthIcon) {
                                mInfos[slotIndex] = new CellSignalState(
                                        true,
                                        mLastSignalLevel[slotIndex],
                                        mLastSignalLevelDescription[slotIndex],
                                        "",
                                        false,
                                        mProviderModel);
                            } else {
                                mInfos[slotIndex] = new CellSignalState(
                                        true,
                                        R.drawable.ic_qs_sim_card,
                                        "",
                                        "",
                                        false,
                                        mProviderModel);
                            }
                        }
                        mMainHandler.obtainMessage(H.MSG_UPDATE_STATE).sendToTarget();
                    } else {
                        mLastSignalLevel[slotIndex] = statusIcon.icon;
                        mLastSignalLevelDescription[slotIndex] = statusIcon.contentDescription;
                        // Only Shows the call strength icon when the no Calling & SMS icon is not
                        // shown.
                        if (mInfos[slotIndex].mobileSignalIconId
                                != R.drawable.ic_qs_no_calling_sms) {
                            if (displayCallStrengthIcon) {
                                mInfos[slotIndex] = new CellSignalState(
                                        true,
                                        statusIcon.icon,
                                        statusIcon.contentDescription,
                                        "",
                                        false,
                                        mProviderModel);
                            } else {
                                mInfos[slotIndex] = new CellSignalState(
                                        true,
                                        R.drawable.ic_qs_sim_card,
                                        "",
                                        "",
                                        false,
                                        mProviderModel);
                            }
                            mMainHandler.obtainMessage(H.MSG_UPDATE_STATE).sendToTarget();
                        }
                    }
                }

                @Override
                public void setNoSims(boolean hasNoSims, boolean simDetected) {
                    if (hasNoSims) {
@@ -219,14 +133,8 @@ public class QSCarrierGroupController {
            @Background Handler bgHandler, @Main Looper mainLooper,
            NetworkController networkController,
            CarrierTextManager.Builder carrierTextManagerBuilder, Context context,
            CarrierConfigTracker carrierConfigTracker, FeatureFlags featureFlags,
            SlotIndexResolver slotIndexResolver) {
            CarrierConfigTracker carrierConfigTracker, SlotIndexResolver slotIndexResolver) {

        if (featureFlags.isEnabled(Flags.COMBINED_STATUS_BAR_SIGNAL_ICONS)) {
            mProviderModel = true;
        } else {
            mProviderModel = false;
        }
        mActivityStarter = activityStarter;
        mBgHandler = bgHandler;
        mNetworkController = networkController;
@@ -262,8 +170,7 @@ public class QSCarrierGroupController {
                    R.drawable.ic_qs_no_calling_sms,
                    context.getText(AccessibilityContentDescriptions.NO_CALLING).toString(),
                    "",
                    false,
                    mProviderModel);
                    false);
            mLastSignalLevel[i] = TelephonyIcons.MOBILE_CALL_STRENGTH_ICONS[0];
            mLastSignalLevelDescription[i] =
                    context.getText(AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0])
@@ -351,8 +258,7 @@ public class QSCarrierGroupController {
            for (int i = 0; i < SIM_SLOTS; i++) {
                if (mInfos[i].visible
                        && mInfos[i].mobileSignalIconId == R.drawable.ic_qs_sim_card) {
                    mInfos[i] = new CellSignalState(true, R.drawable.ic_blank, "", "", false,
                            mProviderModel);
                    mInfos[i] = new CellSignalState(true, R.drawable.ic_blank, "", "", false);
                }
            }
        }
@@ -470,15 +376,13 @@ public class QSCarrierGroupController {
        private final CarrierTextManager.Builder mCarrierTextControllerBuilder;
        private final Context mContext;
        private final CarrierConfigTracker mCarrierConfigTracker;
        private final FeatureFlags mFeatureFlags;
        private final SlotIndexResolver mSlotIndexResolver;

        @Inject
        public Builder(ActivityStarter activityStarter, @Background Handler handler,
                @Main Looper looper, NetworkController networkController,
                CarrierTextManager.Builder carrierTextControllerBuilder, Context context,
                CarrierConfigTracker carrierConfigTracker, FeatureFlags featureFlags,
                SlotIndexResolver slotIndexResolver) {
                CarrierConfigTracker carrierConfigTracker, SlotIndexResolver slotIndexResolver) {
            mActivityStarter = activityStarter;
            mHandler = handler;
            mLooper = looper;
@@ -486,7 +390,6 @@ public class QSCarrierGroupController {
            mCarrierTextControllerBuilder = carrierTextControllerBuilder;
            mContext = context;
            mCarrierConfigTracker = carrierConfigTracker;
            mFeatureFlags = featureFlags;
            mSlotIndexResolver = slotIndexResolver;
        }

@@ -498,7 +401,7 @@ public class QSCarrierGroupController {
        public QSCarrierGroupController build() {
            return new QSCarrierGroupController(mView, mActivityStarter, mHandler, mLooper,
                    mNetworkController, mCarrierTextControllerBuilder, mContext,
                    mCarrierConfigTracker, mFeatureFlags, mSlotIndexResolver);
                    mCarrierConfigTracker, mSlotIndexResolver);
        }
    }

Loading