| /* |
| * Copyright (C) 2019 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License |
| */ |
| |
| package com.android.server |
| |
| import android.net.ConnectivityManager.TYPE_BLUETOOTH |
| import android.net.ConnectivityManager.TYPE_ETHERNET |
| import android.net.ConnectivityManager.TYPE_MOBILE |
| import android.net.ConnectivityManager.TYPE_NONE |
| import android.net.ConnectivityManager.TYPE_TEST |
| import android.net.ConnectivityManager.TYPE_VPN |
| import android.net.ConnectivityManager.TYPE_WIFI |
| import android.net.NetworkCapabilities.TRANSPORT_BLUETOOTH |
| import android.net.NetworkCapabilities.TRANSPORT_CELLULAR |
| import android.net.NetworkCapabilities.TRANSPORT_ETHERNET |
| import android.net.NetworkCapabilities.TRANSPORT_TEST |
| import android.net.NetworkCapabilities.TRANSPORT_VPN |
| import android.net.NetworkCapabilities.TRANSPORT_WIFI |
| |
| fun transportToLegacyType(transport: Int) = when (transport) { |
| TRANSPORT_BLUETOOTH -> TYPE_BLUETOOTH |
| TRANSPORT_CELLULAR -> TYPE_MOBILE |
| TRANSPORT_ETHERNET -> TYPE_ETHERNET |
| TRANSPORT_TEST -> TYPE_TEST |
| TRANSPORT_VPN -> TYPE_VPN |
| TRANSPORT_WIFI -> TYPE_WIFI |
| else -> TYPE_NONE |
| } |