Merge "Wimax : wimax framework related open source." into ics-mr1
104
core/java/android/net/wimax/WimaxManagerConstants.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package android.net.wimax;
|
||||
|
||||
/**
|
||||
* {@hide}
|
||||
*/
|
||||
public class WimaxManagerConstants
|
||||
{
|
||||
|
||||
/**
|
||||
* Used by android.net.wimax.WimaxManager for handling management of
|
||||
* Wimax access.
|
||||
*/
|
||||
public static final String WIMAX_SERVICE = "WiMax";
|
||||
|
||||
/**
|
||||
* Broadcast intent action indicating that Wimax has been enabled, disabled,
|
||||
* enabling, disabling, or unknown. One extra provides this state as an int.
|
||||
* Another extra provides the previous state, if available.
|
||||
*/
|
||||
public static final String NET_4G_STATE_CHANGED_ACTION =
|
||||
"android.net.fourG.NET_4G_STATE_CHANGED";
|
||||
|
||||
/**
|
||||
* The lookup key for an int that indicates whether Wimax is enabled,
|
||||
* disabled, enabling, disabling, or unknown.
|
||||
*/
|
||||
public static final String EXTRA_WIMAX_STATUS = "wimax_status";
|
||||
|
||||
/**
|
||||
* Broadcast intent action indicating that Wimax state has been changed
|
||||
* state could be scanning, connecting, connected, disconnecting, disconnected
|
||||
* initializing, initialized, unknown and ready. One extra provides this state as an int.
|
||||
* Another extra provides the previous state, if available.
|
||||
*/
|
||||
public static final String WIMAX_NETWORK_STATE_CHANGED_ACTION =
|
||||
"android.net.fourG.wimax.WIMAX_NETWORK_STATE_CHANGED";
|
||||
|
||||
/**
|
||||
* Broadcast intent action indicating that Wimax signal level has been changed.
|
||||
* Level varies from 0 to 3.
|
||||
*/
|
||||
public static final String SIGNAL_LEVEL_CHANGED_ACTION =
|
||||
"android.net.wimax.SIGNAL_LEVEL_CHANGED";
|
||||
|
||||
/**
|
||||
* The lookup key for an int that indicates whether Wimax state is
|
||||
* scanning, connecting, connected, disconnecting, disconnected
|
||||
* initializing, initialized, unknown and ready.
|
||||
*/
|
||||
public static final String EXTRA_WIMAX_STATE = "WimaxState";
|
||||
public static final String EXTRA_4G_STATE = "4g_state";
|
||||
public static final String EXTRA_WIMAX_STATE_INT = "WimaxStateInt";
|
||||
/**
|
||||
* The lookup key for an int that indicates whether state of Wimax
|
||||
* is idle.
|
||||
*/
|
||||
public static final String EXTRA_WIMAX_STATE_DETAIL = "WimaxStateDetail";
|
||||
|
||||
/**
|
||||
* The lookup key for an int that indicates Wimax signal level.
|
||||
*/
|
||||
public static final String EXTRA_NEW_SIGNAL_LEVEL = "newSignalLevel";
|
||||
|
||||
/**
|
||||
* Indicatates Wimax is disabled.
|
||||
*/
|
||||
public static final int NET_4G_STATE_DISABLED = 1;
|
||||
|
||||
/**
|
||||
* Indicatates Wimax is enabled.
|
||||
*/
|
||||
public static final int NET_4G_STATE_ENABLED = 3;
|
||||
|
||||
/**
|
||||
* Indicatates Wimax status is known.
|
||||
*/
|
||||
public static final int NET_4G_STATE_UNKNOWN = 4;
|
||||
|
||||
/**
|
||||
* Indicatates Wimax is in idle state.
|
||||
*/
|
||||
public static final int WIMAX_IDLE = 6;
|
||||
|
||||
/**
|
||||
* Indicatates Wimax is being deregistered.
|
||||
*/
|
||||
public static final int WIMAX_DEREGISTRATION = 8;
|
||||
|
||||
/**
|
||||
* Indicatates wimax state is unknown.
|
||||
*/
|
||||
public static final int WIMAX_STATE_UNKNOWN = 0;
|
||||
|
||||
/**
|
||||
* Indicatates wimax state is connected.
|
||||
*/
|
||||
public static final int WIMAX_STATE_CONNECTED = 7;
|
||||
|
||||
/**
|
||||
* Indicatates wimax state is disconnected.
|
||||
*/
|
||||
public static final int WIMAX_STATE_DISCONNECTED = 9;
|
||||
|
||||
}
|
||||
@@ -1182,6 +1182,7 @@ public final class Settings {
|
||||
*/
|
||||
public static final String RADIO_WIFI = "wifi";
|
||||
|
||||
public static final String RADIO_WIMAX = "wimax";
|
||||
/**
|
||||
* Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
|
||||
*/
|
||||
@@ -2899,6 +2900,8 @@ public final class Settings {
|
||||
*/
|
||||
public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
|
||||
"wifi_networks_available_notification_on";
|
||||
public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
|
||||
"wimax_networks_available_notification_on";
|
||||
|
||||
/**
|
||||
* Delay (in seconds) before repeating the Wi-Fi networks available notification.
|
||||
|
||||
@@ -423,6 +423,11 @@
|
||||
android:description="@string/permdesc_accessWifiState"
|
||||
android:label="@string/permlab_accessWifiState" />
|
||||
|
||||
<permission android:name="android.permission.ACCESS_WIMAX_STATE"
|
||||
android:permissionGroup="android.permission-group.NETWORK"
|
||||
android:protectionLevel="normal"
|
||||
android:description="@string/permdesc_accessWimaxState"
|
||||
android:label="@string/permlab_accessWimaxState" />
|
||||
<!-- Allows applications to connect to paired bluetooth devices -->
|
||||
<permission android:name="android.permission.BLUETOOTH"
|
||||
android:permissionGroup="android.permission-group.NETWORK"
|
||||
@@ -984,6 +989,11 @@
|
||||
android:description="@string/permdesc_changeWifiState"
|
||||
android:label="@string/permlab_changeWifiState" />
|
||||
|
||||
<permission android:name="android.permission.CHANGE_WIMAX_STATE"
|
||||
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
|
||||
android:protectionLevel="dangerous"
|
||||
android:description="@string/permdesc_changeWimaxState"
|
||||
android:label="@string/permlab_changeWimaxState" />
|
||||
<!-- Allows applications to enter Wi-Fi Multicast mode -->
|
||||
<permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"
|
||||
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
|
||||
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
18
core/res/res/values/config.xml
Executable file → Normal file
@@ -165,6 +165,12 @@
|
||||
<string-array translatable="false" name="config_tether_wifi_regexs">
|
||||
</string-array>
|
||||
|
||||
<!-- List of regexpressions describing the interface (if any) that represent tetherable
|
||||
WiMAX interfaces. If the device doesn't want to support tethering over Wifi this
|
||||
should be empty. An example would be "softap.*" -->
|
||||
<string-array translatable="false" name="config_tether_wimax_regexs">
|
||||
</string-array>
|
||||
|
||||
<!-- List of regexpressions describing the interface (if any) that represent tetherable
|
||||
bluetooth interfaces. If the device doesn't want to support tethering over bluetooth this
|
||||
should be empty. -->
|
||||
@@ -718,4 +724,16 @@
|
||||
<!-- Default network policy warning threshold, in megabytes. -->
|
||||
<integer name="config_networkPolicyDefaultWarning">2048</integer>
|
||||
|
||||
<!-- Set and Unsets WiMAX -->
|
||||
<bool name="config_wimaxEnabled">false</bool>
|
||||
<!-- Location of the wimax framwork jar location -->
|
||||
<string name="config_wimaxServiceJarLocation"></string>
|
||||
<!-- Location of the wimax native library locaiton -->
|
||||
<string name="config_wimaxNativeLibLocation"></string>
|
||||
<!-- Name of the wimax manager class -->
|
||||
<string name="config_wimaxManagerClassname"></string>
|
||||
<!-- Name of the wimax service class -->
|
||||
<string name="config_wimaxServiceClassname"></string>
|
||||
<!-- Name of the wimax state tracker clas -->
|
||||
<string name="config_wimaxStateTrackerClassname"></string>
|
||||
</resources>
|
||||
|
||||
6
core/res/res/values/strings.xml
Executable file → Normal file
@@ -1362,6 +1362,12 @@
|
||||
than the non-multicast mode.</string>
|
||||
|
||||
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permlab_accessWimaxState">view WiMAX state</string>
|
||||
<string name="permdesc_accessWimaxState">Allows an application to view
|
||||
the information about the state of WiMAX.</string>
|
||||
<string name="permlab_changeWimaxState">change WiMAX state</string>
|
||||
<string name="permdesc_changeWimaxState">Allows an application to connect
|
||||
to and disconnect from WiMAX network.</string>
|
||||
<string name="permlab_bluetoothAdmin">bluetooth administration</string>
|
||||
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
|
||||
<string name="permdesc_bluetoothAdmin" product="tablet">Allows an application to configure
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<integer name="def_screen_off_timeout">60000</integer>
|
||||
<bool name="def_airplane_mode_on">false</bool>
|
||||
<!-- Comma-separated list of bluetooth, wifi, and cell. -->
|
||||
<string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi,nfc</string>
|
||||
<string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi,nfc,wimax</string>
|
||||
<string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi,nfc</string>
|
||||
<bool name="def_auto_time">true</bool>
|
||||
<bool name="def_auto_time_zone">true</bool>
|
||||
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
@@ -51,6 +51,27 @@
|
||||
android:visibility="gone"
|
||||
android:id="@+id/spacer"
|
||||
/>
|
||||
<FrameLayout
|
||||
android:id="@+id/wimax_combo"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginRight="-6dp"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/wimax_signal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:scaleType="center"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/wimax_inout"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center|bottom"
|
||||
/>
|
||||
</FrameLayout>
|
||||
<FrameLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -256,7 +256,12 @@
|
||||
<!-- Content description of the WIFI signal when it is three bars for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_wifi_three_bars">Wi-Fi three bars.</string>
|
||||
<!-- Content description of the WIFI signal when it is full for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_wifi_signal_full">Wi-Fi signal full.</string>
|
||||
<string name="accessibility_wifi_signal_full">WiFi signal full.</string>
|
||||
<string name="accessibility_no_wimax">No WiMAX.</string>
|
||||
<string name="accessibility_wimax_one_bar">WiMAX one bar.</string>
|
||||
<string name="accessibility_wimax_two_bars">WiMAX two bars.</string>
|
||||
<string name="accessibility_wimax_three_bars">WiMAX three bars.</string>
|
||||
<string name="accessibility_wimax_signal_full">WiMAX signal full.</string>
|
||||
|
||||
<!-- Content description of the data connection type GPRS for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_data_connection_gprs">GPRS</string>
|
||||
|
||||
@@ -350,7 +350,11 @@ public class PhoneStatusBar extends StatusBar {
|
||||
(SignalClusterView)sb.findViewById(R.id.signal_cluster);
|
||||
mNetworkController.addSignalCluster(signalCluster);
|
||||
signalCluster.setNetworkController(mNetworkController);
|
||||
|
||||
final ImageView wimaxRSSI =
|
||||
(ImageView)sb.findViewById(R.id.wimax_signal);
|
||||
if (wimaxRSSI != null) {
|
||||
mNetworkController.addWimaxIconView(wimaxRSSI);
|
||||
}
|
||||
// Recents Panel
|
||||
mRecentTasksLoader = new RecentTasksLoader(context);
|
||||
updateRecentsPanel();
|
||||
|
||||
@@ -34,4 +34,11 @@ public class AccessibilityContentDescriptions {
|
||||
R.string.accessibility_wifi_three_bars,
|
||||
R.string.accessibility_wifi_signal_full
|
||||
};
|
||||
static final int[] WIMAX_CONNECTION_STRENGTH = {
|
||||
R.string.accessibility_no_wimax,
|
||||
R.string.accessibility_wimax_one_bar,
|
||||
R.string.accessibility_wimax_two_bars,
|
||||
R.string.accessibility_wimax_three_bars,
|
||||
R.string.accessibility_wimax_signal_full
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.net.wimax.WimaxManagerConstants;
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@@ -90,6 +91,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
|
||||
String mContentDescriptionPhoneSignal;
|
||||
String mContentDescriptionWifi;
|
||||
String mContentDescriptionWimax;
|
||||
String mContentDescriptionCombinedSignal;
|
||||
String mContentDescriptionDataType;
|
||||
|
||||
@@ -108,6 +110,14 @@ public class NetworkController extends BroadcastReceiver {
|
||||
private int mBluetoothTetherIconId =
|
||||
com.android.internal.R.drawable.stat_sys_tether_bluetooth;
|
||||
|
||||
//wimax
|
||||
private boolean mIsWimaxEnabled = false;
|
||||
private boolean mWimaxConnected = false;
|
||||
private boolean mWimaxIdle = false;
|
||||
private int mWimaxIconId = 0;
|
||||
private int mWimaxSignal = 0;
|
||||
private int mWimaxState = 0;
|
||||
private int mWimaxExtraState = 0;
|
||||
// data connectivity (regardless of state, can we access the internet?)
|
||||
// state of inet connection - 0 not connected, 100 connected
|
||||
private int mInetCondition = 0;
|
||||
@@ -121,6 +131,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
ArrayList<ImageView> mDataDirectionIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<ImageView> mDataDirectionOverlayIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<ImageView> mWifiIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<ImageView> mWimaxIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<ImageView> mCombinedSignalIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<ImageView> mDataTypeIconViews = new ArrayList<ImageView>();
|
||||
ArrayList<TextView> mLabelViews = new ArrayList<TextView>();
|
||||
@@ -129,6 +140,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
int mLastDataDirectionIconId = -1;
|
||||
int mLastDataDirectionOverlayIconId = -1;
|
||||
int mLastWifiIconId = -1;
|
||||
int mLastWimaxIconId = -1;
|
||||
int mLastCombinedSignalIconId = -1;
|
||||
int mLastDataTypeIconId = -1;
|
||||
String mLastLabel = "";
|
||||
@@ -164,6 +176,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
|
||||
// set up the default wifi icon, used when no radios have ever appeared
|
||||
updateWifiIcons();
|
||||
updateWimaxIcons();
|
||||
|
||||
// telephony
|
||||
mPhone = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
@@ -200,6 +213,13 @@ public class NetworkController extends BroadcastReceiver {
|
||||
filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
|
||||
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
|
||||
filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
|
||||
boolean isWimaxConfigEnabled = mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_wimaxEnabled);
|
||||
if(isWimaxConfigEnabled) {
|
||||
filter.addAction(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION);
|
||||
filter.addAction(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION);
|
||||
filter.addAction(WimaxManagerConstants.NET_4G_STATE_CHANGED_ACTION);
|
||||
}
|
||||
context.registerReceiver(this, filter);
|
||||
|
||||
// AIRPLANE_MODE_CHANGED is sent at boot; we've probably already missed it
|
||||
@@ -224,6 +244,9 @@ public class NetworkController extends BroadcastReceiver {
|
||||
public void addWifiIconView(ImageView v) {
|
||||
mWifiIconViews.add(v);
|
||||
}
|
||||
public void addWimaxIconView(ImageView v) {
|
||||
mWimaxIconViews.add(v);
|
||||
}
|
||||
|
||||
public void addCombinedSignalIconView(ImageView v) {
|
||||
mCombinedSignalIconViews.add(v);
|
||||
@@ -285,6 +308,11 @@ public class NetworkController extends BroadcastReceiver {
|
||||
} else if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
|
||||
updateAirplaneMode();
|
||||
refreshViews();
|
||||
} else if (action.equals(WimaxManagerConstants.NET_4G_STATE_CHANGED_ACTION) ||
|
||||
action.equals(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION) ||
|
||||
action.equals(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION)) {
|
||||
updateWimaxState(intent);
|
||||
refreshViews();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -735,6 +763,51 @@ public class NetworkController extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
|
||||
// ===== Wimax ===================================================================
|
||||
|
||||
private final void updateWimaxState(Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
boolean wasConnected = mWimaxConnected;
|
||||
if (action.equals(WimaxManagerConstants.NET_4G_STATE_CHANGED_ACTION)) {
|
||||
int wimaxStatus = intent.getIntExtra(WimaxManagerConstants.EXTRA_4G_STATE,
|
||||
WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
|
||||
mIsWimaxEnabled = (wimaxStatus ==
|
||||
WimaxManagerConstants.NET_4G_STATE_ENABLED)? true : false;
|
||||
} else if (action.equals(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION)) {
|
||||
mWimaxSignal = intent.getIntExtra(WimaxManagerConstants.EXTRA_NEW_SIGNAL_LEVEL, 0);
|
||||
} else if (action.equals(WimaxManagerConstants.WIMAX_NETWORK_STATE_CHANGED_ACTION)) {
|
||||
mWimaxState = intent.getIntExtra(WimaxManagerConstants.EXTRA_WIMAX_STATE,
|
||||
WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
|
||||
mWimaxExtraState = intent.getIntExtra(
|
||||
WimaxManagerConstants.EXTRA_WIMAX_STATE_DETAIL,
|
||||
WimaxManagerConstants.NET_4G_STATE_UNKNOWN);
|
||||
mWimaxConnected = (mWimaxState ==
|
||||
WimaxManagerConstants.WIMAX_STATE_CONNECTED) ? true : false;
|
||||
mWimaxIdle = (mWimaxExtraState == WimaxManagerConstants.WIMAX_IDLE)? true : false;
|
||||
}
|
||||
updateWimaxIcons();
|
||||
}
|
||||
private void updateWimaxIcons() {
|
||||
Slog.d(TAG, "in .... updateWimaxIcons function : "+mIsWimaxEnabled);
|
||||
if (mIsWimaxEnabled) {
|
||||
if (mWimaxConnected) {
|
||||
Slog.d(TAG, "in .... updateWimaxIcons function WiMAX COnnected");
|
||||
if (mWimaxIdle)
|
||||
mWimaxIconId = WimaxIcons.WIMAX_IDLE;
|
||||
else
|
||||
mWimaxIconId = WimaxIcons.WIMAX_SIGNAL_STRENGTH[mInetCondition][mWimaxSignal];
|
||||
mContentDescriptionWimax = mContext.getString(
|
||||
AccessibilityContentDescriptions.WIMAX_CONNECTION_STRENGTH[mWimaxSignal]);
|
||||
} else {
|
||||
Slog.d(TAG, "in .... updateWimaxIcons function WiMAX Disconnected");
|
||||
mWimaxIconId = WimaxIcons.WIMAX_DISCONNECTED;
|
||||
mContentDescriptionWimax = mContext.getString(R.string.accessibility_no_wimax);
|
||||
}
|
||||
} else {
|
||||
Slog.d(TAG, "in .... updateWimaxIcons function wimax icon id 0");
|
||||
mWimaxIconId = 0;
|
||||
}
|
||||
}
|
||||
// ===== Full or limited Internet connectivity ==================================
|
||||
|
||||
private void updateConnectivity(Intent intent) {
|
||||
@@ -761,6 +834,7 @@ public class NetworkController extends BroadcastReceiver {
|
||||
|
||||
// We want to update all the icons, all at once, for any condition change
|
||||
updateDataNetType();
|
||||
updateWimaxIcons();
|
||||
updateDataIcon();
|
||||
updateTelephonySignalStrength();
|
||||
updateWifiIcons();
|
||||
@@ -945,6 +1019,21 @@ public class NetworkController extends BroadcastReceiver {
|
||||
}
|
||||
}
|
||||
|
||||
// the wimax icon on phones
|
||||
if (mLastWimaxIconId != mWimaxIconId) {
|
||||
mLastWimaxIconId = mWimaxIconId;
|
||||
N = mWimaxIconViews.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
final ImageView v = mWimaxIconViews.get(i);
|
||||
if (mWimaxIconId == 0) {
|
||||
v.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
v.setVisibility(View.VISIBLE);
|
||||
v.setImageResource(mWimaxIconId);
|
||||
v.setContentDescription(mContentDescriptionWimax);
|
||||
}
|
||||
}
|
||||
}
|
||||
// the combined data signal icon
|
||||
if (mLastCombinedSignalIconId != combinedSignalIconId) {
|
||||
mLastCombinedSignalIconId = combinedSignalIconId;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2008 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.systemui.statusbar.policy;
|
||||
|
||||
import com.android.systemui.R;
|
||||
|
||||
class WimaxIcons {
|
||||
static final int[][] WIMAX_SIGNAL_STRENGTH = {
|
||||
{ R.drawable.stat_sys_data_wimax_signal_0,
|
||||
R.drawable.stat_sys_data_wimax_signal_1,
|
||||
R.drawable.stat_sys_data_wimax_signal_2,
|
||||
R.drawable.stat_sys_data_wimax_signal_3 },
|
||||
{ R.drawable.stat_sys_data_wimax_signal_0_fully,
|
||||
R.drawable.stat_sys_data_wimax_signal_1_fully,
|
||||
R.drawable.stat_sys_data_wimax_signal_2_fully,
|
||||
R.drawable.stat_sys_data_wimax_signal_3_fully }
|
||||
};
|
||||
|
||||
static final int WIMAX_DISCONNECTED =
|
||||
R.drawable.stat_sys_data_wimax_signal_disconnected;
|
||||
static final int WIMAX_IDLE = R.drawable.stat_sys_data_wimax_signal_idle;
|
||||
static final int WIFI_LEVEL_COUNT = WIMAX_SIGNAL_STRENGTH[0].length;
|
||||
}
|
||||
@@ -26,8 +26,10 @@ import static android.net.NetworkPolicyManager.RULE_REJECT_METERED;
|
||||
import android.bluetooth.BluetoothTetheringDataTracker;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.DummyDataStateTracker;
|
||||
@@ -51,6 +53,7 @@ import android.net.Proxy;
|
||||
import android.net.ProxyProperties;
|
||||
import android.net.RouteInfo;
|
||||
import android.net.wifi.WifiStateTracker;
|
||||
import android.net.wimax.WimaxManagerConstants;
|
||||
import android.os.Binder;
|
||||
import android.os.FileUtils;
|
||||
import android.os.Handler;
|
||||
@@ -78,10 +81,14 @@ import com.android.server.connectivity.Tethering;
|
||||
import com.android.server.connectivity.Vpn;
|
||||
import com.google.android.collect.Lists;
|
||||
import com.google.android.collect.Sets;
|
||||
|
||||
import dalvik.system.DexClassLoader;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.IOException;
|
||||
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.net.Inet4Address;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetAddress;
|
||||
@@ -491,6 +498,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
mNetTrackers[netType] = BluetoothTetheringDataTracker.getInstance();
|
||||
mNetTrackers[netType].startMonitoring(context, mHandler);
|
||||
break;
|
||||
case ConnectivityManager.TYPE_WIMAX:
|
||||
mNetTrackers[netType] = makeWimaxStateTracker();
|
||||
if (mNetTrackers[netType != null) {
|
||||
mNetTrackers[netType].startMonitoring(context, mHandler);
|
||||
}
|
||||
break;
|
||||
case ConnectivityManager.TYPE_ETHERNET:
|
||||
mNetTrackers[netType] = EthernetDataTracker.getInstance();
|
||||
mNetTrackers[netType].startMonitoring(context, mHandler);
|
||||
@@ -531,7 +544,81 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
|
||||
loadGlobalProxy();
|
||||
}
|
||||
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);
|
||||
|
||||
log("wimaxJarLocation: " + wimaxJarLocation);
|
||||
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) {
|
||||
loge("Exception finding Wimax classes: " + ex.toString());
|
||||
return null;
|
||||
}
|
||||
} catch(Resources.NotFoundException ex) {
|
||||
loge("Wimax Resources does not exist!!! ");
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
log("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(Exception ex) {
|
||||
loge("Exception creating Wimax classes: " + ex.toString());
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
loge("Wimax is not enabled or not added to the network attributes!!! ");
|
||||
return null;
|
||||
}
|
||||
|
||||
return wimaxStateTracker;
|
||||
}
|
||||
/**
|
||||
* Sets the preferred network.
|
||||
* @param preference the new preference
|
||||
|
||||