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

Commit f3a994f5 authored by Evan Laird's avatar Evan Laird Committed by android-build-merger
Browse files

Merge "Put a little space between wifi and data type" into pi-dev

am: 2640b214

Change-Id: I4667dca524a67d13fa11f930eda606ed74fc3e89
parents f4381335 2640b214
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center_vertical"
        android:paddingStart="2dp"
        android:orientation="horizontal" >

        <FrameLayout
+45 −10
Original line number Diff line number Diff line
@@ -148,16 +148,31 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
        boolean in = activityIn && mActivityEnabled && visible;
        boolean out = activityOut && mActivityEnabled && visible;

        mWifiIconState.visible = visible;
        mWifiIconState.resId = statusIcon.icon;
        mWifiIconState.activityIn = in;
        mWifiIconState.activityOut = out;
        mWifiIconState.slot = mSlotWifi;
        mWifiIconState.airplaneSpacerVisible = mIsAirplaneMode;
        mWifiIconState.contentDescription = statusIcon.contentDescription;

        if (mWifiIconState.visible && mWifiIconState.resId > 0) {
            mIconController.setSignalIcon(mSlotWifi, mWifiIconState.copy());
        WifiIconState newState = mWifiIconState.copy();

        newState.visible = visible;
        newState.resId = statusIcon.icon;
        newState.activityIn = in;
        newState.activityOut = out;
        newState.slot = mSlotWifi;
        newState.airplaneSpacerVisible = mIsAirplaneMode;
        newState.contentDescription = statusIcon.contentDescription;

        MobileIconState first = getFirstMobileState();
        newState.signalSpacerVisible = first != null && first.typeId != 0;

        updateWifiIconWithState(newState);
        mWifiIconState = newState;
    }

    private void updateShowWifiSignalSpacer(WifiIconState state) {
        MobileIconState first = getFirstMobileState();
        state.signalSpacerVisible = first != null && first.typeId != 0;
    }

    private void updateWifiIconWithState(WifiIconState state) {
        if (state.visible && state.resId > 0) {
            mIconController.setSignalIcon(mSlotWifi, state);
            mIconController.setIconVisibility(mSlotWifi, true);
        } else {
            mIconController.setIconVisibility(mSlotWifi, false);
@@ -173,6 +188,9 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
            return;
        }

        // Visibility of the data type indicator changed
        boolean typeChanged = statusType != state.typeId && (statusType == 0 || state.typeId == 0);

        state.visible = statusIcon.visible && !mBlockMobile;
        state.strengthId = statusIcon.icon;
        state.typeId = statusType;
@@ -184,6 +202,15 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba

        // Always send a copy to maintain value type semantics
        mIconController.setMobileIcons(mSlotMobile, MobileIconState.copyStates(mMobileStates));

        if (typeChanged) {
            WifiIconState wifiCopy = mWifiIconState.copy();
            updateShowWifiSignalSpacer(wifiCopy);
            if (!Objects.equals(wifiCopy, mWifiIconState)) {
                updateWifiIconWithState(wifiCopy);
                mWifiIconState = wifiCopy;
            }
        }
    }

    private MobileIconState getState(int subId) {
@@ -196,6 +223,14 @@ public class StatusBarSignalPolicy implements NetworkControllerImpl.SignalCallba
        return null;
    }

    private MobileIconState getFirstMobileState() {
        if (mMobileStates.size() > 0) {
            return mMobileStates.get(0);
        }

        return null;
    }


    /**
     * It is expected that a call to setSubs will be immediately followed by setMobileDataIndicators