[Telephony Debug Menu] LTE BW and Serving CellInfo

Add debug menu support for the serving cell status
indication and the LTE bandwidth in the CellInfo
display.

Bug: 78791811
Test: manual
Change-Id: Ic51858131af671317431e0970bdcaeebcb460931
This commit is contained in:
Nathan Harold
2018-04-17 17:01:32 -07:00
parent a0f9241400
commit 6e16fdf399

View File

@@ -58,6 +58,7 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.telephony.cdma.CdmaCellLocation; import android.telephony.cdma.CdmaCellLocation;
import android.telephony.gsm.GsmCellLocation; import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@@ -673,12 +674,34 @@ public class RadioInfo extends Activity {
return (i != Long.MAX_VALUE) ? Long.toString(i) : ""; return (i != Long.MAX_VALUE) ? Long.toString(i) : "";
} }
private final String getConnectionStatusString(CellInfo ci) {
String regStr = "";
String connStatStr = "";
String connector = "";
if (ci.isRegistered()) {
regStr = "R";
}
switch (ci.getCellConnectionStatus()) {
case CellInfo.CONNECTION_PRIMARY_SERVING: connStatStr = "P"; break;
case CellInfo.CONNECTION_SECONDARY_SERVING: connStatStr = "S"; break;
case CellInfo.CONNECTION_NONE: connStatStr = "N"; break;
case CellInfo.CONNECTION_UNKNOWN: /* Field is unsupported */ break;
default: break;
}
if (!TextUtils.isEmpty(regStr) && !TextUtils.isEmpty(connStatStr)) {
connector = "+";
}
return regStr + connector + connStatStr;
}
private final String buildCdmaInfoString(CellInfoCdma ci) { private final String buildCdmaInfoString(CellInfoCdma ci) {
CellIdentityCdma cidCdma = ci.getCellIdentity(); CellIdentityCdma cidCdma = ci.getCellIdentity();
CellSignalStrengthCdma ssCdma = ci.getCellSignalStrength(); CellSignalStrengthCdma ssCdma = ci.getCellSignalStrength();
return String.format("%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s", return String.format("%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s",
ci.isRegistered() ? "S " : " ", getConnectionStatusString(ci),
getCellInfoDisplayString(cidCdma.getSystemId()), getCellInfoDisplayString(cidCdma.getSystemId()),
getCellInfoDisplayString(cidCdma.getNetworkId()), getCellInfoDisplayString(cidCdma.getNetworkId()),
getCellInfoDisplayString(cidCdma.getBasestationId()), getCellInfoDisplayString(cidCdma.getBasestationId()),
@@ -694,7 +717,7 @@ public class RadioInfo extends Activity {
CellSignalStrengthGsm ssGsm = ci.getCellSignalStrength(); CellSignalStrengthGsm ssGsm = ci.getCellSignalStrength();
return String.format("%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n", return String.format("%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n",
ci.isRegistered() ? "S " : " ", getConnectionStatusString(ci),
getCellInfoDisplayString(cidGsm.getMcc()), getCellInfoDisplayString(cidGsm.getMcc()),
getCellInfoDisplayString(cidGsm.getMnc()), getCellInfoDisplayString(cidGsm.getMnc()),
getCellInfoDisplayString(cidGsm.getLac()), getCellInfoDisplayString(cidGsm.getLac()),
@@ -709,14 +732,15 @@ public class RadioInfo extends Activity {
CellSignalStrengthLte ssLte = ci.getCellSignalStrength(); CellSignalStrengthLte ssLte = ci.getCellSignalStrength();
return String.format( return String.format(
"%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-6.6s %-4.4s %-4.4s %-2.2s\n", "%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-6.6s %-2.2s %-4.4s %-4.4s %-2.2s\n",
ci.isRegistered() ? "S " : " ", getConnectionStatusString(ci),
getCellInfoDisplayString(cidLte.getMcc()), getCellInfoDisplayString(cidLte.getMcc()),
getCellInfoDisplayString(cidLte.getMnc()), getCellInfoDisplayString(cidLte.getMnc()),
getCellInfoDisplayString(cidLte.getTac()), getCellInfoDisplayString(cidLte.getTac()),
getCellInfoDisplayString(cidLte.getCi()), getCellInfoDisplayString(cidLte.getCi()),
getCellInfoDisplayString(cidLte.getPci()), getCellInfoDisplayString(cidLte.getPci()),
getCellInfoDisplayString(cidLte.getEarfcn()), getCellInfoDisplayString(cidLte.getEarfcn()),
getCellInfoDisplayString(cidLte.getBandwidth()),
getCellInfoDisplayString(ssLte.getDbm()), getCellInfoDisplayString(ssLte.getDbm()),
getCellInfoDisplayString(ssLte.getRsrq()), getCellInfoDisplayString(ssLte.getRsrq()),
getCellInfoDisplayString(ssLte.getTimingAdvance())); getCellInfoDisplayString(ssLte.getTimingAdvance()));
@@ -727,7 +751,7 @@ public class RadioInfo extends Activity {
CellSignalStrengthWcdma ssWcdma = ci.getCellSignalStrength(); CellSignalStrengthWcdma ssWcdma = ci.getCellSignalStrength();
return String.format("%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n", return String.format("%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n",
ci.isRegistered() ? "S " : " ", getConnectionStatusString(ci),
getCellInfoDisplayString(cidWcdma.getMcc()), getCellInfoDisplayString(cidWcdma.getMcc()),
getCellInfoDisplayString(cidWcdma.getMnc()), getCellInfoDisplayString(cidWcdma.getMnc()),
getCellInfoDisplayString(cidWcdma.getLac()), getCellInfoDisplayString(cidWcdma.getLac()),
@@ -759,17 +783,21 @@ public class RadioInfo extends Activity {
} }
if (lteCells.length() != 0) { if (lteCells.length() != 0) {
value += String.format( value += String.format(
"LTE\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s %-6.6s %-4.4s %-4.4s %-2.2s\n", "LTE\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-3.3s"
"SRV", "MCC", "MNC", "TAC", "CID", "PCI", "EARFCN", "RSRP", "RSRQ", "TA"); + " %-6.6s %-2.2s %-4.4s %-4.4s %-2.2s\n",
"SRV", "MCC", "MNC", "TAC", "CID", "PCI",
"EARFCN", "BW", "RSRP", "RSRQ", "TA");
value += lteCells.toString(); value += lteCells.toString();
} }
if (wcdmaCells.length() != 0) { if (wcdmaCells.length() != 0) {
value += String.format("WCDMA\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n", value += String.format(
"WCDMA\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-3.3s %-4.4s\n",
"SRV", "MCC", "MNC", "LAC", "CID", "UARFCN", "PSC", "RSCP"); "SRV", "MCC", "MNC", "LAC", "CID", "UARFCN", "PSC", "RSCP");
value += wcdmaCells.toString(); value += wcdmaCells.toString();
} }
if (gsmCells.length() != 0) { if (gsmCells.length() != 0) {
value += String.format("GSM\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n", value += String.format(
"GSM\n%-3.3s %-3.3s %-3.3s %-5.5s %-5.5s %-6.6s %-4.4s %-4.4s\n",
"SRV", "MCC", "MNC", "LAC", "CID", "ARFCN", "BSIC", "RSSI"); "SRV", "MCC", "MNC", "LAC", "CID", "ARFCN", "BSIC", "RSSI");
value += gsmCells.toString(); value += gsmCells.toString();
} }