Allow view/update EAB Provisioning status

Bug: 37433707
Test: make
Change-Id: I8cafe72015a9d80c3711b7cf472ae8fadcfd8170
This commit is contained in:
Meng Wang
2017-04-26 15:02:51 -07:00
parent 10ad029318
commit 586741cc15
3 changed files with 71 additions and 0 deletions

View File

@@ -206,6 +206,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wfc_provisioned_switch_string"/> android:text="@string/wfc_provisioned_switch_string"/>
<!-- EAB/Presence provisioned -->
<Switch android:id="@+id/eab_provisioned_switch"
android:textSize="14sp"
android:layout_marginTop="8dip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/eab_provisioned_switch_string"/>
<!-- SMSC --> <!-- SMSC -->
<RelativeLayout android:layout_width="match_parent" <RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">

View File

@@ -71,6 +71,9 @@
<!-- Wifi Calling provisioning flag on. Only shown in diagnostic screen, so precise translation is not needed. --> <!-- Wifi Calling provisioning flag on. Only shown in diagnostic screen, so precise translation is not needed. -->
<string name="wfc_provisioned_switch_string">Wifi Calling Provisioned</string> <string name="wfc_provisioned_switch_string">Wifi Calling Provisioned</string>
<!-- EAB provisioning flag on. Only shown in diagnostic screen, so precise translation is not needed. -->
<string name="eab_provisioned_switch_string">EAB/Presence Provisioned</string>
<!-- Title for controlling on/off for Mobile phone's radio power. Only shown in diagnostic screen, so precise translation is not needed. --> <!-- Title for controlling on/off for Mobile phone's radio power. Only shown in diagnostic screen, so precise translation is not needed. -->
<string name="radio_info_radio_power">Mobile Radio Power</string> <string name="radio_info_radio_power">Mobile Radio Power</string>

View File

