WiFiCallingSettings: show roaming preferrence am: fe3749dd0b
am: 335b3488f9
am: 9f0d5f7e5d
Change-Id: Ie899eba9566d12534dd9bf524542c1a5f00cb38b
This commit is contained in:
@@ -2017,15 +2017,26 @@
|
|||||||
<string name="wifi_calling_suggestion_title">Turn on Wi-Fi Calling</string>
|
<string name="wifi_calling_suggestion_title">Turn on Wi-Fi Calling</string>
|
||||||
<!-- Summary of suggestion to turn on wifi calling [CHAR LIMIT=60] -->
|
<!-- Summary of suggestion to turn on wifi calling [CHAR LIMIT=60] -->
|
||||||
<string name="wifi_calling_suggestion_summary">Use Wi-Fi instead of mobile network</string>
|
<string name="wifi_calling_suggestion_summary">Use Wi-Fi instead of mobile network</string>
|
||||||
<!-- WFC mode [CHAR LIMIT=30] -->
|
<!-- Title of WFC preference item [CHAR LIMIT=30] -->
|
||||||
<string name="wifi_calling_mode_title">Calling preference</string>
|
<string name="wifi_calling_mode_title">Calling preference</string>
|
||||||
<!-- WFC mode dialog [CHAR LIMIT=30] -->
|
<!-- Title of WFC preference selection dialog [CHAR LIMIT=30] -->
|
||||||
<string name="wifi_calling_mode_dialog_title">Wi-Fi calling mode</string>
|
<string name="wifi_calling_mode_dialog_title">Wi-Fi calling mode</string>
|
||||||
|
<!-- Title of WFC roaming preference item [CHAR LIMIT=45] -->
|
||||||
|
<string name="wifi_calling_roaming_mode_title">Roaming preference</string>
|
||||||
|
<!-- Summary of WFC roaming preference item [CHAR LIMIT=NONE]-->
|
||||||
|
<string name="wifi_calling_roaming_mode_summary"><xliff:g id="wfc_roaming_preference" example="Wi-Fi">%1$s</xliff:g></string>
|
||||||
|
<!-- WFC mode dialog [CHAR LIMIT=45] -->
|
||||||
|
<string name="wifi_calling_roaming_mode_dialog_title">Roaming preference</string>
|
||||||
<string-array name="wifi_calling_mode_choices">
|
<string-array name="wifi_calling_mode_choices">
|
||||||
<item>Wi-Fi preferred</item>
|
<item>Wi-Fi preferred</item>
|
||||||
<item>Cellular preferred</item>
|
<item>Cellular preferred</item>
|
||||||
<item>Wi-Fi only</item>
|
<item>Wi-Fi only</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string-array name="wifi_calling_mode_choices_v2">
|
||||||
|
<item>Wi-Fi</item>
|
||||||
|
<item>Cellular</item>
|
||||||
|
<item>Wi-Fi only</item>
|
||||||
|
</string-array>
|
||||||
<string-array name="wifi_calling_mode_values">
|
<string-array name="wifi_calling_mode_values">
|
||||||
<item>"2"</item>
|
<item>"2"</item>
|
||||||
<item>"1"</item>
|
<item>"1"</item>
|
||||||
@@ -2035,13 +2046,19 @@
|
|||||||
<item>Wi-Fi preferred</item>
|
<item>Wi-Fi preferred</item>
|
||||||
<item>Cellular preferred</item>
|
<item>Cellular preferred</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string-array name="wifi_calling_mode_choices_v2_without_wifi_only">
|
||||||
|
<item>Wi-Fi</item>
|
||||||
|
<item>Cellular</item>
|
||||||
|
</string-array>
|
||||||
<string-array name="wifi_calling_mode_values_without_wifi_only">
|
<string-array name="wifi_calling_mode_values_without_wifi_only">
|
||||||
<item>"2"</item>
|
<item>"2"</item>
|
||||||
<item>"1"</item>
|
<item>"1"</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<!-- Wi-Fi Calling settings. Text displayed when Wi-Fi Calling is off -->
|
<!-- Wi-Fi Calling settings. Text displayed when Wi-Fi Calling is off -->
|
||||||
<string name="wifi_calling_off_explanation">When Wi-Fi calling is on, your phone can route calls via Wi-Fi networks or your carrier\u2019s network, depending on your preference and which signal is stronger. Before turning on this feature, check with your carrier regarding fees and other details.</string>
|
<string name="wifi_calling_off_explanation">When Wi-Fi calling is on, your phone can route calls via Wi-Fi networks or your carrier\u2019s network, depending on your preference and which signal is stronger. Before turning on this feature, check with your carrier regarding fees and other details.</string>
|
||||||
|
<!-- Title of a preference for updating emergency address [CHAR LIMIT=40] -->
|
||||||
<string name="emergency_address_title">Update Emergency Address</string>
|
<string name="emergency_address_title">Update Emergency Address</string>
|
||||||
|
<!-- Summary of Update Emergency Address preference, explaining usage of emergency address [CHAR LIMIT=NONE] -->
|
||||||
<string name="emergency_address_summary">Address used by emergency services as your location if you make a 911 call using WiFi</string>
|
<string name="emergency_address_summary">Address used by emergency services as your location if you make a 911 call using WiFi</string>
|
||||||
|
|
||||||
|
|
||||||
|
@@ -26,10 +26,17 @@
|
|||||||
android:entryValues="@array/wifi_calling_mode_values"
|
android:entryValues="@array/wifi_calling_mode_values"
|
||||||
android:dialogTitle="@string/wifi_calling_mode_dialog_title" />
|
android:dialogTitle="@string/wifi_calling_mode_dialog_title" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:key="wifi_calling_roaming_mode"
|
||||||
|
android:title="@string/wifi_calling_roaming_mode_title"
|
||||||
|
android:summary="@string/wifi_calling_roaming_mode_summary"
|
||||||
|
android:entries="@array/wifi_calling_mode_choices_v2"
|
||||||
|
android:entryValues="@array/wifi_calling_mode_values"
|
||||||
|
android:dialogTitle="@string/wifi_calling_roaming_mode_dialog_title" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="emergency_address_key"
|
android:key="emergency_address_key"
|
||||||
android:title="@string/emergency_address_title"
|
android:title="@string/emergency_address_title"
|
||||||
android:summary="@string/emergency_address_summary">
|
android:summary="@string/emergency_address_summary" />
|
||||||
</Preference>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -55,6 +55,7 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
//String keys for preference lookup
|
//String keys for preference lookup
|
||||||
private static final String BUTTON_WFC_MODE = "wifi_calling_mode";
|
private static final String BUTTON_WFC_MODE = "wifi_calling_mode";
|
||||||
|
private static final String BUTTON_WFC_ROAMING_MODE = "wifi_calling_roaming_mode";
|
||||||
private static final String PREFERENCE_EMERGENCY_ADDRESS = "emergency_address_key";
|
private static final String PREFERENCE_EMERGENCY_ADDRESS = "emergency_address_key";
|
||||||
|
|
||||||
private static final int REQUEST_CHECK_WFC_EMERGENCY_ADDRESS = 1;
|
private static final int REQUEST_CHECK_WFC_EMERGENCY_ADDRESS = 1;
|
||||||
@@ -68,11 +69,13 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
private SwitchBar mSwitchBar;
|
private SwitchBar mSwitchBar;
|
||||||
private Switch mSwitch;
|
private Switch mSwitch;
|
||||||
private ListPreference mButtonWfcMode;
|
private ListPreference mButtonWfcMode;
|
||||||
|
private ListPreference mButtonWfcRoamingMode;
|
||||||
private Preference mUpdateAddress;
|
private Preference mUpdateAddress;
|
||||||
private TextView mEmptyView;
|
private TextView mEmptyView;
|
||||||
|
|
||||||
private boolean mValidListener = false;
|
private boolean mValidListener = false;
|
||||||
private boolean mEditableWfcMode = true;
|
private boolean mEditableWfcMode = true;
|
||||||
|
private boolean mEditableWfcRoamingMode = true;
|
||||||
|
|
||||||
private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
|
private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
|
||||||
/*
|
/*
|
||||||
@@ -93,26 +96,33 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
switchBar.setEnabled((state == TelephonyManager.CALL_STATE_IDLE)
|
switchBar.setEnabled((state == TelephonyManager.CALL_STATE_IDLE)
|
||||||
&& isNonTtyOrTtyOnVolteEnabled);
|
&& isNonTtyOrTtyOnVolteEnabled);
|
||||||
|
|
||||||
|
boolean isWfcModeEditable = true;
|
||||||
|
boolean isWfcRoamingModeEditable = false;
|
||||||
|
final CarrierConfigManager configManager = (CarrierConfigManager)
|
||||||
|
activity.getSystemService(Context.CARRIER_CONFIG_SERVICE);
|
||||||
|
if (configManager != null) {
|
||||||
|
PersistableBundle b = configManager.getConfig();
|
||||||
|
if (b != null) {
|
||||||
|
isWfcModeEditable = b.getBoolean(
|
||||||
|
CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL);
|
||||||
|
isWfcRoamingModeEditable = b.getBoolean(
|
||||||
|
CarrierConfigManager.KEY_EDITABLE_WFC_ROAMING_MODE_BOOL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Preference pref = getPreferenceScreen().findPreference(BUTTON_WFC_MODE);
|
Preference pref = getPreferenceScreen().findPreference(BUTTON_WFC_MODE);
|
||||||
if (pref != null) {
|
if (pref != null) {
|
||||||
pref.setEnabled(isWfcEnabled && getEditableWfcMode(activity)
|
pref.setEnabled(isWfcEnabled && isWfcModeEditable
|
||||||
|
&& (state == TelephonyManager.CALL_STATE_IDLE));
|
||||||
|
}
|
||||||
|
Preference pref_roam = getPreferenceScreen().findPreference(BUTTON_WFC_ROAMING_MODE);
|
||||||
|
if (pref_roam != null) {
|
||||||
|
pref_roam.setEnabled(isWfcEnabled && isWfcRoamingModeEditable
|
||||||
&& (state == TelephonyManager.CALL_STATE_IDLE));
|
&& (state == TelephonyManager.CALL_STATE_IDLE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static boolean getEditableWfcMode(Context context) {
|
|
||||||
CarrierConfigManager configManager = (CarrierConfigManager)
|
|
||||||
context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
|
|
||||||
if (configManager != null) {
|
|
||||||
PersistableBundle b = configManager.getConfig();
|
|
||||||
if (b != null) {
|
|
||||||
return b.getBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final OnPreferenceClickListener mUpdateAddressListener =
|
private final OnPreferenceClickListener mUpdateAddressListener =
|
||||||
new OnPreferenceClickListener() {
|
new OnPreferenceClickListener() {
|
||||||
/*
|
/*
|
||||||
@@ -203,6 +213,9 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
mButtonWfcMode = (ListPreference) findPreference(BUTTON_WFC_MODE);
|
mButtonWfcMode = (ListPreference) findPreference(BUTTON_WFC_MODE);
|
||||||
mButtonWfcMode.setOnPreferenceChangeListener(this);
|
mButtonWfcMode.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
|
mButtonWfcRoamingMode = (ListPreference) findPreference(BUTTON_WFC_ROAMING_MODE);
|
||||||
|
mButtonWfcRoamingMode.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
mUpdateAddress = (Preference) findPreference(PREFERENCE_EMERGENCY_ADDRESS);
|
mUpdateAddress = (Preference) findPreference(PREFERENCE_EMERGENCY_ADDRESS);
|
||||||
mUpdateAddress.setOnPreferenceClickListener(mUpdateAddressListener);
|
mUpdateAddress.setOnPreferenceClickListener(mUpdateAddressListener);
|
||||||
|
|
||||||
@@ -216,6 +229,8 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
PersistableBundle b = configManager.getConfig();
|
PersistableBundle b = configManager.getConfig();
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
mEditableWfcMode = b.getBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL);
|
mEditableWfcMode = b.getBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL);
|
||||||
|
mEditableWfcRoamingMode = b.getBoolean(
|
||||||
|
CarrierConfigManager.KEY_EDITABLE_WFC_ROAMING_MODE_BOOL);
|
||||||
isWifiOnlySupported = b.getBoolean(
|
isWifiOnlySupported = b.getBoolean(
|
||||||
CarrierConfigManager.KEY_CARRIER_WFC_SUPPORTS_WIFI_ONLY_BOOL, true);
|
CarrierConfigManager.KEY_CARRIER_WFC_SUPPORTS_WIFI_ONLY_BOOL, true);
|
||||||
}
|
}
|
||||||
@@ -224,6 +239,10 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
if (!isWifiOnlySupported) {
|
if (!isWifiOnlySupported) {
|
||||||
mButtonWfcMode.setEntries(R.array.wifi_calling_mode_choices_without_wifi_only);
|
mButtonWfcMode.setEntries(R.array.wifi_calling_mode_choices_without_wifi_only);
|
||||||
mButtonWfcMode.setEntryValues(R.array.wifi_calling_mode_values_without_wifi_only);
|
mButtonWfcMode.setEntryValues(R.array.wifi_calling_mode_values_without_wifi_only);
|
||||||
|
mButtonWfcRoamingMode.setEntries(
|
||||||
|
R.array.wifi_calling_mode_choices_v2_without_wifi_only);
|
||||||
|
mButtonWfcRoamingMode.setEntryValues(
|
||||||
|
R.array.wifi_calling_mode_values_without_wifi_only);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,9 +265,11 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
boolean wfcEnabled = ImsManager.isWfcEnabledByUser(context)
|
boolean wfcEnabled = ImsManager.isWfcEnabledByUser(context)
|
||||||
&& ImsManager.isNonTtyOrTtyOnVolteEnabled(context);
|
&& ImsManager.isNonTtyOrTtyOnVolteEnabled(context);
|
||||||
mSwitch.setChecked(wfcEnabled);
|
mSwitch.setChecked(wfcEnabled);
|
||||||
int wfcMode = ImsManager.getWfcMode(context);
|
int wfcMode = ImsManager.getWfcMode(context, false);
|
||||||
|
int wfcRoamingMode = ImsManager.getWfcMode(context, true);
|
||||||
mButtonWfcMode.setValue(Integer.toString(wfcMode));
|
mButtonWfcMode.setValue(Integer.toString(wfcMode));
|
||||||
updateButtonWfcMode(context, wfcEnabled, wfcMode);
|
mButtonWfcRoamingMode.setValue(Integer.toString(wfcRoamingMode));
|
||||||
|
updateButtonWfcMode(context, wfcEnabled, wfcMode, wfcRoamingMode);
|
||||||
|
|
||||||
context.registerReceiver(mIntentReceiver, mIntentFilter);
|
context.registerReceiver(mIntentReceiver, mIntentFilter);
|
||||||
|
|
||||||
@@ -331,8 +352,9 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
Log.i(TAG, "updateWfcMode(" + wfcEnabled + ")");
|
Log.i(TAG, "updateWfcMode(" + wfcEnabled + ")");
|
||||||
ImsManager.setWfcSetting(context, wfcEnabled);
|
ImsManager.setWfcSetting(context, wfcEnabled);
|
||||||
|
|
||||||
int wfcMode = ImsManager.getWfcMode(context);
|
int wfcMode = ImsManager.getWfcMode(context, false);
|
||||||
updateButtonWfcMode(context, wfcEnabled, wfcMode);
|
int wfcRoamingMode = ImsManager.getWfcMode(context, true);
|
||||||
|
updateButtonWfcMode(context, wfcEnabled, wfcMode, wfcRoamingMode);
|
||||||
if (wfcEnabled) {
|
if (wfcEnabled) {
|
||||||
mMetricsFeatureProvider.action(getActivity(), getMetricsCategory(), wfcMode);
|
mMetricsFeatureProvider.action(getActivity(), getMetricsCategory(), wfcMode);
|
||||||
} else {
|
} else {
|
||||||
@@ -355,9 +377,12 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateButtonWfcMode(Context context, boolean wfcEnabled, int wfcMode) {
|
private void updateButtonWfcMode(Context context, boolean wfcEnabled,
|
||||||
|
int wfcMode, int wfcRoamingMode) {
|
||||||
mButtonWfcMode.setSummary(getWfcModeSummary(context, wfcMode));
|
mButtonWfcMode.setSummary(getWfcModeSummary(context, wfcMode));
|
||||||
mButtonWfcMode.setEnabled(wfcEnabled && mEditableWfcMode);
|
mButtonWfcMode.setEnabled(wfcEnabled && mEditableWfcMode);
|
||||||
|
// mButtonWfcRoamingMode.setSummary is not needed; summary is just selected value.
|
||||||
|
mButtonWfcRoamingMode.setEnabled(wfcEnabled && mEditableWfcRoamingMode);
|
||||||
|
|
||||||
final PreferenceScreen preferenceScreen = getPreferenceScreen();
|
final PreferenceScreen preferenceScreen = getPreferenceScreen();
|
||||||
boolean updateAddressEnabled = (getCarrierActivityIntent(context) != null);
|
boolean updateAddressEnabled = (getCarrierActivityIntent(context) != null);
|
||||||
@@ -365,9 +390,15 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
if (mEditableWfcMode) {
|
if (mEditableWfcMode) {
|
||||||
preferenceScreen.addPreference(mButtonWfcMode);
|
preferenceScreen.addPreference(mButtonWfcMode);
|
||||||
} else {
|
} else {
|
||||||
// Don't show WFC mode preference if it's not editable.
|
// Don't show WFC (home) preference if it's not editable.
|
||||||
preferenceScreen.removePreference(mButtonWfcMode);
|
preferenceScreen.removePreference(mButtonWfcMode);
|
||||||
}
|
}
|
||||||
|
if (mEditableWfcRoamingMode) {
|
||||||
|
preferenceScreen.addPreference(mButtonWfcRoamingMode);
|
||||||
|
} else {
|
||||||
|
// Don't show WFC roaming preference if it's not editable.
|
||||||
|
preferenceScreen.removePreference(mButtonWfcRoamingMode);
|
||||||
|
}
|
||||||
if (updateAddressEnabled) {
|
if (updateAddressEnabled) {
|
||||||
preferenceScreen.addPreference(mUpdateAddress);
|
preferenceScreen.addPreference(mUpdateAddress);
|
||||||
} else {
|
} else {
|
||||||
@@ -375,6 +406,7 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
preferenceScreen.removePreference(mButtonWfcMode);
|
preferenceScreen.removePreference(mButtonWfcMode);
|
||||||
|
preferenceScreen.removePreference(mButtonWfcRoamingMode);
|
||||||
preferenceScreen.removePreference(mUpdateAddress);
|
preferenceScreen.removePreference(mUpdateAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -385,12 +417,28 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
|
|||||||
if (preference == mButtonWfcMode) {
|
if (preference == mButtonWfcMode) {
|
||||||
mButtonWfcMode.setValue((String) newValue);
|
mButtonWfcMode.setValue((String) newValue);
|
||||||
int buttonMode = Integer.valueOf((String) newValue);
|
int buttonMode = Integer.valueOf((String) newValue);
|
||||||
int currentMode = ImsManager.getWfcMode(context);
|
int currentWfcMode = ImsManager.getWfcMode(context, false);
|
||||||
if (buttonMode != currentMode) {
|
if (buttonMode != currentWfcMode) {
|
||||||
ImsManager.setWfcMode(context, buttonMode);
|
ImsManager.setWfcMode(context, buttonMode, false);
|
||||||
mButtonWfcMode.setSummary(getWfcModeSummary(context, buttonMode));
|
mButtonWfcMode.setSummary(getWfcModeSummary(context, buttonMode));
|
||||||
mMetricsFeatureProvider.action(getActivity(), getMetricsCategory(), buttonMode);
|
mMetricsFeatureProvider.action(getActivity(), getMetricsCategory(), buttonMode);
|
||||||
}
|
}
|
||||||
|
if (!mEditableWfcRoamingMode) {
|
||||||
|
int currentWfcRoamingMode = ImsManager.getWfcMode(context, true);
|
||||||
|
if (buttonMode != currentWfcRoamingMode) {
|
||||||
|
ImsManager.setWfcMode(context, buttonMode, true);
|
||||||
|
// mButtonWfcRoamingMode.setSummary is not needed; summary is selected value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (preference == mButtonWfcRoamingMode) {
|
||||||
|
mButtonWfcRoamingMode.setValue((String) newValue);
|
||||||
|
int buttonMode = Integer.valueOf((String) newValue);
|
||||||
|
int currentMode = ImsManager.getWfcMode(context, true);
|
||||||
|
if (buttonMode != currentMode) {
|
||||||
|
ImsManager.setWfcMode(context, buttonMode, true);
|
||||||
|
// mButtonWfcRoamingMode.setSummary is not needed; summary is just selected value.
|
||||||
|
MetricsLogger.action(getActivity(), getMetricsCategory(), buttonMode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -371,7 +371,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
getPreferenceScreen().addPreference(mButtonWfc);
|
getPreferenceScreen().addPreference(mButtonWfc);
|
||||||
|
|
||||||
mButtonWfc.setSummary(WifiCallingSettings.getWfcModeSummary(
|
mButtonWfc.setSummary(WifiCallingSettings.getWfcModeSummary(
|
||||||
context, ImsManager.getWfcMode(context)));
|
context, ImsManager.getWfcMode(context, mTm.isNetworkRoaming())));
|
||||||
} else {
|
} else {
|
||||||
removePreference(KEY_WFC_SETTINGS);
|
removePreference(KEY_WFC_SETTINGS);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user