Add FW support for CellInfo RIL commands.

Add being able to setCellInfoListRate.

Bug: 8235566
Change-Id: I7ad7dabc4b6c38bfba4461b08e6e30d0eb9efea1
This commit is contained in:
Wink Saville
2013-04-05 15:04:05 -07:00
parent 645e78d806
commit bf4712895a
2 changed files with 57 additions and 15 deletions

View File

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

View File

@@ -116,6 +116,7 @@ public class RadioInfo extends Activity {
private TextView dnsCheckState; private TextView dnsCheckState;
private EditText smsc; private EditText smsc;
private Button radioPowerButton; private Button radioPowerButton;
private Button cellInfoListRateButton;
private Button dnsCheckToggleButton; private Button dnsCheckToggleButton;
private Button pingTestButton; private Button pingTestButton;
private Button updateSmscButton; private Button updateSmscButton;
@@ -167,9 +168,8 @@ public class RadioInfo extends Activity {
@Override @Override
public void onCellInfoChanged(List<CellInfo> arrayCi) { public void onCellInfoChanged(List<CellInfo> arrayCi) {
Log.d(TAG, "[RadioInfo] onCellInfoChanged: arrayCi=" + arrayCi); log("onCellInfoChanged: arrayCi=" + arrayCi);
mCellInfoValue = arrayCi; updateCellInfoTv(arrayCi);
updateCellInfoTv();
} }
}; };
@@ -195,7 +195,7 @@ public class RadioInfo extends Activity {
if (ar.exception == null) { if (ar.exception == null) {
int type = ((int[])ar.result)[0]; int type = ((int[])ar.result)[0];
if (type >= mPreferredNetworkLabels.length) { if (type >= mPreferredNetworkLabels.length) {
Log.e(TAG, "[RadioInfo] EVENT_QUERY_PREFERRED_TYPE_DONE: unknown " + log("EVENT_QUERY_PREFERRED_TYPE_DONE: unknown " +
"type=" + type); "type=" + type);
type = mPreferredNetworkLabels.length - 1; type = mPreferredNetworkLabels.length - 1;
} }
@@ -289,6 +289,9 @@ public class RadioInfo extends Activity {
radioPowerButton = (Button) findViewById(R.id.radio_power); radioPowerButton = (Button) findViewById(R.id.radio_power);
radioPowerButton.setOnClickListener(mPowerButtonHandler); radioPowerButton.setOnClickListener(mPowerButtonHandler);
cellInfoListRateButton = (Button) findViewById(R.id.cell_info_list_rate);
cellInfoListRateButton.setOnClickListener(mCellInfoListRateHandler);
imsRegRequiredButton = (Button) findViewById(R.id.ims_reg_required); imsRegRequiredButton = (Button) findViewById(R.id.ims_reg_required);
imsRegRequiredButton.setOnClickListener(mImsRegRequiredHandler); imsRegRequiredButton.setOnClickListener(mImsRegRequiredHandler);
@@ -330,7 +333,7 @@ public class RadioInfo extends Activity {
// Get current cell info // Get current cell info
mCellInfoValue = mTelephonyManager.getAllCellInfo(); mCellInfoValue = mTelephonyManager.getAllCellInfo();
Log.d(TAG, "[RadioInfo] onCreate: mCellInfoValue=" + mCellInfoValue); log("onCreate: mCellInfoValue=" + mCellInfoValue);
} }
@Override @Override
@@ -347,13 +350,14 @@ public class RadioInfo extends Activity {
updateDataStats(); updateDataStats();
updateDataStats2(); updateDataStats2();
updatePowerState(); updatePowerState();
updateCellInfoListRate();
updateImsRegRequiredState(); updateImsRegRequiredState();
updateSmsOverImsState(); updateSmsOverImsState();
updateLteRamDumpState(); updateLteRamDumpState();
updateProperties(); updateProperties();
updateDnsCheckState(); updateDnsCheckState();
Log.i(TAG, "[RadioInfo] onResume: register phone & data intents"); log("onResume: register phone & data intents");
mPhoneStateReceiver.registerIntent(); mPhoneStateReceiver.registerIntent();
mTelephonyManager.listen(mPhoneStateListener, mTelephonyManager.listen(mPhoneStateListener,
@@ -369,7 +373,7 @@ public class RadioInfo extends Activity {
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
Log.i(TAG, "[RadioInfo] onPause: unregister phone & data intents"); log("onPause: unregister phone & data intents");
mPhoneStateReceiver.unregisterIntent(); mPhoneStateReceiver.unregisterIntent();
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
@@ -427,6 +431,11 @@ public class RadioInfo extends Activity {
radioPowerButton.setText(buttonText); radioPowerButton.setText(buttonText);
} }
private void updateCellInfoListRate() {
cellInfoListRateButton.setText("CellInfoListRate " + mCellInfoListRateHandler.getRate());
updateCellInfoTv(mTelephonyManager.getAllCellInfo());
}
private void updateDnsCheckState() { private void updateDnsCheckState() {
dnsCheckState.setText(phone.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");
@@ -514,7 +523,8 @@ public class RadioInfo extends Activity {
mNeighboringCids.setText(sb.toString()); mNeighboringCids.setText(sb.toString());
} }
private final void updateCellInfoTv() { private final void updateCellInfoTv(List<CellInfo> arrayCi) {
mCellInfoValue = arrayCi;
StringBuilder value = new StringBuilder(); StringBuilder value = new StringBuilder();
if (mCellInfoValue != null) { if (mCellInfoValue != null) {
int index = 0; int index = 0;
@@ -918,12 +928,32 @@ public class RadioInfo extends Activity {
} }
}; };
class CellInfoListRateHandler implements OnClickListener {
int rates[] = {Integer.MAX_VALUE, 0, 1000};
int index = 0;
public int getRate() {
return rates[index];
}
@Override
public void onClick(View v) {
index += 1;
if (index >= rates.length) {
index = 0;
}
phone.setCellInfoListRate(rates[index]);
updateCellInfoListRate();
}
}
CellInfoListRateHandler mCellInfoListRateHandler = new CellInfoListRateHandler();
private Button imsRegRequiredButton; private Button imsRegRequiredButton;
static final String PROPERTY_IMS_REG_REQUIRED = "persist.radio.imsregrequired"; static final String PROPERTY_IMS_REG_REQUIRED = "persist.radio.imsregrequired";
OnClickListener mImsRegRequiredHandler = new OnClickListener() { OnClickListener mImsRegRequiredHandler = new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Log.d(TAG, String.format("toggle %s: currently %s", log(String.format("toggle %s: currently %s",
PROPERTY_IMS_REG_REQUIRED, (isImsRegRequired() ? "on":"off"))); PROPERTY_IMS_REG_REQUIRED, (isImsRegRequired() ? "on":"off")));
boolean newValue = !isImsRegRequired(); boolean newValue = !isImsRegRequired();
SystemProperties.set(PROPERTY_IMS_REG_REQUIRED, SystemProperties.set(PROPERTY_IMS_REG_REQUIRED,
@@ -937,7 +967,7 @@ public class RadioInfo extends Activity {
} }
private void updateImsRegRequiredState() { private void updateImsRegRequiredState() {
Log.d(TAG, "updateImsRegRequiredState isImsRegRequired()=" + isImsRegRequired()); log("updateImsRegRequiredState isImsRegRequired()=" + isImsRegRequired());
String buttonText = isImsRegRequired() ? String buttonText = isImsRegRequired() ?
getString(R.string.ims_reg_required_off) : getString(R.string.ims_reg_required_off) :
getString(R.string.ims_reg_required_on); getString(R.string.ims_reg_required_on);
@@ -949,7 +979,7 @@ public class RadioInfo extends Activity {
OnClickListener mSmsOverImsHandler = new OnClickListener() { OnClickListener mSmsOverImsHandler = new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Log.d(TAG, String.format("toggle %s: currently %s", log(String.format("toggle %s: currently %s",
PROPERTY_SMS_OVER_IMS, (isSmsOverImsEnabled() ? "on":"off"))); PROPERTY_SMS_OVER_IMS, (isSmsOverImsEnabled() ? "on":"off")));
boolean newValue = !isSmsOverImsEnabled(); boolean newValue = !isSmsOverImsEnabled();
SystemProperties.set(PROPERTY_SMS_OVER_IMS, newValue ? "1":"0"); SystemProperties.set(PROPERTY_SMS_OVER_IMS, newValue ? "1":"0");
@@ -962,7 +992,7 @@ public class RadioInfo extends Activity {
} }
private void updateSmsOverImsState() { private void updateSmsOverImsState() {
Log.d(TAG, "updateSmsOverImsState isSmsOverImsEnabled()=" + isSmsOverImsEnabled()); log("updateSmsOverImsState isSmsOverImsEnabled()=" + isSmsOverImsEnabled());
String buttonText = isSmsOverImsEnabled() ? String buttonText = isSmsOverImsEnabled() ?
getString(R.string.sms_over_ims_off) : getString(R.string.sms_over_ims_off) :
getString(R.string.sms_over_ims_on); getString(R.string.sms_over_ims_on);
@@ -974,7 +1004,7 @@ public class RadioInfo extends Activity {
OnClickListener mLteRamDumpHandler = new OnClickListener() { OnClickListener mLteRamDumpHandler = new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Log.d(TAG, String.format("toggle %s: currently %s", log(String.format("toggle %s: currently %s",
PROPERTY_LTE_RAM_DUMP, (isSmsOverImsEnabled() ? "on":"off"))); PROPERTY_LTE_RAM_DUMP, (isSmsOverImsEnabled() ? "on":"off")));
boolean newValue = !isLteRamDumpEnabled(); boolean newValue = !isLteRamDumpEnabled();
SystemProperties.set(PROPERTY_LTE_RAM_DUMP, newValue ? "1":"0"); SystemProperties.set(PROPERTY_LTE_RAM_DUMP, newValue ? "1":"0");
@@ -987,7 +1017,7 @@ public class RadioInfo extends Activity {
} }
private void updateLteRamDumpState() { private void updateLteRamDumpState() {
Log.d(TAG, "updateLteRamDumpState isLteRamDumpEnabled()=" + isLteRamDumpEnabled()); log("updateLteRamDumpState isLteRamDumpEnabled()=" + isLteRamDumpEnabled());
String buttonText = isLteRamDumpEnabled() ? String buttonText = isLteRamDumpEnabled() ?
getString(R.string.lte_ram_dump_off) : getString(R.string.lte_ram_dump_off) :
getString(R.string.lte_ram_dump_on); getString(R.string.lte_ram_dump_on);
@@ -1007,7 +1037,7 @@ public class RadioInfo extends Activity {
try { try {
startActivity(intent); startActivity(intent);
} catch (android.content.ActivityNotFoundException ex) { } catch (android.content.ActivityNotFoundException ex) {
Log.d(TAG, "OEM-specific Info/Settings Activity Not Found : " + ex); log("OEM-specific Info/Settings Activity Not Found : " + ex);
// If the activity does not exist, there are no OEM // If the activity does not exist, there are no OEM
// settings, and so we can just do nothing... // settings, and so we can just do nothing...
} }
@@ -1061,4 +1091,8 @@ public class RadioInfo extends Activity {
"LTE/GSM/CDMA auto (PRL)", "LTE/GSM/CDMA auto (PRL)",
"LTE only", "LTE only",
"Unknown"}; "Unknown"};
private void log(String s) {
Log.d(TAG, "[RadioInfo] " + s);
}
} }