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

Commit 674eae92 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Resolve merge conflicts of 710b3946 to master"

parents 29fdbc67 c52f0b61
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ public class MobileSignalController extends SignalController<
                && !mCurrentState.carrierNetworkChangeMode
                && mCurrentState.activityOut;
        showDataIcon &= mCurrentState.isDefault || dataDisabled;
        int typeIcon = showDataIcon ? icons.mDataType : 0;
        int typeIcon = (showDataIcon || mConfig.alwaysShowDataRatIcon) ? icons.mDataType : 0;
        callback.setMobileDataIndicators(statusIcon, qsIcon, typeIcon, qsTypeIcon,
                activityIn, activityOut, dataContentDescription, description, icons.mIsWide,
                mSubscriptionInfo.getSubscriptionId(), mCurrentState.roaming);
@@ -460,7 +460,7 @@ public class MobileSignalController extends SignalController<
        mCurrentState.roaming = isRoaming();
        if (isCarrierNetworkChangeActive()) {
            mCurrentState.iconGroup = TelephonyIcons.CARRIER_NETWORK_CHANGE;
        } else if (isDataDisabled()) {
        } else if (isDataDisabled() && !mConfig.alwaysShowDataRatIcon) {
            mCurrentState.iconGroup = TelephonyIcons.DATA_DISABLED;
        }
        if (isEmergencyOnly() != mCurrentState.isEmergency) {
+20 −0
Original line number Diff line number Diff line
@@ -29,7 +29,9 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.PersistableBundle;
import android.provider.Settings;
import android.telephony.CarrierConfigManager;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
@@ -245,6 +247,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
        filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
        filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
        filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
        filter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        mContext.registerReceiver(this, filter, null, mReceiverHandler);
        mListening = true;

@@ -426,6 +429,14 @@ public class NetworkControllerImpl extends BroadcastReceiver
                // emergency state.
                recalculateEmergency();
            }
        } else if (action.equals(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) {
            mConfig = Config.readConfig(mContext);
            mReceiverHandler.post(new Runnable() {
                @Override
                public void run() {
                    handleConfigurationChanged();
                }
            });
        } else {
            int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
                    SubscriptionManager.INVALID_SUBSCRIPTION_ID);
@@ -969,6 +980,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
        boolean hideLtePlus = false;
        boolean hspaDataDistinguishable;
        boolean inflateSignalStrengths = false;
        boolean alwaysShowDataRatIcon = false;

        static Config readConfig(Context context) {
            Config config = new Config();
@@ -982,6 +994,14 @@ public class NetworkControllerImpl extends BroadcastReceiver
                    res.getBoolean(R.bool.config_hspa_data_distinguishable);
            config.hideLtePlus = res.getBoolean(R.bool.config_hideLtePlus);
            config.inflateSignalStrengths = res.getBoolean(R.bool.config_inflateSignalStrength);

            CarrierConfigManager configMgr = (CarrierConfigManager)
                    context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
            PersistableBundle b = configMgr.getConfig();
            if (b != null) {
                config.alwaysShowDataRatIcon = b.getBoolean(
                        CarrierConfigManager.KEY_ALWAYS_SHOW_DATA_RAT_ICON_BOOL);
            }
            return config;
        }
    }
+19 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ import android.testing.TestableLooper.RunWithLooper;

import com.android.settingslib.net.DataUsageController;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;

@@ -136,6 +137,24 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
        verifyDataIndicators(0, 0);
    }

    @Test
    @Ignore("Flaky")
    //TODO(evanlaird): figure out why this fails
    public void testAlwaysShowDataRatIcon() {
        setupDefaultSignal();
        when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
        updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED,
                TelephonyManager.NETWORK_TYPE_GSM);

        // Switch to showing data RAT icon when data is disconnected
        // and re-initialize the NetworkController.
        mConfig.alwaysShowDataRatIcon = true;
        mNetworkController.handleConfigurationChanged();

        verifyDataIndicators(TelephonyIcons.ICON_G,
                TelephonyIcons.QS_DATA_G);
    }

    @Test
    public void test4gDataIconConfigChange() {
        setupDefaultSignal();
+7 −0
Original line number Diff line number Diff line
@@ -989,6 +989,12 @@ public class CarrierConfigManager {
    public static final String KEY_STK_DISABLE_LAUNCH_BROWSER_BOOL =
            "stk_disable_launch_browser_bool";

    /**
     * Boolean indicating if show data RAT icon on status bar even when data is disabled
     * @hide
     */
    public static final String KEY_ALWAYS_SHOW_DATA_RAT_ICON_BOOL =
            "always_show_data_rat_icon_bool";

    // These variables are used by the MMS service and exposed through another API, {@link
    // SmsManager}. The variable names and string values are copied from there.
@@ -1967,6 +1973,7 @@ public class CarrierConfigManager {
        sDefaults.putStringArray(KEY_FEATURE_ACCESS_CODES_STRING_ARRAY, null);
        sDefaults.putBoolean(KEY_IDENTIFY_HIGH_DEFINITION_CALLS_IN_CALL_LOG_BOOL, false);
        sDefaults.putBoolean(KEY_SPN_DISPLAY_RULE_USE_ROAMING_FROM_SERVICE_STATE_BOOL, false);
        sDefaults.putBoolean(KEY_ALWAYS_SHOW_DATA_RAT_ICON_BOOL, false);
    }

    /**