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 01f60b234e
commit 60dcea8f1e

View File

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