From e642d483a46b4fad328adce65d0e4d01674e654e Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Sun, 14 Mar 2021 15:41:15 +0900 Subject: [PATCH] Remove MessageUtils usage in VpnTransportInfo MessageUtils is a hidden utility, and including a jarjared copy in framework-connectivity would add complexity. It is only used in VpnTransportInfo, where it would parse VPN constants when the class is loaded in each process. Considering the performance and maintenance cost using numerical type codes in toString() seems to be a better tradeoff. Bug: 177046265 Test: m Change-Id: Ie71cc816f86e020b44ed1c86349b5c9204dee3cf --- framework/src/android/net/VpnTransportInfo.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/framework/src/android/net/VpnTransportInfo.java b/framework/src/android/net/VpnTransportInfo.java index c510079489..cd8f4c06de 100644 --- a/framework/src/android/net/VpnTransportInfo.java +++ b/framework/src/android/net/VpnTransportInfo.java @@ -22,9 +22,6 @@ import android.annotation.NonNull; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; -import android.util.SparseArray; - -import com.android.internal.util.MessageUtils; import java.util.Objects; @@ -38,9 +35,6 @@ import java.util.Objects; */ @SystemApi(client = MODULE_LIBRARIES) public final class VpnTransportInfo implements TransportInfo, Parcelable { - private static final SparseArray sTypeToString = - MessageUtils.findMessageNames(new Class[]{VpnManager.class}, new String[]{"TYPE_VPN_"}); - /** Type of this VPN. */ public final int type; @@ -63,8 +57,7 @@ public final class VpnTransportInfo implements TransportInfo, Parcelable { @Override public String toString() { - final String typeString = sTypeToString.get(type, "VPN_TYPE_???"); - return String.format("VpnTransportInfo{%s}", typeString); + return String.format("VpnTransportInfo{type=%d}", type); } @Override