Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +2 −3 Original line number Diff line number Diff line Loading @@ -223,8 +223,7 @@ public class MobileSignalController extends SignalController< String contentDescription = getStringIfExists(getContentDescription()); String dataContentDescription = getStringIfExists(icons.mDataContentDescription); final boolean dataDisabled = mCurrentState.iconGroup == TelephonyIcons.DATA_DISABLED && mCurrentState.userSetup; final boolean dataDisabled = isDataDisabled() && mCurrentState.userSetup; // Show icon in QS when we are connected or data is disabled. boolean showDataIcon = mCurrentState.dataConnected || dataDisabled; Loading Loading @@ -404,7 +403,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) { Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +20 −0 Original line number Diff line number Diff line Loading @@ -28,7 +28,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.SubscriptionInfo; import android.telephony.SubscriptionManager; Loading Loading @@ -219,6 +221,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; Loading Loading @@ -396,6 +399,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); Loading Loading @@ -904,6 +915,7 @@ public class NetworkControllerImpl extends BroadcastReceiver boolean show4gForLte = false; boolean hideLtePlus = false; boolean hspaDataDistinguishable; boolean alwaysShowDataRatIcon = false; static Config readConfig(Context context) { Config config = new Config(); Loading @@ -916,6 +928,14 @@ public class NetworkControllerImpl extends BroadcastReceiver config.hspaDataDistinguishable = res.getBoolean(R.bool.config_hspa_data_distinguishable); config.hideLtePlus = res.getBoolean(R.bool.config_hideLtePlus); 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; } } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,21 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest { verifyDataIndicators(0, 0); } public void testAlwaysShowDataRatIcon() { setupDefaultSignal(); Mockito.when(mMockTm.getDataEnabled(mSubId)).thenReturn(false); updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED, TelephonyManager.NETWORK_TYPE_GSM); // Switch to showing data RAT icon when data is diconnected // and re-initialize the NetworkController. mConfig.alwaysShowDataRatIcon = true; mNetworkController.handleConfigurationChanged(); verifyDataIndicators(TelephonyIcons.DATA_G[1][0 /* No direction */], TelephonyIcons.QS_DATA_G); } public void test4gDataIconConfigChange() { setupDefaultSignal(); updateDataConnectionState(TelephonyManager.DATA_CONNECTED, Loading telephony/java/android/telephony/CarrierConfigManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -838,6 +838,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. Loading Loading @@ -1491,6 +1497,7 @@ public class CarrierConfigManager { sDefaults.putInt(KEY_LTE_EARFCNS_RSRP_BOOST_INT, 0); sDefaults.putStringArray(KEY_BOOSTED_LTE_EARFCNS_STRING_ARRAY, null); sDefaults.putBoolean(KEY_DISABLE_VOICE_BARRING_NOTIFICATION_BOOL, false); sDefaults.putBoolean(KEY_ALWAYS_SHOW_DATA_RAT_ICON_BOOL, false); } /** Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +2 −3 Original line number Diff line number Diff line Loading @@ -223,8 +223,7 @@ public class MobileSignalController extends SignalController< String contentDescription = getStringIfExists(getContentDescription()); String dataContentDescription = getStringIfExists(icons.mDataContentDescription); final boolean dataDisabled = mCurrentState.iconGroup == TelephonyIcons.DATA_DISABLED && mCurrentState.userSetup; final boolean dataDisabled = isDataDisabled() && mCurrentState.userSetup; // Show icon in QS when we are connected or data is disabled. boolean showDataIcon = mCurrentState.dataConnected || dataDisabled; Loading Loading @@ -404,7 +403,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) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +20 −0 Original line number Diff line number Diff line Loading @@ -28,7 +28,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.SubscriptionInfo; import android.telephony.SubscriptionManager; Loading Loading @@ -219,6 +221,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; Loading Loading @@ -396,6 +399,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); Loading Loading @@ -904,6 +915,7 @@ public class NetworkControllerImpl extends BroadcastReceiver boolean show4gForLte = false; boolean hideLtePlus = false; boolean hspaDataDistinguishable; boolean alwaysShowDataRatIcon = false; static Config readConfig(Context context) { Config config = new Config(); Loading @@ -916,6 +928,14 @@ public class NetworkControllerImpl extends BroadcastReceiver config.hspaDataDistinguishable = res.getBoolean(R.bool.config_hspa_data_distinguishable); config.hideLtePlus = res.getBoolean(R.bool.config_hideLtePlus); 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; } } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java +15 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,21 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest { verifyDataIndicators(0, 0); } public void testAlwaysShowDataRatIcon() { setupDefaultSignal(); Mockito.when(mMockTm.getDataEnabled(mSubId)).thenReturn(false); updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED, TelephonyManager.NETWORK_TYPE_GSM); // Switch to showing data RAT icon when data is diconnected // and re-initialize the NetworkController. mConfig.alwaysShowDataRatIcon = true; mNetworkController.handleConfigurationChanged(); verifyDataIndicators(TelephonyIcons.DATA_G[1][0 /* No direction */], TelephonyIcons.QS_DATA_G); } public void test4gDataIconConfigChange() { setupDefaultSignal(); updateDataConnectionState(TelephonyManager.DATA_CONNECTED, Loading
telephony/java/android/telephony/CarrierConfigManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -838,6 +838,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. Loading Loading @@ -1491,6 +1497,7 @@ public class CarrierConfigManager { sDefaults.putInt(KEY_LTE_EARFCNS_RSRP_BOOST_INT, 0); sDefaults.putStringArray(KEY_BOOSTED_LTE_EARFCNS_STRING_ARRAY, null); sDefaults.putBoolean(KEY_DISABLE_VOICE_BARRING_NOTIFICATION_BOOL, false); sDefaults.putBoolean(KEY_ALWAYS_SHOW_DATA_RAT_ICON_BOOL, false); } /** Loading