diff --git a/res/layout/radio_info.xml b/res/layout/radio_info.xml index 8888a98f103..eeb46a03129 100644 --- a/res/layout/radio_info.xml +++ b/res/layout/radio_info.xml @@ -203,6 +203,14 @@ android:layout_height="wrap_content" /> + + + arrayCi) { - Log.d(TAG, "[RadioInfo] onCellInfoChanged: arrayCi=" + arrayCi); - mCellInfoValue = arrayCi; - updateCellInfoTv(); + log("onCellInfoChanged: arrayCi=" + arrayCi); + updateCellInfoTv(arrayCi); } }; @@ -195,7 +195,7 @@ public class RadioInfo extends Activity { if (ar.exception == null) { int type = ((int[])ar.result)[0]; if (type >= mPreferredNetworkLabels.length) { - Log.e(TAG, "[RadioInfo] EVENT_QUERY_PREFERRED_TYPE_DONE: unknown " + + log("EVENT_QUERY_PREFERRED_TYPE_DONE: unknown " + "type=" + type); type = mPreferredNetworkLabels.length - 1; } @@ -289,6 +289,9 @@ public class RadioInfo extends Activity { radioPowerButton = (Button) findViewById(R.id.radio_power); radioPowerButton.setOnClickListener(mPowerButtonHandler); + cellInfoListRateButton = (Button) findViewById(R.id.cell_info_list_rate); + cellInfoListRateButton.setOnClickListener(mCellInfoListRateHandler); + imsRegRequiredButton = (Button) findViewById(R.id.ims_reg_required); imsRegRequiredButton.setOnClickListener(mImsRegRequiredHandler); @@ -330,7 +333,7 @@ public class RadioInfo extends Activity { // Get current cell info mCellInfoValue = mTelephonyManager.getAllCellInfo(); - Log.d(TAG, "[RadioInfo] onCreate: mCellInfoValue=" + mCellInfoValue); + log("onCreate: mCellInfoValue=" + mCellInfoValue); } @Override @@ -347,13 +350,14 @@ public class RadioInfo extends Activity { updateDataStats(); updateDataStats2(); updatePowerState(); + updateCellInfoListRate(); updateImsRegRequiredState(); updateSmsOverImsState(); updateLteRamDumpState(); updateProperties(); updateDnsCheckState(); - Log.i(TAG, "[RadioInfo] onResume: register phone & data intents"); + log("onResume: register phone & data intents"); mPhoneStateReceiver.registerIntent(); mTelephonyManager.listen(mPhoneStateListener, @@ -369,7 +373,7 @@ public class RadioInfo extends Activity { public void onPause() { super.onPause(); - Log.i(TAG, "[RadioInfo] onPause: unregister phone & data intents"); + log("onPause: unregister phone & data intents"); mPhoneStateReceiver.unregisterIntent(); mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); @@ -427,6 +431,11 @@ public class RadioInfo extends Activity { radioPowerButton.setText(buttonText); } + private void updateCellInfoListRate() { + cellInfoListRateButton.setText("CellInfoListRate " + mCellInfoListRateHandler.getRate()); + updateCellInfoTv(mTelephonyManager.getAllCellInfo()); + } + private void updateDnsCheckState() { dnsCheckState.setText(phone.isDnsCheckDisabled() ? "0.0.0.0 allowed" :"0.0.0.0 not allowed"); @@ -514,7 +523,8 @@ public class RadioInfo extends Activity { mNeighboringCids.setText(sb.toString()); } - private final void updateCellInfoTv() { + private final void updateCellInfoTv(List arrayCi) { + mCellInfoValue = arrayCi; StringBuilder value = new StringBuilder(); if (mCellInfoValue != null) { 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; static final String PROPERTY_IMS_REG_REQUIRED = "persist.radio.imsregrequired"; OnClickListener mImsRegRequiredHandler = new OnClickListener() { @Override 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"))); boolean newValue = !isImsRegRequired(); SystemProperties.set(PROPERTY_IMS_REG_REQUIRED, @@ -937,7 +967,7 @@ public class RadioInfo extends Activity { } private void updateImsRegRequiredState() { - Log.d(TAG, "updateImsRegRequiredState isImsRegRequired()=" + isImsRegRequired()); + log("updateImsRegRequiredState isImsRegRequired()=" + isImsRegRequired()); String buttonText = isImsRegRequired() ? getString(R.string.ims_reg_required_off) : getString(R.string.ims_reg_required_on); @@ -949,7 +979,7 @@ public class RadioInfo extends Activity { OnClickListener mSmsOverImsHandler = new OnClickListener() { @Override 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"))); boolean newValue = !isSmsOverImsEnabled(); SystemProperties.set(PROPERTY_SMS_OVER_IMS, newValue ? "1":"0"); @@ -962,7 +992,7 @@ public class RadioInfo extends Activity { } private void updateSmsOverImsState() { - Log.d(TAG, "updateSmsOverImsState isSmsOverImsEnabled()=" + isSmsOverImsEnabled()); + log("updateSmsOverImsState isSmsOverImsEnabled()=" + isSmsOverImsEnabled()); String buttonText = isSmsOverImsEnabled() ? getString(R.string.sms_over_ims_off) : getString(R.string.sms_over_ims_on); @@ -974,7 +1004,7 @@ public class RadioInfo extends Activity { OnClickListener mLteRamDumpHandler = new OnClickListener() { @Override 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"))); boolean newValue = !isLteRamDumpEnabled(); SystemProperties.set(PROPERTY_LTE_RAM_DUMP, newValue ? "1":"0"); @@ -987,7 +1017,7 @@ public class RadioInfo extends Activity { } private void updateLteRamDumpState() { - Log.d(TAG, "updateLteRamDumpState isLteRamDumpEnabled()=" + isLteRamDumpEnabled()); + log("updateLteRamDumpState isLteRamDumpEnabled()=" + isLteRamDumpEnabled()); String buttonText = isLteRamDumpEnabled() ? getString(R.string.lte_ram_dump_off) : getString(R.string.lte_ram_dump_on); @@ -1007,7 +1037,7 @@ public class RadioInfo extends Activity { try { startActivity(intent); } 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 // settings, and so we can just do nothing... } @@ -1061,4 +1091,8 @@ public class RadioInfo extends Activity { "LTE/GSM/CDMA auto (PRL)", "LTE only", "Unknown"}; + + private void log(String s) { + Log.d(TAG, "[RadioInfo] " + s); + } }