@@ -21,6 +21,7 @@ import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.QueuedWork; import android.app.QueuedWork;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
@@ -32,6 +33,7 @@ import android.os.AsyncResult;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.telephony.CarrierConfigManager;
import android.telephony.CellInfo; import android.telephony.CellInfo;
import android.telephony.CellInfoCdma; import android.telephony.CellInfoCdma;
import android.telephony.CellInfoGsm; import android.telephony.CellInfoGsm;
@@ -130,6 +132,9 @@ public class RadioInfo extends Activity {
private static final int IMS_WFC_PROVISIONED_CONFIG_ID = private static final int IMS_WFC_PROVISIONED_CONFIG_ID =
ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED; ImsConfig.ConfigConstants.VOICE_OVER_WIFI_SETTING_ENABLED;
private static final int EAB_PROVISIONED_CONFIG_ID =
ImsConfig.ConfigConstants.EAB_SETTING_ENABLED;
//Values in must match mCellInfoRefreshRates //Values in must match mCellInfoRefreshRates
private static final String[] mCellInfoRefreshRateLabels = { private static final String[] mCellInfoRefreshRateLabels = {
"Disabled", "Disabled",
@@ -201,6 +206,7 @@ public class RadioInfo extends Activity {
private Switch imsVolteProvisionedSwitch; private Switch imsVolteProvisionedSwitch;
private Switch imsVtProvisionedSwitch; private Switch imsVtProvisionedSwitch;
private Switch imsWfcProvisionedSwitch; private Switch imsWfcProvisionedSwitch;
private Switch eabProvisionedSwitch;
private Spinner preferredNetworkType; private Spinner preferredNetworkType;
private Spinner cellInfoRefreshRateSpinner; private Spinner cellInfoRefreshRateSpinner;
@@ -406,6 +412,7 @@ public class RadioInfo extends Activity {
imsVolteProvisionedSwitch = (Switch) findViewById(R.id.volte_provisioned_switch); imsVolteProvisionedSwitch = (Switch) findViewById(R.id.volte_provisioned_switch);
imsVtProvisionedSwitch = (Switch) findViewById(R.id.vt_provisioned_switch); imsVtProvisionedSwitch = (Switch) findViewById(R.id.vt_provisioned_switch);
imsWfcProvisionedSwitch = (Switch) findViewById(R.id.wfc_provisioned_switch); imsWfcProvisionedSwitch = (Switch) findViewById(R.id.wfc_provisioned_switch);
eabProvisionedSwitch = (Switch) findViewById(R.id.wfc_provisioned_switch);
radioPowerOnSwitch = (Switch) findViewById(R.id.radio_power); radioPowerOnSwitch = (Switch) findViewById(R.id.radio_power);
@@ -478,6 +485,7 @@ public class RadioInfo extends Activity {
imsVolteProvisionedSwitch.setOnCheckedChangeListener(mImsVolteCheckedChangeListener); imsVolteProvisionedSwitch.setOnCheckedChangeListener(mImsVolteCheckedChangeListener);
imsVtProvisionedSwitch.setOnCheckedChangeListener(mImsVtCheckedChangeListener); imsVtProvisionedSwitch.setOnCheckedChangeListener(mImsVtCheckedChangeListener);
imsWfcProvisionedSwitch.setOnCheckedChangeListener(mImsWfcCheckedChangeListener); imsWfcProvisionedSwitch.setOnCheckedChangeListener(mImsWfcCheckedChangeListener);
eabProvisionedSwitch.setOnCheckedChangeListener(mEabCheckedChangeListener);
mTelephonyManager.listen(mPhoneStateListener, mTelephonyManager.listen(mPhoneStateListener,
PhoneStateListener.LISTEN_CALL_STATE PhoneStateListener.LISTEN_CALL_STATE
@@ -1170,6 +1178,11 @@ public class RadioInfo extends Activity {
setImsConfigProvisionedState(IMS_WFC_PROVISIONED_CONFIG_ID, state); setImsConfigProvisionedState(IMS_WFC_PROVISIONED_CONFIG_ID, state);
} }
void setEabProvisionedState(boolean state) {
Log.d(TAG, "setEabProvisioned() state: " + ((state)? "on":"off"));
setImsConfigProvisionedState(EAB_PROVISIONED_CONFIG_ID, state);
}
void setImsConfigProvisionedState(int configItem, boolean state) { void setImsConfigProvisionedState(int configItem, boolean state) {
if (phone != null && mImsManager != null) { if (phone != null && mImsManager != null) {
QueuedWork.queue(new Runnable() { QueuedWork.queue(new Runnable() {
@@ -1239,6 +1252,48 @@ public class RadioInfo extends Activity {
} }
}; };
private boolean isEabProvisioned() {
return isFeatureProvisioned(EAB_PROVISIONED_CONFIG_ID, false);
}
OnCheckedChangeListener mEabCheckedChangeListener = new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
setEabProvisionedState(isChecked);
}
};
private boolean isFeatureProvisioned(int featureId, boolean defaultValue) {
boolean provisioned = defaultValue;
if (mImsManager != null) {
try {
ImsConfig imsConfig = mImsManager.getConfigInterface();
if (imsConfig != null) {
provisioned =
(imsConfig.getProvisionedValue(featureId)
== ImsConfig.FeatureValueConstants.ON);
}
} catch (ImsException ex) {
Log.e(TAG, "isFeatureProvisioned() exception:", ex);
}
}
log("isFeatureProvisioned() featureId=" + featureId + " provisioned=" + provisioned);
return provisioned;
}
private static boolean isEabEnabledByPlatform(Context context) {
if (context != null) {
CarrierConfigManager configManager = (CarrierConfigManager)
context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
if (configManager != null && configManager.getConfig().getBoolean(
CarrierConfigManager.KEY_USE_RCS_PRESENCE_BOOL)) {
return true;
}
}
return false;
}
private void updateImsProvisionedState() { private void updateImsProvisionedState() {
log("updateImsProvisionedState isImsVolteProvisioned()=" + isImsVolteProvisioned()); log("updateImsProvisionedState isImsVolteProvisioned()=" + isImsVolteProvisioned());
//delightful hack to prevent on-checked-changed calls from //delightful hack to prevent on-checked-changed calls from
@@ -1260,6 +1315,11 @@ public class RadioInfo extends Activity {
imsWfcProvisionedSwitch.setOnCheckedChangeListener(mImsWfcCheckedChangeListener); imsWfcProvisionedSwitch.setOnCheckedChangeListener(mImsWfcCheckedChangeListener);
imsWfcProvisionedSwitch.setEnabled( imsWfcProvisionedSwitch.setEnabled(
mImsManager.isWfcEnabledByPlatform(phone.getContext())); mImsManager.isWfcEnabledByPlatform(phone.getContext()));
eabProvisionedSwitch.setOnCheckedChangeListener(null);
eabProvisionedSwitch.setChecked(isEabProvisioned());
eabProvisionedSwitch.setOnCheckedChangeListener(mEabCheckedChangeListener);
eabProvisionedSwitch.setEnabled(isEabEnabledByPlatform(phone.getContext()));
} }
OnClickListener mDnsCheckButtonHandler = new OnClickListener() { OnClickListener mDnsCheckButtonHandler = new OnClickListener() {