Add Button to *#*#INFO#*#* for ims registration.

For testing add a button to toggle SystemProperty
persist.radio.imsregrequired

Bug: 5337311
Change-Id: Id2d8ffa4c67992245d80b0ccafb6ed719fa749cc
This commit is contained in:
Wink Saville
2011-09-19 14:24:39 -07:00
parent 2ae885210e
commit 1e596f3035
3 changed files with 44 additions and 0 deletions

View File

@@ -196,6 +196,14 @@
android:layout_height="wrap_content"
/>
<!-- IMS registration required -->
<Button android:id="@+id/ims_reg_required"
android:textSize="14sp"
android:layout_marginTop="8dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<!-- SMSC -->
<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content">

View File

@@ -40,6 +40,12 @@
<!-- Phone Info screen. Button label to turn off the radio . Only shown in diagnostic screen, so precise translation is not needed. -->
<string name="turn_off_radio">Turn off radio</string>
<!-- Phone info -->
<!-- Phone IMS registration required on. Only shown in diagnostic screen, so precise translation is not needed. -->
<string name="ims_reg_required_on">Turn on IMS registration required</string>
<!-- Phone IMS registration required off. Only shown in diagnostic screen, so precise translation is not needed. -->
<string name="ims_reg_required_off">Turn off IMS registration required</string>
<!-- Phone Info screen. Menu item label. Used for diagnostic info screens, precise translation isn't needed -->
<string name="radioInfo_menu_viewADN">View SIM address book</string>
<!-- Phone Info screen. Menu item label. Used for diagnostic info screens, precise translation isn't needed -->

View File

@@ -123,6 +123,7 @@ public class RadioInfo extends Activity {
private TextView dnsCheckState;
private EditText smsc;
private Button radioPowerButton;
private Button imsRegRequiredButton;
private Button dnsCheckToggleButton;
private Button pingTestButton;
private Button updateSmscButton;
@@ -282,6 +283,9 @@ public class RadioInfo extends Activity {
radioPowerButton = (Button) findViewById(R.id.radio_power);
radioPowerButton.setOnClickListener(mPowerButtonHandler);
imsRegRequiredButton = (Button) findViewById(R.id.ims_reg_required);
imsRegRequiredButton.setOnClickListener(mImsRegRequiredHandler);
pingTestButton = (Button) findViewById(R.id.ping_test);
pingTestButton.setOnClickListener(mPingButtonHandler);
updateSmscButton = (Button) findViewById(R.id.update_smsc);
@@ -327,6 +331,7 @@ public class RadioInfo extends Activity {
updateDataStats();
updateDataStats2();
updatePowerState();
updateImsRegRequiredState();
updateProperties();
updateDnsCheckState();
@@ -403,6 +408,19 @@ public class RadioInfo extends Activity {
radioPowerButton.setText(buttonText);
}
private boolean isImsRegRequired() {
return SystemProperties.getBoolean(TelephonyProperties.PROPERTY_IMS_REG_REQUIRED, false);
}
private void updateImsRegRequiredState() {
Log.d(TAG, "updateImsRegRequiredState isImsRegRequired()=" + isImsRegRequired());
String buttonText = isImsRegRequired() ?
getString(R.string.ims_reg_required_off) :
getString(R.string.ims_reg_required_on);
imsRegRequiredButton.setText(buttonText);
}
private void updateDnsCheckState() {
dnsCheckState.setText(phone.isDnsCheckDisabled() ?
"0.0.0.0 allowed" :"0.0.0.0 not allowed");
@@ -877,6 +895,18 @@ public class RadioInfo extends Activity {
}
};
OnClickListener mImsRegRequiredHandler = new OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, String.format("toggle %s: currently %s",
TelephonyProperties.PROPERTY_IMS_REG_REQUIRED, (isImsRegRequired() ? "on":"off")));
boolean newValue = !isImsRegRequired();
SystemProperties.set(TelephonyProperties.PROPERTY_IMS_REG_REQUIRED,
newValue ? "1":"0");
updateImsRegRequiredState();
}
};
OnClickListener mDnsCheckButtonHandler = new OnClickListener() {
public void onClick(View v) {
phone.disableDnsCheck(!phone.isDnsCheckDisabled());