Remove hidden API usage in metrics toString

Remove usage of hidden NetworkType, transport APIs in toString()
implementations of metrics and data usage classes.

The toString implementations can log the transports or network type as
hex or raw indices. While slightly less readable, the metrics classes
and network type APIs are deprecated.

Bug: 174436414
Test: m
Change-Id: I79239a540b66dadd3bbe0a997960530878331358
This commit is contained in:
Remi NGUYEN VAN
2020-11-30 15:47:53 +09:00
parent 3154d517c9
commit 25f710ae47

View File

@@ -17,7 +17,6 @@
package android.net; package android.net;
import static android.net.ConnectivityManager.TYPE_WIFI; import static android.net.ConnectivityManager.TYPE_WIFI;
import static android.net.ConnectivityManager.getNetworkTypeName;
import static android.net.ConnectivityManager.isNetworkTypeMobile; import static android.net.ConnectivityManager.isNetworkTypeMobile;
import android.content.Context; import android.content.Context;
@@ -84,7 +83,7 @@ public class NetworkIdentity implements Comparable<NetworkIdentity> {
@Override @Override
public String toString() { public String toString() {
final StringBuilder builder = new StringBuilder("{"); final StringBuilder builder = new StringBuilder("{");
builder.append("type=").append(getNetworkTypeName(mType)); builder.append("type=").append(mType);
builder.append(", subType="); builder.append(", subType=");
if (mSubType == SUBTYPE_COMBINED) { if (mSubType == SUBTYPE_COMBINED) {
builder.append("COMBINED"); builder.append("COMBINED");