Add log for manual network select settings

Add log to manual network select settings code to make the debug easier.

Bug: 131912524
Test: build
Change-Id: I6edb1aac67dd827563fe10adcdc53b6dddea9ca3
This commit is contained in:
Pengquan Meng
2019-05-03 11:52:52 -07:00
parent 0ea58e740d
commit 97650e9880
3 changed files with 33 additions and 11 deletions

View File

@@ -34,6 +34,7 @@ import android.util.Log;
import com.android.internal.telephony.OperatorInfo;
import java.util.List;
import java.util.stream.Collectors;
/**
* Add static Utility functions to get information from the CellInfo object.
@@ -161,4 +162,21 @@ public final class CellInfoUtil {
String plmn = CellInfoUtil.getOperatorInfoFromCellInfo(cellInfo).getOperatorNumeric();
return forbiddenPlmns != null && forbiddenPlmns.contains(plmn);
}
/** Convert a list of cellInfos to readable string without sensitive info. */
public static String cellInfoListToString(List<CellInfo> cellInfos) {
return cellInfos.stream()
.map(cellInfo -> cellInfoToString(cellInfo))
.collect(Collectors.joining(", "));
}
/** Convert {@code cellInfo} to a readable string without sensitive info. */
public static String cellInfoToString(CellInfo cellInfo) {
String cellType = cellInfo.getClass().getSimpleName();
CellIdentity cid = cellInfo.getCellIdentity();
return String.format(
"{CellType = %s, isRegistered = %b, mcc = %s, mnc = %s, alphaL = %s, alphaS = %s}",
cellType, cellInfo.isRegistered(), cid.getMccString(), cid.getMncString(),
cid.getOperatorAlphaLong(), cid.getOperatorAlphaShort());
}
}