DO NOT MERGE WiMAX support
- In Connectivity service, start WiMAX service - 4G icon display in StatusBarPolicy - Add DHCP renew - Add radio for WiMAX Change-Id: Iffff012b270d80e84ec8fbd4486921a8adb847dd Signed-off-by: TK MUN <tk.mun@samsung.com>
This commit is contained in:
@ -18,16 +18,20 @@ package com.android.server;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.Resources.NotFoundException;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.IConnectivityManager;
|
||||
import android.net.MobileDataStateTracker;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.NetworkStateTracker;
|
||||
import android.net.wifi.WifiStateTracker;
|
||||
import android.net.wimax.WimaxManagerConstants;
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
@ -40,17 +44,21 @@ import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.EventLog;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.telephony.Phone;
|
||||
|
||||
import com.android.server.connectivity.Tethering;
|
||||
|
||||
import dalvik.system.DexClassLoader;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@ -100,7 +108,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
|
||||
private boolean mTestMode;
|
||||
private static ConnectivityService sServiceInstance;
|
||||
|
||||
private static final int ENABLED = 1;
|
||||
private static final int DISABLED = 0;
|
||||
|
||||
@ -378,6 +385,13 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
mNetTrackers[netType].teardown();
|
||||
}
|
||||
break;
|
||||
case ConnectivityManager.TYPE_WIMAX:
|
||||
NetworkStateTracker nst = makeWimaxStateTracker();
|
||||
if (nst != null) {
|
||||
nst.startMonitoring();
|
||||
}
|
||||
mNetTrackers[netType] = nst;
|
||||
break;
|
||||
default:
|
||||
Slog.e(TAG, "Trying to create a DataStateTracker for an unknown radio type " +
|
||||
mNetAttributes[netType].mRadio);
|
||||
@ -397,6 +411,94 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
private NetworkStateTracker makeWimaxStateTracker() {
|
||||
//Initialize Wimax
|
||||
DexClassLoader wimaxClassLoader;
|
||||
Class wimaxStateTrackerClass = null;
|
||||
Class wimaxServiceClass = null;
|
||||
Class wimaxManagerClass;
|
||||
String wimaxJarLocation;
|
||||
String wimaxLibLocation;
|
||||
String wimaxManagerClassName;
|
||||
String wimaxServiceClassName;
|
||||
String wimaxStateTrackerClassName;
|
||||
|
||||
NetworkStateTracker wimaxStateTracker = null;
|
||||
|
||||
boolean isWimaxEnabled = mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_wimaxEnabled);
|
||||
|
||||
if (isWimaxEnabled) {
|
||||
try {
|
||||
wimaxJarLocation = mContext.getResources().getString(
|
||||
com.android.internal.R.string.config_wimaxServiceJarLocation);
|
||||
wimaxLibLocation = mContext.getResources().getString(
|
||||
com.android.internal.R.string.config_wimaxNativeLibLocation);
|
||||
wimaxManagerClassName = mContext.getResources().getString(
|
||||
com.android.internal.R.string.config_wimaxManagerClassname);
|
||||
wimaxServiceClassName = mContext.getResources().getString(
|
||||
com.android.internal.R.string.config_wimaxServiceClassname);
|
||||
wimaxStateTrackerClassName = mContext.getResources().getString(
|
||||
com.android.internal.R.string.config_wimaxStateTrackerClassname);
|
||||
|
||||
wimaxClassLoader = new DexClassLoader(wimaxJarLocation,
|
||||
new ContextWrapper(mContext).getCacheDir().getAbsolutePath(),
|
||||
wimaxLibLocation,ClassLoader.getSystemClassLoader());
|
||||
|
||||
try {
|
||||
wimaxManagerClass = wimaxClassLoader.loadClass(wimaxManagerClassName);
|
||||
wimaxStateTrackerClass = wimaxClassLoader.loadClass(wimaxStateTrackerClassName);
|
||||
wimaxServiceClass = wimaxClassLoader.loadClass(wimaxServiceClassName);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
} catch(Resources.NotFoundException ex) {
|
||||
Slog.e(TAG, "Wimax Resources does not exist!!! ");
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
Slog.v(TAG, "Starting Wimax Service... ");
|
||||
|
||||
Constructor wmxStTrkrConst = wimaxStateTrackerClass.getConstructor
|
||||
(new Class[] {Context.class,Handler.class});
|
||||
wimaxStateTracker = (NetworkStateTracker)wmxStTrkrConst.newInstance(mContext,mHandler);
|
||||
|
||||
Constructor wmxSrvConst = wimaxServiceClass.getDeclaredConstructor
|
||||
(new Class[] {Context.class,wimaxStateTrackerClass});
|
||||
wmxSrvConst.setAccessible(true);
|
||||
IBinder svcInvoker = (IBinder) wmxSrvConst.newInstance(mContext,wimaxStateTracker);
|
||||
wmxSrvConst.setAccessible(false);
|
||||
|
||||
ServiceManager.addService(WimaxManagerConstants.WIMAX_SERVICE, svcInvoker);
|
||||
|
||||
} catch(ClassCastException ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
} catch (NoSuchMethodException ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
} catch (InstantiationException ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
} catch(IllegalAccessException ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
} catch(InvocationTargetException ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
} catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
Slog.e(TAG, "Wimax is not enabled or not added to the network attributes!!! ");
|
||||
return null;
|
||||
}
|
||||
|
||||
return wimaxStateTracker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the preferred network.
|
||||
|
Reference in New Issue
Block a user