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

Commit c7bc84b9 authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Added correct TalkBack support for QSCarrier

Added new MobileIconGroup to TelephonyIcons for SIMs that are not set as
default for mobile data. This group behaves identically to DATA_DISABLES
except that is checked before it so we can assign it correctly.

This addition was made for properly providing content description of
carriers that are not set as default for data. Previously it said
"Mobile Data Off" which could be misleading.

Test: manual with 1 and 2 sims
Test: atest NetworkControllerDataTest NetworkControllerSignalTest
Bug: 123299825
Change-Id: Ia9e085b6296ff8df861e1e40bf8004b20b0d2c11
parent 66b5c276
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@
    android:background="@android:color/transparent"
    android:clickable="false"
    android:clipChildren="false"
    android:clipToPadding="false" >
    android:clipToPadding="false"
    android:focusable="true" >

    <include
        layout="@layout/mobile_signal_group"
+4 −2
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@
        android:id="@+id/qs_carrier_divider1"
        android:layout_width="@dimen/qs_header_carrier_separator_width"
        android:layout_height="match_parent"
        android:visibility="gone" />
        android:visibility="gone"
        android:importantForAccessibility="no"/>

    <include
        layout="@layout/qs_carrier"
@@ -47,7 +48,8 @@
        android:layout_width="@dimen/qs_header_carrier_separator_width"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:visibility="gone" />
        android:visibility="gone"
        android:importantForAccessibility="no"/>

    <include
        layout="@layout/qs_carrier"
+3 −0
Original line number Diff line number Diff line
@@ -445,6 +445,9 @@
    <!-- Content description of the cell data being disabled. [CHAR LIMIT=NONE] -->
    <string name="cell_data_off_content_description">Mobile data off</string>

    <!-- Content description of the cell data for not default subscription. [CHAR LIMIT=NONE] -->
    <string name="not_default_data_content_description">Not set to use data</string>

    <!-- Content description of the cell data being disabled but shortened. [CHAR LIMIT=20] -->
    <string name="cell_data_off">Off</string>

+10 −4
Original line number Diff line number Diff line
@@ -89,16 +89,22 @@ public class QSCarrier extends LinearLayout {
                        .append(", ");
            }
            // TODO: show mobile data off/no internet text for 5 seconds before carrier text
            if (TextUtils.equals(state.typeContentDescription,
                    mContext.getString(R.string.data_connection_no_internet))
                    || TextUtils.equals(state.typeContentDescription,
                    mContext.getString(R.string.cell_data_off_content_description))) {
            if (hasValidTypeContentDescription(state.typeContentDescription)) {
                contentDescription.append(state.typeContentDescription);
            }
            mMobileSignal.setContentDescription(contentDescription);
        }
    }

    private boolean hasValidTypeContentDescription(String typeContentDescription) {
        return TextUtils.equals(typeContentDescription,
                mContext.getString(R.string.data_connection_no_internet))
                || TextUtils.equals(typeContentDescription,
                mContext.getString(R.string.cell_data_off_content_description))
                || TextUtils.equals(typeContentDescription,
                mContext.getString(R.string.not_default_data_content_description));
    }

    public void setCarrierText(CharSequence text) {
        mCarrierText.setText(text);
    }
+10 −3
Original line number Diff line number Diff line
@@ -256,7 +256,8 @@ public class MobileSignalController extends SignalController<
                level++;
            }
            boolean dataDisabled = mCurrentState.userSetup
                    && mCurrentState.iconGroup == TelephonyIcons.DATA_DISABLED;
                    && (mCurrentState.iconGroup == TelephonyIcons.DATA_DISABLED
                    || mCurrentState.iconGroup == TelephonyIcons.NOT_DEFAULT_DATA);
            boolean noInternet = mCurrentState.inetCondition == 0;
            boolean cutOut = dataDisabled || noInternet;
            return SignalDrawable.getState(level, getNumLevels(), cutOut);
@@ -285,7 +286,8 @@ public class MobileSignalController extends SignalController<
        if (mCurrentState.inetCondition == 0) {
            dataContentDescription = mContext.getString(R.string.data_connection_no_internet);
        }
        final boolean dataDisabled = mCurrentState.iconGroup == TelephonyIcons.DATA_DISABLED
        final boolean dataDisabled = (mCurrentState.iconGroup == TelephonyIcons.DATA_DISABLED
                || mCurrentState.iconGroup == TelephonyIcons.NOT_DEFAULT_DATA)
                && mCurrentState.userSetup;

        // Show icon in QS when we are connected or data is disabled.
@@ -456,8 +458,13 @@ public class MobileSignalController extends SignalController<
        if (isCarrierNetworkChangeActive()) {
            mCurrentState.iconGroup = TelephonyIcons.CARRIER_NETWORK_CHANGE;
        } else if (isDataDisabled() && !mConfig.alwaysShowDataRatIcon) {
            if (mSubscriptionInfo.getSubscriptionId()
                    != mDefaults.getDefaultDataSubId()) {
                mCurrentState.iconGroup = TelephonyIcons.NOT_DEFAULT_DATA;
            } else {
                mCurrentState.iconGroup = TelephonyIcons.DATA_DISABLED;
            }
        }
        if (isEmergencyOnly() != mCurrentState.isEmergency) {
            mCurrentState.isEmergency = isEmergencyOnly();
            mNetworkController.recalculateEmergency();
Loading