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
This commit is contained in:
Remi NGUYEN VAN
2021-03-14 15:41:15 +09:00
parent baf1680f8b
commit e642d483a4

View File

@@ -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<String> 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