165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane/* 265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Copyright (C) 2014 The Android Open Source Project 365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * 465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Licensed under the Apache License, Version 2.0 (the "License"); 565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * you may not use this file except in compliance with the License. 665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * You may obtain a copy of the License at 765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * 865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * http://www.apache.org/licenses/LICENSE-2.0 965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * 1065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Unless required by applicable law or agreed to in writing, software 1165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * distributed under the License is distributed on an "AS IS" BASIS, 1265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * See the License for the specific language governing permissions and 1465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * limitations under the License. 1565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane */ 1665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane 1765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lanepackage com.android.tv.settings.connectivity; 1865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane 1965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.content.Context; 2065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Laneimport android.net.ConnectivityManager; 2165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane 2265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lanepublic class NetworkConfigurationFactory { 2365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane 2465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane public static final int TYPE_ETHERNET = ConnectivityManager.TYPE_ETHERNET; 2565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane public static final int TYPE_WIFI = ConnectivityManager.TYPE_WIFI; 2665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane 2765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane /** 2865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * Create a NetworkConfiguration with the networkType 2965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * 3065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * @param context context to pass the constructors 3165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * @param networkType networkType to create 3265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane * @return new NetworkConfiguration instance 3365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane */ 3465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane public static NetworkConfiguration createNetworkConfiguration( 3565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane Context context, int networkType) { 3665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane switch (networkType) { 3765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane case TYPE_ETHERNET: 3865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane return new EthernetConfig(context); 3965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane 4065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane case TYPE_WIFI: 4165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane return new WifiConfig(context); 4265a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane 4365a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane default: 4465a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane return null; 4565a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane } 4665a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane } 4765a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane 4865a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane private NetworkConfigurationFactory() { 4965a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane // Do not allow instantiation 5065a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane } 5165a5a7d84ad9b5324ae53eda526e39e513473af7Christopher Lane} 52