Merge "SystemUI: Display RAT icon when data is off"
am: e441298a11
Change-Id: I483d17ac1ef79b9b6f31bbefaf03f7833e13020b
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -433,6 +436,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);
|
||||
@@ -972,6 +983,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();
|
||||
@@ -985,6 +997,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,6 +142,23 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
|
||||
verifyDataIndicators(0, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Flaky")
|
||||
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
|
||||
@Ignore("Flaky")
|
||||
public void test4gDataIconConfigChange() {
|
||||
|
||||
@@ -980,6 +980,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.
|
||||
@@ -1959,6 +1965,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user