Merge "DO NOT MERGE. SystemUI: Display RAT icon when data is off"
This commit is contained in:
@@ -223,8 +223,7 @@ public class MobileSignalController extends SignalController<
|
|||||||
|
|
||||||
String contentDescription = getStringIfExists(getContentDescription());
|
String contentDescription = getStringIfExists(getContentDescription());
|
||||||
String dataContentDescription = getStringIfExists(icons.mDataContentDescription);
|
String dataContentDescription = getStringIfExists(icons.mDataContentDescription);
|
||||||
final boolean dataDisabled = mCurrentState.iconGroup == TelephonyIcons.DATA_DISABLED
|
final boolean dataDisabled = isDataDisabled() && mCurrentState.userSetup;
|
||||||
&& mCurrentState.userSetup;
|
|
||||||
|
|
||||||
// Show icon in QS when we are connected or data is disabled.
|
// Show icon in QS when we are connected or data is disabled.
|
||||||
boolean showDataIcon = mCurrentState.dataConnected || dataDisabled;
|
boolean showDataIcon = mCurrentState.dataConnected || dataDisabled;
|
||||||
@@ -404,7 +403,7 @@ public class MobileSignalController extends SignalController<
|
|||||||
mCurrentState.roaming = isRoaming();
|
mCurrentState.roaming = isRoaming();
|
||||||
if (isCarrierNetworkChangeActive()) {
|
if (isCarrierNetworkChangeActive()) {
|
||||||
mCurrentState.iconGroup = TelephonyIcons.CARRIER_NETWORK_CHANGE;
|
mCurrentState.iconGroup = TelephonyIcons.CARRIER_NETWORK_CHANGE;
|
||||||
} else if (isDataDisabled()) {
|
} else if (isDataDisabled() && !mConfig.alwaysShowDataRatIcon) {
|
||||||
mCurrentState.iconGroup = TelephonyIcons.DATA_DISABLED;
|
mCurrentState.iconGroup = TelephonyIcons.DATA_DISABLED;
|
||||||
}
|
}
|
||||||
if (isEmergencyOnly() != mCurrentState.isEmergency) {
|
if (isEmergencyOnly() != mCurrentState.isEmergency) {
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ import android.os.AsyncTask;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.os.PersistableBundle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.telephony.CarrierConfigManager;
|
||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
@@ -219,6 +221,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
|
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
|
||||||
filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
|
filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
|
||||||
filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
|
filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
|
||||||
|
filter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
|
||||||
mContext.registerReceiver(this, filter, null, mReceiverHandler);
|
mContext.registerReceiver(this, filter, null, mReceiverHandler);
|
||||||
mListening = true;
|
mListening = true;
|
||||||
|
|
||||||
@@ -396,6 +399,14 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
// emergency state.
|
// emergency state.
|
||||||
recalculateEmergency();
|
recalculateEmergency();
|
||||||
}
|
}
|
||||||
|
} else if (action.equals(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) {
|
||||||
|
mConfig = Config.readConfig(mContext);
|
||||||
|
mReceiverHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
handleConfigurationChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
|
int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
|
||||||
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||||
@@ -904,6 +915,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
boolean show4gForLte = false;
|
boolean show4gForLte = false;
|
||||||
boolean hideLtePlus = false;
|
boolean hideLtePlus = false;
|
||||||
boolean hspaDataDistinguishable;
|
boolean hspaDataDistinguishable;
|
||||||
|
boolean alwaysShowDataRatIcon = false;
|
||||||
|
|
||||||
static Config readConfig(Context context) {
|
static Config readConfig(Context context) {
|
||||||
Config config = new Config();
|
Config config = new Config();
|
||||||
@@ -916,6 +928,14 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
config.hspaDataDistinguishable =
|
config.hspaDataDistinguishable =
|
||||||
res.getBoolean(R.bool.config_hspa_data_distinguishable);
|
res.getBoolean(R.bool.config_hspa_data_distinguishable);
|
||||||
config.hideLtePlus = res.getBoolean(R.bool.config_hideLtePlus);
|
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;
|
return config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,21 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
|
|||||||
verifyDataIndicators(0, 0);
|
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() {
|
public void test4gDataIconConfigChange() {
|
||||||
setupDefaultSignal();
|
setupDefaultSignal();
|
||||||
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
|
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
|
||||||
|
|||||||
@@ -838,6 +838,12 @@ public class CarrierConfigManager {
|
|||||||
public static final String KEY_STK_DISABLE_LAUNCH_BROWSER_BOOL =
|
public static final String KEY_STK_DISABLE_LAUNCH_BROWSER_BOOL =
|
||||||
"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
|
// 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.
|
// SmsManager}. The variable names and string values are copied from there.
|
||||||
@@ -1491,6 +1497,7 @@ public class CarrierConfigManager {
|
|||||||
sDefaults.putInt(KEY_LTE_EARFCNS_RSRP_BOOST_INT, 0);
|
sDefaults.putInt(KEY_LTE_EARFCNS_RSRP_BOOST_INT, 0);
|
||||||
sDefaults.putStringArray(KEY_BOOSTED_LTE_EARFCNS_STRING_ARRAY, null);
|
sDefaults.putStringArray(KEY_BOOSTED_LTE_EARFCNS_STRING_ARRAY, null);
|
||||||
sDefaults.putBoolean(KEY_DISABLE_VOICE_BARRING_NOTIFICATION_BOOL, false);
|
sDefaults.putBoolean(KEY_DISABLE_VOICE_BARRING_NOTIFICATION_BOOL, false);
|
||||||
|
sDefaults.putBoolean(KEY_ALWAYS_SHOW_DATA_RAT_ICON_BOOL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user