Test getAllCellInfo and onCellInfoChanged.

Change-Id: I20164d6bb9edb2ecf178b4533a39e885773d7b22
This commit is contained in:
Wink Saville
2012-06-01 14:37:21 -07:00
parent f6941bdc63
commit 79bff2a254
3 changed files with 43 additions and 1 deletions

View File

@@ -84,6 +84,13 @@
<TextView android:id="@+id/neighboring" style="@style/info_value" /> <TextView android:id="@+id/neighboring" style="@style/info_value" />
</LinearLayout> </LinearLayout>
<!-- CellInfo -->
<LinearLayout style="@style/entry_layout">
<TextView android:text="@string/radio_info_cellinfo_label"
style="@style/info_label" />
<TextView android:id="@+id/cellinfo" style="@style/info_value" />
</LinearLayout>
<!-- Roaming --> <!-- Roaming -->
<LinearLayout style="@style/entry_layout"> <LinearLayout style="@style/entry_layout">
<TextView android:text="@string/radio_info_roaming_label" style="@style/info_label" /> <TextView android:text="@string/radio_info_roaming_label" style="@style/info_label" />

View File

@@ -420,6 +420,8 @@
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed --> <!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="radio_info_neighboring_location_label">Neighboring CID:</string> <string name="radio_info_neighboring_location_label">Neighboring CID:</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed --> <!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="radio_info_cellinfo_label">CellInfo:</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="radio_info_data_attempts_label">Data attempts:</string> <string name="radio_info_data_attempts_label">Data attempts:</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed --> <!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->

View File

@@ -33,6 +33,7 @@ import android.os.Message;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.telephony.CellInfo;
import android.telephony.CellLocation; import android.telephony.CellLocation;
import android.telephony.PhoneStateListener; import android.telephony.PhoneStateListener;
import android.telephony.ServiceState; import android.telephony.ServiceState;
@@ -111,6 +112,7 @@ public class RadioInfo extends Activity {
private TextView mCfi; private TextView mCfi;
private TextView mLocation; private TextView mLocation;
private TextView mNeighboringCids; private TextView mNeighboringCids;
private TextView mCellInfo;
private TextView resets; private TextView resets;
private TextView attempts; private TextView attempts;
private TextView successes; private TextView successes;
@@ -140,6 +142,7 @@ public class RadioInfo extends Activity {
private String mHttpClientTestResult; private String mHttpClientTestResult;
private boolean mMwiValue = false; private boolean mMwiValue = false;
private boolean mCfiValue = false; private boolean mCfiValue = false;
private List<CellInfo> mCellInfoValue;
private PhoneStateListener mPhoneStateListener = new PhoneStateListener() { private PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
@Override @Override
@@ -171,6 +174,13 @@ public class RadioInfo extends Activity {
mCfiValue = cfi; mCfiValue = cfi;
updateCallRedirect(); updateCallRedirect();
} }
@Override
public void onCellInfoChanged(List<CellInfo> arrayCi) {
Log.d(TAG, "[RadioInfo] onCellInfoChanged: arrayCi=" + arrayCi);
mCellInfoValue = arrayCi;
updateCellInfoTv();
}
}; };
private Handler mHandler = new Handler() { private Handler mHandler = new Handler() {
@@ -263,6 +273,7 @@ public class RadioInfo extends Activity {
mCfi = (TextView) findViewById(R.id.cfi); mCfi = (TextView) findViewById(R.id.cfi);
mLocation = (TextView) findViewById(R.id.location); mLocation = (TextView) findViewById(R.id.location);
mNeighboringCids = (TextView) findViewById(R.id.neighboring); mNeighboringCids = (TextView) findViewById(R.id.neighboring);
mCellInfo = (TextView) findViewById(R.id.cellinfo);
resets = (TextView) findViewById(R.id.resets); resets = (TextView) findViewById(R.id.resets);
attempts = (TextView) findViewById(R.id.attempts); attempts = (TextView) findViewById(R.id.attempts);
@@ -326,6 +337,10 @@ public class RadioInfo extends Activity {
mHandler.obtainMessage(EVENT_QUERY_NEIGHBORING_CIDS_DONE)); mHandler.obtainMessage(EVENT_QUERY_NEIGHBORING_CIDS_DONE));
CellLocation.requestLocationUpdate(); CellLocation.requestLocationUpdate();
// Get current cell info
mCellInfoValue = mTelephonyManager.getAllCellInfo();
Log.d(TAG, "[RadioInfo] onCreate: mCellInfoValue=" + mCellInfoValue);
} }
@Override @Override
@@ -356,7 +371,8 @@ public class RadioInfo extends Activity {
| PhoneStateListener.LISTEN_DATA_ACTIVITY | PhoneStateListener.LISTEN_DATA_ACTIVITY
| PhoneStateListener.LISTEN_CELL_LOCATION | PhoneStateListener.LISTEN_CELL_LOCATION
| PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR | PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR
| PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR); | PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR
| PhoneStateListener.LISTEN_CELL_INFO);
} }
@Override @Override
@@ -508,6 +524,23 @@ public class RadioInfo extends Activity {
mNeighboringCids.setText(sb.toString()); mNeighboringCids.setText(sb.toString());
} }
private final void updateCellInfoTv() {
StringBuilder value = new StringBuilder();
if (mCellInfoValue != null) {
int index = 0;
for (CellInfo ci : mCellInfoValue) {
value.append('[');
value.append(index);
value.append("]=");
value.append(ci.toString());
if (++index < mCellInfoValue.size()) {
value.append("\n");
}
}
}
mCellInfo.setText(value.toString());
}
private final void private final void
updateMessageWaiting() { updateMessageWaiting() {
mMwi.setText(String.valueOf(mMwiValue)); mMwi.setText(String.valueOf(mMwiValue));