Revert "Do not reuse phonestatelistener"
This reverts commit 728e186441
.
Reason for revert: bad merge (unremoved === right at top of file)
Change-Id: I9c22804fa6f971cbb9685aac5ae3f6527e198ea7
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
===/*
|
/*
|
||||||
* Copyright (C) 2006 The Android Open Source Project
|
* Copyright (C) 2006 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@@ -228,7 +228,7 @@ public class RadioInfo extends Activity {
|
|||||||
private ConnectivityManager mConnectivityManager;
|
private ConnectivityManager mConnectivityManager;
|
||||||
private TelephonyManager mTelephonyManager;
|
private TelephonyManager mTelephonyManager;
|
||||||
private ImsManager mImsManager = null;
|
private ImsManager mImsManager = null;
|
||||||
private Phone mPhone = null;
|
private Phone phone = null;
|
||||||
|
|
||||||
private String mPingHostnameResultV4;
|
private String mPingHostnameResultV4;
|
||||||
private String mPingHostnameResultV6;
|
private String mPingHostnameResultV6;
|
||||||
@@ -256,9 +256,7 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// not final because we need to recreate this object to register on a new subId (b/117555407)
|
private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
|
||||||
private PhoneStateListener mPhoneStateListener = new RadioInfoPhoneStateListener();
|
|
||||||
private class RadioInfoPhoneStateListener extends PhoneStateListener {
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataConnectionStateChanged(int state) {
|
public void onDataConnectionStateChanged(int state) {
|
||||||
updateDataState();
|
updateDataState();
|
||||||
@@ -326,7 +324,7 @@ public class RadioInfo extends Activity {
|
|||||||
updatePhysicalChannelConfiguration(configs);
|
updatePhysicalChannelConfiguration(configs);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
private void updatePhysicalChannelConfiguration(List<PhysicalChannelConfig> configs) {
|
private void updatePhysicalChannelConfiguration(List<PhysicalChannelConfig> configs) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -355,15 +353,15 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
private void updatePhoneIndex(int phoneIndex, int subId) {
|
private void updatePhoneIndex(int phoneIndex, int subId) {
|
||||||
// unregister listeners on the old subId
|
// unregister listeners on the old subId
|
||||||
unregisterPhoneStateListener();
|
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
|
||||||
mTelephonyManager.setCellInfoListRate(CELL_INFO_LIST_RATE_DISABLED);
|
mTelephonyManager.setCellInfoListRate(CELL_INFO_LIST_RATE_DISABLED);
|
||||||
|
|
||||||
// update the subId
|
// update the subId
|
||||||
mTelephonyManager = mTelephonyManager.createForSubscriptionId(subId);
|
mTelephonyManager = mTelephonyManager.createForSubscriptionId(subId);
|
||||||
|
mImsManager = ImsManager.getInstance(getApplicationContext(), phoneIndex);
|
||||||
|
|
||||||
// update the phoneId
|
// update the phoneId
|
||||||
mImsManager = ImsManager.getInstance(getApplicationContext(), phoneIndex);
|
phone = PhoneFactory.getPhone(phoneIndex);
|
||||||
mPhone = PhoneFactory.getPhone(phoneIndex);
|
|
||||||
|
|
||||||
updateAllFields();
|
updateAllFields();
|
||||||
}
|
}
|
||||||
@@ -426,7 +424,7 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
|
mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
|
||||||
mConnectivityManager = (ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE);
|
mConnectivityManager = (ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE);
|
||||||
mPhone = PhoneFactory.getDefaultPhone();
|
phone = PhoneFactory.getDefaultPhone();
|
||||||
|
|
||||||
mImsManager = ImsManager.getInstance(getApplicationContext(),
|
mImsManager = ImsManager.getInstance(getApplicationContext(),
|
||||||
SubscriptionManager.getDefaultVoicePhoneId());
|
SubscriptionManager.getDefaultVoicePhoneId());
|
||||||
@@ -486,7 +484,7 @@ public class RadioInfo extends Activity {
|
|||||||
imsWfcProvisionedSwitch = (Switch) findViewById(R.id.wfc_provisioned_switch);
|
imsWfcProvisionedSwitch = (Switch) findViewById(R.id.wfc_provisioned_switch);
|
||||||
eabProvisionedSwitch = (Switch) findViewById(R.id.eab_provisioned_switch);
|
eabProvisionedSwitch = (Switch) findViewById(R.id.eab_provisioned_switch);
|
||||||
|
|
||||||
if (!ImsManager.isImsSupportedOnDevice(mPhone.getContext())) {
|
if (!ImsManager.isImsSupportedOnDevice(phone.getContext())) {
|
||||||
imsVolteProvisionedSwitch.setVisibility(View.GONE);
|
imsVolteProvisionedSwitch.setVisibility(View.GONE);
|
||||||
imsVtProvisionedSwitch.setVisibility(View.GONE);
|
imsVtProvisionedSwitch.setVisibility(View.GONE);
|
||||||
imsWfcProvisionedSwitch.setVisibility(View.GONE);
|
imsWfcProvisionedSwitch.setVisibility(View.GONE);
|
||||||
@@ -547,7 +545,7 @@ public class RadioInfo extends Activity {
|
|||||||
mSelectedPhoneIndex = 0; //phone 0
|
mSelectedPhoneIndex = 0; //phone 0
|
||||||
|
|
||||||
//FIXME: Replace with TelephonyManager call
|
//FIXME: Replace with TelephonyManager call
|
||||||
mPhone.getPreferredNetworkType(
|
phone.getPreferredNetworkType(
|
||||||
mHandler.obtainMessage(EVENT_QUERY_PREFERRED_TYPE_DONE));
|
mHandler.obtainMessage(EVENT_QUERY_PREFERRED_TYPE_DONE));
|
||||||
|
|
||||||
restoreFromBundle(icicle);
|
restoreFromBundle(icicle);
|
||||||
@@ -604,7 +602,6 @@ public class RadioInfo extends Activity {
|
|||||||
cbrsDataSwitch.setOnCheckedChangeListener(mCbrsDataSwitchChangeListener);
|
cbrsDataSwitch.setOnCheckedChangeListener(mCbrsDataSwitchChangeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
unregisterPhoneStateListener();
|
|
||||||
registerPhoneStateListener();
|
registerPhoneStateListener();
|
||||||
|
|
||||||
mConnectivityManager.registerNetworkCallback(
|
mConnectivityManager.registerNetworkCallback(
|
||||||
@@ -669,7 +666,7 @@ public class RadioInfo extends Activity {
|
|||||||
R.string.radioInfo_menu_viewFDN).setOnMenuItemClickListener(mViewFDNCallback);
|
R.string.radioInfo_menu_viewFDN).setOnMenuItemClickListener(mViewFDNCallback);
|
||||||
menu.add(1, MENU_ITEM_VIEW_SDN, 0,
|
menu.add(1, MENU_ITEM_VIEW_SDN, 0,
|
||||||
R.string.radioInfo_menu_viewSDN).setOnMenuItemClickListener(mViewSDNCallback);
|
R.string.radioInfo_menu_viewSDN).setOnMenuItemClickListener(mViewSDNCallback);
|
||||||
if (ImsManager.isImsSupportedOnDevice(mPhone.getContext())) {
|
if (ImsManager.isImsSupportedOnDevice(phone.getContext())) {
|
||||||
menu.add(1, MENU_ITEM_GET_IMS_STATUS,
|
menu.add(1, MENU_ITEM_GET_IMS_STATUS,
|
||||||
0, R.string.radioInfo_menu_getIMS).setOnMenuItemClickListener(mGetImsStatus);
|
0, R.string.radioInfo_menu_getIMS).setOnMenuItemClickListener(mGetImsStatus);
|
||||||
}
|
}
|
||||||
@@ -712,32 +709,8 @@ public class RadioInfo extends Activity {
|
|||||||
return labels;
|
return labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unregisterPhoneStateListener() {
|
|
||||||
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
|
|
||||||
|
|
||||||
// clear all fields so they are blank until the next listener event occurs
|
|
||||||
operatorName.setText("");
|
|
||||||
gprsState.setText("");
|
|
||||||
dataNetwork.setText("");
|
|
||||||
voiceNetwork.setText("");
|
|
||||||
sent.setText("");
|
|
||||||
received.setText("");
|
|
||||||
callState.setText("");
|
|
||||||
mLocation.setText("");
|
|
||||||
mMwiValue = false;
|
|
||||||
mMwi.setText("");
|
|
||||||
mCfiValue = false;
|
|
||||||
mCfi.setText("");
|
|
||||||
mCellInfo.setText("");
|
|
||||||
dBm.setText("");
|
|
||||||
gsmState.setText("");
|
|
||||||
roamingState.setText("");
|
|
||||||
mPhyChanConfig.setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
// register mPhoneStateListener for relevant fields using the current TelephonyManager
|
// register mPhoneStateListener for relevant fields using the current TelephonyManager
|
||||||
private void registerPhoneStateListener() {
|
private void registerPhoneStateListener() {
|
||||||
mPhoneStateListener = new RadioInfoPhoneStateListener();
|
|
||||||
mTelephonyManager.listen(mPhoneStateListener,
|
mTelephonyManager.listen(mPhoneStateListener,
|
||||||
PhoneStateListener.LISTEN_CALL_STATE
|
PhoneStateListener.LISTEN_CALL_STATE
|
||||||
//b/27803938 - RadioInfo currently cannot read PRECISE_CALL_STATE
|
//b/27803938 - RadioInfo currently cannot read PRECISE_CALL_STATE
|
||||||
@@ -755,7 +728,7 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
private void updateDnsCheckState() {
|
private void updateDnsCheckState() {
|
||||||
//FIXME: Replace with a TelephonyManager call
|
//FIXME: Replace with a TelephonyManager call
|
||||||
dnsCheckState.setText(mPhone.isDnsCheckDisabled() ?
|
dnsCheckState.setText(phone.isDnsCheckDisabled() ?
|
||||||
"0.0.0.0 allowed" :"0.0.0.0 not allowed");
|
"0.0.0.0 allowed" :"0.0.0.0 not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -975,7 +948,7 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final void updateSubscriptionIds() {
|
private final void updateSubscriptionIds() {
|
||||||
mSubscriptionId.setText(Integer.toString(mPhone.getSubId()));
|
mSubscriptionId.setText(Integer.toString(phone.getSubId()));
|
||||||
mDds.setText(Integer.toString(SubscriptionManager.getDefaultDataSubscriptionId()));
|
mDds.setText(Integer.toString(SubscriptionManager.getDefaultDataSubscriptionId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1065,12 +1038,12 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final void updateNetworkType() {
|
private final void updateNetworkType() {
|
||||||
if(mPhone != null) {
|
if(phone != null) {
|
||||||
ServiceState ss = mPhone.getServiceState();
|
ServiceState ss = phone.getServiceState();
|
||||||
dataNetwork.setText(ServiceState.rilRadioTechnologyToString(
|
dataNetwork.setText(ServiceState.rilRadioTechnologyToString(
|
||||||
mPhone.getServiceState().getRilDataRadioTechnology()));
|
phone.getServiceState().getRilDataRadioTechnology()));
|
||||||
voiceNetwork.setText(ServiceState.rilRadioTechnologyToString(
|
voiceNetwork.setText(ServiceState.rilRadioTechnologyToString(
|
||||||
mPhone.getServiceState().getRilVoiceRadioTechnology()));
|
phone.getServiceState().getRilVoiceRadioTechnology()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1079,16 +1052,16 @@ public class RadioInfo extends Activity {
|
|||||||
String s;
|
String s;
|
||||||
Resources r = getResources();
|
Resources r = getResources();
|
||||||
|
|
||||||
s = mPhone.getDeviceId();
|
s = phone.getDeviceId();
|
||||||
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
||||||
mDeviceId.setText(s);
|
mDeviceId.setText(s);
|
||||||
|
|
||||||
s = mPhone.getSubscriberId();
|
s = phone.getSubscriberId();
|
||||||
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
||||||
mSubscriberId.setText(s);
|
mSubscriberId.setText(s);
|
||||||
|
|
||||||
//FIXME: Replace with a TelephonyManager call
|
//FIXME: Replace with a TelephonyManager call
|
||||||
s = mPhone.getLine1Number();
|
s = phone.getLine1Number();
|
||||||
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
if (s == null) s = r.getString(R.string.radioInfo_unknown);
|
||||||
number.setText(s);
|
number.setText(s);
|
||||||
}
|
}
|
||||||
@@ -1165,7 +1138,7 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
private void refreshSmsc() {
|
private void refreshSmsc() {
|
||||||
//FIXME: Replace with a TelephonyManager call
|
//FIXME: Replace with a TelephonyManager call
|
||||||
mPhone.getSmscAddress(mHandler.obtainMessage(EVENT_QUERY_SMSC_DONE));
|
phone.getSmscAddress(mHandler.obtainMessage(EVENT_QUERY_SMSC_DONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void updateAllCellInfo() {
|
private final void updateAllCellInfo() {
|
||||||
@@ -1237,7 +1210,8 @@ public class RadioInfo extends Activity {
|
|||||||
// the content provider, which causes it to be loaded in a process
|
// the content provider, which causes it to be loaded in a process
|
||||||
// other than the Dialer process, which causes a lot of stuff to
|
// other than the Dialer process, which causes a lot of stuff to
|
||||||
// break.
|
// break.
|
||||||
intent.setClassName("com.android.phone", "com.android.phone.SimContacts");
|
intent.setClassName("com.android.phone",
|
||||||
|
"com.android.phone.SimContacts");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1251,7 +1225,8 @@ public class RadioInfo extends Activity {
|
|||||||
// the content provider, which causes it to be loaded in a process
|
// the content provider, which causes it to be loaded in a process
|
||||||
// other than the Dialer process, which causes a lot of stuff to
|
// other than the Dialer process, which causes a lot of stuff to
|
||||||
// break.
|
// break.
|
||||||
intent.setClassName("com.android.phone", "com.android.phone.settings.fdn.FdnList");
|
intent.setClassName("com.android.phone",
|
||||||
|
"com.android.phone.settings.fdn.FdnList");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1266,7 +1241,8 @@ public class RadioInfo extends Activity {
|
|||||||
// the content provider, which causes it to be loaded in a process
|
// the content provider, which causes it to be loaded in a process
|
||||||
// other than the Dialer process, which causes a lot of stuff to
|
// other than the Dialer process, which causes a lot of stuff to
|
||||||
// break.
|
// break.
|
||||||
intent.setClassName("com.android.phone", "com.android.phone.ADNList");
|
intent.setClassName("com.android.phone",
|
||||||
|
"com.android.phone.ADNList");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1274,11 +1250,11 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
private MenuItem.OnMenuItemClickListener mGetImsStatus = new MenuItem.OnMenuItemClickListener() {
|
private MenuItem.OnMenuItemClickListener mGetImsStatus = new MenuItem.OnMenuItemClickListener() {
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
boolean isImsRegistered = mPhone.isImsRegistered();
|
boolean isImsRegistered = phone.isImsRegistered();
|
||||||
boolean availableVolte = mPhone.isVolteEnabled();
|
boolean availableVolte = phone.isVolteEnabled();
|
||||||
boolean availableWfc = mPhone.isWifiCallingEnabled();
|
boolean availableWfc = phone.isWifiCallingEnabled();
|
||||||
boolean availableVt = mPhone.isVideoEnabled();
|
boolean availableVt = phone.isVideoEnabled();
|
||||||
boolean availableUt = mPhone.isUtEnabled();
|
boolean availableUt = phone.isUtEnabled();
|
||||||
|
|
||||||
final String imsRegString = isImsRegistered ?
|
final String imsRegString = isImsRegistered ?
|
||||||
getString(R.string.radio_info_ims_reg_status_registered) :
|
getString(R.string.radio_info_ims_reg_status_registered) :
|
||||||
@@ -1335,7 +1311,7 @@ public class RadioInfo extends Activity {
|
|||||||
|
|
||||||
private boolean isRadioOn() {
|
private boolean isRadioOn() {
|
||||||
//FIXME: Replace with a TelephonyManager call
|
//FIXME: Replace with a TelephonyManager call
|
||||||
return mPhone.getServiceState().getState() != ServiceState.STATE_POWER_OFF;
|
return phone.getServiceState().getState() != ServiceState.STATE_POWER_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRadioPowerState() {
|
private void updateRadioPowerState() {
|
||||||
@@ -1367,7 +1343,7 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setImsConfigProvisionedState(int configItem, boolean state) {
|
void setImsConfigProvisionedState(int configItem, boolean state) {
|
||||||
if (mPhone != null && mImsManager != null) {
|
if (phone != null && mImsManager != null) {
|
||||||
QueuedWork.queue(new Runnable() {
|
QueuedWork.queue(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
@@ -1386,14 +1362,14 @@ public class RadioInfo extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
log("toggle radio power: currently " + (isRadioOn()?"on":"off"));
|
log("toggle radio power: currently " + (isRadioOn()?"on":"off"));
|
||||||
mPhone.setRadioPower(isChecked);
|
phone.setRadioPower(isChecked);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private boolean isImsVolteProvisioned() {
|
private boolean isImsVolteProvisioned() {
|
||||||
if (mPhone != null && mImsManager != null) {
|
if (phone != null && mImsManager != null) {
|
||||||
return mImsManager.isVolteEnabledByPlatform(mPhone.getContext())
|
return mImsManager.isVolteEnabledByPlatform(phone.getContext())
|
||||||
&& mImsManager.isVolteProvisionedOnDevice(mPhone.getContext());
|
&& mImsManager.isVolteProvisionedOnDevice(phone.getContext());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1406,9 +1382,9 @@ public class RadioInfo extends Activity {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private boolean isImsVtProvisioned() {
|
private boolean isImsVtProvisioned() {
|
||||||
if (mPhone != null && mImsManager != null) {
|
if (phone != null && mImsManager != null) {
|
||||||
return mImsManager.isVtEnabledByPlatform(mPhone.getContext())
|
return mImsManager.isVtEnabledByPlatform(phone.getContext())
|
||||||
&& mImsManager.isVtProvisionedOnDevice(mPhone.getContext());
|
&& mImsManager.isVtProvisionedOnDevice(phone.getContext());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1421,9 +1397,9 @@ public class RadioInfo extends Activity {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private boolean isImsWfcProvisioned() {
|
private boolean isImsWfcProvisioned() {
|
||||||
if (mPhone != null && mImsManager != null) {
|
if (phone != null && mImsManager != null) {
|
||||||
return mImsManager.isWfcEnabledByPlatform(mPhone.getContext())
|
return mImsManager.isWfcEnabledByPlatform(phone.getContext())
|
||||||
&& mImsManager.isWfcProvisionedOnDevice(mPhone.getContext());
|
&& mImsManager.isWfcProvisionedOnDevice(phone.getContext());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1478,7 +1454,7 @@ public class RadioInfo extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateImsProvisionedState() {
|
private void updateImsProvisionedState() {
|
||||||
if (!ImsManager.isImsSupportedOnDevice(mPhone.getContext())) {
|
if (!ImsManager.isImsSupportedOnDevice(phone.getContext())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log("updateImsProvisionedState isImsVolteProvisioned()=" + isImsVolteProvisioned());
|
log("updateImsProvisionedState isImsVolteProvisioned()=" + isImsVolteProvisioned());
|
||||||
@@ -1488,31 +1464,31 @@ public class RadioInfo extends Activity {
|
|||||||
imsVolteProvisionedSwitch.setChecked(isImsVolteProvisioned());
|
imsVolteProvisionedSwitch.setChecked(isImsVolteProvisioned());
|
||||||
imsVolteProvisionedSwitch.setOnCheckedChangeListener(mImsVolteCheckedChangeListener);
|
imsVolteProvisionedSwitch.setOnCheckedChangeListener(mImsVolteCheckedChangeListener);
|
||||||
imsVolteProvisionedSwitch.setEnabled(!Build.IS_USER
|
imsVolteProvisionedSwitch.setEnabled(!Build.IS_USER
|
||||||
&& mImsManager.isVolteEnabledByPlatform(mPhone.getContext()));
|
&& mImsManager.isVolteEnabledByPlatform(phone.getContext()));
|
||||||
|
|
||||||
imsVtProvisionedSwitch.setOnCheckedChangeListener(null);
|
imsVtProvisionedSwitch.setOnCheckedChangeListener(null);
|
||||||
imsVtProvisionedSwitch.setChecked(isImsVtProvisioned());
|
imsVtProvisionedSwitch.setChecked(isImsVtProvisioned());
|
||||||
imsVtProvisionedSwitch.setOnCheckedChangeListener(mImsVtCheckedChangeListener);
|
imsVtProvisionedSwitch.setOnCheckedChangeListener(mImsVtCheckedChangeListener);
|
||||||
imsVtProvisionedSwitch.setEnabled(!Build.IS_USER
|
imsVtProvisionedSwitch.setEnabled(!Build.IS_USER
|
||||||
&& mImsManager.isVtEnabledByPlatform(mPhone.getContext()));
|
&& mImsManager.isVtEnabledByPlatform(phone.getContext()));
|
||||||
|
|
||||||
imsWfcProvisionedSwitch.setOnCheckedChangeListener(null);
|
imsWfcProvisionedSwitch.setOnCheckedChangeListener(null);
|
||||||
imsWfcProvisionedSwitch.setChecked(isImsWfcProvisioned());
|
imsWfcProvisionedSwitch.setChecked(isImsWfcProvisioned());
|
||||||
imsWfcProvisionedSwitch.setOnCheckedChangeListener(mImsWfcCheckedChangeListener);
|
imsWfcProvisionedSwitch.setOnCheckedChangeListener(mImsWfcCheckedChangeListener);
|
||||||
imsWfcProvisionedSwitch.setEnabled(!Build.IS_USER
|
imsWfcProvisionedSwitch.setEnabled(!Build.IS_USER
|
||||||
&& mImsManager.isWfcEnabledByPlatform(mPhone.getContext()));
|
&& mImsManager.isWfcEnabledByPlatform(phone.getContext()));
|
||||||
|
|
||||||
eabProvisionedSwitch.setOnCheckedChangeListener(null);
|
eabProvisionedSwitch.setOnCheckedChangeListener(null);
|
||||||
eabProvisionedSwitch.setChecked(isEabProvisioned());
|
eabProvisionedSwitch.setChecked(isEabProvisioned());
|
||||||
eabProvisionedSwitch.setOnCheckedChangeListener(mEabCheckedChangeListener);
|
eabProvisionedSwitch.setOnCheckedChangeListener(mEabCheckedChangeListener);
|
||||||
eabProvisionedSwitch.setEnabled(!Build.IS_USER
|
eabProvisionedSwitch.setEnabled(!Build.IS_USER
|
||||||
&& isEabEnabledByPlatform(mPhone.getContext()));
|
&& isEabEnabledByPlatform(phone.getContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
OnClickListener mDnsCheckButtonHandler = new OnClickListener() {
|
OnClickListener mDnsCheckButtonHandler = new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
//FIXME: Replace with a TelephonyManager call
|
//FIXME: Replace with a TelephonyManager call
|
||||||
mPhone.disableDnsCheck(!mPhone.isDnsCheckDisabled());
|
phone.disableDnsCheck(!phone.isDnsCheckDisabled());
|
||||||
updateDnsCheckState();
|
updateDnsCheckState();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1539,7 +1515,7 @@ public class RadioInfo extends Activity {
|
|||||||
OnClickListener mUpdateSmscButtonHandler = new OnClickListener() {
|
OnClickListener mUpdateSmscButtonHandler = new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
updateSmscButton.setEnabled(false);
|
updateSmscButton.setEnabled(false);
|
||||||
mPhone.setSmscAddress(smsc.getText().toString(),
|
phone.setSmscAddress(smsc.getText().toString(),
|
||||||
mHandler.obtainMessage(EVENT_UPDATE_SMSC_DONE));
|
mHandler.obtainMessage(EVENT_UPDATE_SMSC_DONE));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1584,40 +1560,14 @@ public class RadioInfo extends Activity {
|
|||||||
// want this setting to be set, so that if the radio hiccups and this setting
|
// want this setting to be set, so that if the radio hiccups and this setting
|
||||||
// is for some reason unsuccessful, future calls to the radio will reflect
|
// is for some reason unsuccessful, future calls to the radio will reflect
|
||||||
// the users's preference which is set here.
|
// the users's preference which is set here.
|
||||||
final int subId = mPhone.getSubId();
|
final int subId = phone.getSubId();
|
||||||
if (SubscriptionManager.isUsableSubIdValue(subId)) {
|
if (SubscriptionManager.isUsableSubIdValue(subId)) {
|
||||||
Settings.Global.putInt(mPhone.getContext().getContentResolver(),
|
Settings.Global.putInt(phone.getContext().getContentResolver(),
|
||||||
PREFERRED_NETWORK_MODE + subId, mPreferredNetworkTypeResult);
|
PREFERRED_NETWORK_MODE + subId, mPreferredNetworkTypeResult);
|
||||||
}
|
}
|
||||||
log("Calling setPreferredNetworkType(" + mPreferredNetworkTypeResult + ")");
|
log("Calling setPreferredNetworkType(" + mPreferredNetworkTypeResult + ")");
|
||||||
Message msg = mHandler.obtainMessage(EVENT_SET_PREFERRED_TYPE_DONE);
|
Message msg = mHandler.obtainMessage(EVENT_SET_PREFERRED_TYPE_DONE);
|
||||||
mPhone.setPreferredNetworkType(mPreferredNetworkTypeResult, msg);
|
phone.setPreferredNetworkType(mPreferredNetworkTypeResult, msg);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNothingSelected(AdapterView parent) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AdapterView.OnItemSelectedListener mSelectPhoneIndexHandler =
|
|
||||||
new AdapterView.OnItemSelectedListener() {
|
|
||||||
|
|
||||||
public void onItemSelected(AdapterView parent, View v, int pos, long id) {
|
|
||||||
if (pos >= 0 && pos <= mPhoneIndexLabels.length - 1) {
|
|
||||||
// the array position is equal to the phone index
|
|
||||||
int phoneIndex = pos;
|
|
||||||
Phone[] phones = PhoneFactory.getPhones();
|
|
||||||
if (phones == null || phones.length <= phoneIndex) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// getSubId says it takes a slotIndex, but it actually takes a phone index
|
|
||||||
int[] subIds = SubscriptionManager.getSubId(phoneIndex);
|
|
||||||
if (subIds == null || subIds.length < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mSelectedPhoneIndex = phoneIndex;
|
|
||||||
|
|
||||||
updatePhoneIndex(phoneIndex, subIds[0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user