Merge "Fix tethering summary when airplane mode is off" into pi-dev am: a07b1f83a8
am: 8ed6b5dabf
Change-Id: I27bd8d85f0c22207336f8bf632280a5bfd243658
This commit is contained in:
@@ -44,6 +44,7 @@ public class WifiTetherPreferenceController extends AbstractPreferenceController
|
||||
private static final String WIFI_TETHER_SETTINGS = "wifi_tether";
|
||||
private static final IntentFilter AIRPLANE_INTENT_FILTER = new IntentFilter(
|
||||
Intent.ACTION_AIRPLANE_MODE_CHANGED);
|
||||
private static final int ID_NULL = -1;
|
||||
|
||||
private final ConnectivityManager mConnectivityManager;
|
||||
private final String[] mWifiRegexs;
|
||||
@@ -152,7 +153,7 @@ public class WifiTetherPreferenceController extends AbstractPreferenceController
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(action)) {
|
||||
clearSummaryForAirplaneMode();
|
||||
clearSummaryForAirplaneMode(R.string.wifi_hotspot_off_subtext);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -194,10 +195,16 @@ public class WifiTetherPreferenceController extends AbstractPreferenceController
|
||||
}
|
||||
|
||||
private void clearSummaryForAirplaneMode() {
|
||||
clearSummaryForAirplaneMode(ID_NULL);
|
||||
}
|
||||
|
||||
private void clearSummaryForAirplaneMode(int defaultId) {
|
||||
boolean isAirplaneMode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
|
||||
if (isAirplaneMode) {
|
||||
mPreference.setSummary(R.string.wifi_tether_disabled_by_airplane);
|
||||
} else if (defaultId != ID_NULL){
|
||||
mPreference.setSummary(defaultId);
|
||||
}
|
||||
}
|
||||
//
|
||||
|
Reference in New Issue
Block a user