Merge "DO NOT MERGE Change WiMAX indicator display" into gingerbread

This commit is contained in:
Simon Wilson
2011-03-21 16:58:41 -07:00
committed by Android (Google) Code Review
14 changed files with 96 additions and 39 deletions

View File

@@ -10,15 +10,15 @@ public class WimaxManagerConstants
* Used by android.net.wimax.WimaxManager for handling management of
* Wimax access.
*/
public static final String WIMAX_SERVICE="WiMax";
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 WIMAX_STATUS_CHANGED_ACTION
= "android.net.wimax.WIMAX_STATUS_CHANGED";
public static final String WIMAX_ENABLED_STATUS_CHANGED =
"android.net.wimax.WIMAX_STATUS_CHANGED";
/**
* The lookup key for an int that indicates whether Wimax is enabled,
@@ -27,16 +27,38 @@ public class WimaxManagerConstants
public static final String EXTRA_WIMAX_STATUS = "wimax_status";
/**
* Broadcast intent action indicating that Wimax data has been recieved, sent. One extra
* provides the state as int.
* 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_DATA_USED_ACTION = "android.net.wimax.WIMAX_DATA_USED";
public static final String WIMAX_STATE_CHANGED_ACTION =
"android.net.wimax.WIMAX_STATE_CHANGE";
/**
* The lookup key for an int that indicates whether Wimax is data is being recieved or sent,
* up indicates data is being sent and down indicates data being recieved.
* Broadcast intent action indicating that Wimax signal level has been changed.
* Level varies from 0 to 3.
*/
public static final String EXTRA_UP_DOWN_DATA = "upDownData";
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";
/**
* 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.
@@ -64,22 +86,18 @@ public class WimaxManagerConstants
public static final int WIMAX_DEREGISTRATION = 8;
/**
* Indicatates no data on wimax.
*/
public static final int NO_DATA = 0;
* Indicatates wimax state is unknown.
*/
public static final int WIMAX_STATE_UNKNOWN = 0;
/**
* Indicatates data is being sent.
* Indicatates wimax state is connected.
*/
public static final int UP_DATA = 1;
public static final int WIMAX_STATE_CONNECTED = 7;
/**
* Indicatates dats is being revieved.
* Indicatates wimax state is disconnected.
*/
public static final int DOWN_DATA = 2;
public static final int WIMAX_STATE_DISCONNECTED = 9;
/**
* Indicatates data is being recieved and sent simultaneously.
*/
public static final int UP_DOWN_DATA = 3;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -499,17 +499,23 @@ public class StatusBarPolicy {
private boolean mIsWifiConnected = false;
//4G
private static final int[][] sDataNetType_4g = {
{ R.drawable.stat_sys_data_connected_4g,
R.drawable.stat_sys_data_out_4g,
R.drawable.stat_sys_data_in_4g,
R.drawable.stat_sys_data_inandout_4g },
{ R.drawable.stat_sys_data_fully_connected_4g,
R.drawable.stat_sys_data_fully_out_4g,
R.drawable.stat_sys_data_fully_in_4g,
R.drawable.stat_sys_data_fully_inandout_4g }
private static final int[][] sWimaxSignalImages = {
{ 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 }
};
private static final int sWimaxDisconnectedImg =
R.drawable.stat_sys_data_wimax_signal_disconnected;
private static final int sWimaxIdleImg = R.drawable.stat_sys_data_wimax_signal_idle;
private boolean mIsWimaxConnected = false;
private boolean mIsWimaxEnabled = false;
private int mWimaxSignal = 0;
private int mWimaxState = 0;
// state of inet connection - 0 not connected, 100 connected
private int mInetCondition = 0;
@@ -568,7 +574,9 @@ public class StatusBarPolicy {
// TODO - stop using other means to get wifi/mobile info
updateConnectivity(intent);
}
else if (action.equals(WimaxManagerConstants.WIMAX_DATA_USED_ACTION)) {
else if (action.equals(WimaxManagerConstants.WIMAX_ENABLED_STATUS_CHANGED) ||
action.equals(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION) ||
action.equals(WimaxManagerConstants.WIMAX_STATE_CHANGED_ACTION)) {
updateWiMAX(intent);
}
}
@@ -616,7 +624,7 @@ public class StatusBarPolicy {
boolean isWimaxEnabled = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_wimaxEnabled);
if (isWimaxEnabled) {
mService.setIcon("wimax", R.drawable.stat_sys_data_connected_4g, 0);
mService.setIcon("wimax", sWimaxDisconnectedImg, 0);
mService.setIconVisibility("wimax", false);
}
@@ -685,7 +693,9 @@ public class StatusBarPolicy {
filter.addAction(TtyIntent.TTY_ENABLED_CHANGE_ACTION);
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
filter.addAction(WimaxManagerConstants.WIMAX_DATA_USED_ACTION);
filter.addAction(WimaxManagerConstants.WIMAX_STATE_CHANGED_ACTION);
filter.addAction(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION);
filter.addAction(WimaxManagerConstants.WIMAX_ENABLED_STATUS_CHANGED);
mContext.registerReceiver(mIntentReceiver, filter, null, mHandler);
@@ -935,7 +945,6 @@ public class StatusBarPolicy {
mService.setIconVisibility("wimax", true);
} else {
mIsWimaxConnected = false;
mService.setIconVisibility("wimax", false);
}
updateWiMAX(intent);
break;
@@ -1321,13 +1330,44 @@ public class StatusBarPolicy {
private final void updateWiMAX(Intent intent) {
final String action = intent.getAction();
int iconId = sDataNetType_4g[0][0];
if (action.equals(WimaxManagerConstants.WIMAX_DATA_USED_ACTION)) {
int nUpDown = intent.getIntExtra(WimaxManagerConstants.EXTRA_UP_DOWN_DATA, 0);
iconId = sDataNetType_4g[mInetCondition][nUpDown];
int iconId = sWimaxDisconnectedImg;
if (action.equals(WimaxManagerConstants. WIMAX_ENABLED_STATUS_CHANGED)) {
int mWimaxStatus = intent.getIntExtra(WimaxManagerConstants.EXTRA_WIMAX_STATUS,
WimaxManagerConstants.WIMAX_STATUS_DISABLED);
switch(mWimaxStatus) {
case WimaxManagerConstants.WIMAX_STATUS_ENABLED:
mIsWimaxEnabled = true;
break;
case WimaxManagerConstants.WIMAX_STATUS_DISABLED:
mIsWimaxEnabled = false;
break;
}
} else if (action.equals(WimaxManagerConstants.SIGNAL_LEVEL_CHANGED_ACTION)) {
mWimaxSignal = intent.getIntExtra(WimaxManagerConstants.EXTRA_NEW_SIGNAL_LEVEL, 0);
} else if (action.equals(WimaxManagerConstants.WIMAX_STATE_CHANGED_ACTION)) {
mWimaxState = intent.getIntExtra(WimaxManagerConstants.EXTRA_WIMAX_STATE,
WimaxManagerConstants.WIMAX_STATE_UNKNOWN);
int mExtraWimaxState = intent.getIntExtra(
WimaxManagerConstants.EXTRA_WIMAX_STATE_DETAIL,
WimaxManagerConstants.WIMAX_DEREGISTRATION);
switch(mWimaxState) {
case WimaxManagerConstants.WIMAX_STATE_DISCONNECTED:
iconId = sWimaxDisconnectedImg;
break;
case WimaxManagerConstants.WIMAX_STATE_CONNECTED:
if(mExtraWimaxState == WimaxManagerConstants.WIMAX_IDLE) {
iconId = sWimaxIdleImg;
}
else {
iconId = sWimaxSignalImages[mInetCondition][mWimaxSignal];
}
break;
}
mService.setIcon("wimax", iconId, 0);
mService.setIconVisibility("wimax", mIsWimaxConnected);
}
mService.setIconVisibility("wimax", mIsWimaxEnabled);
}
private final void updateGps(Intent intent) {
@@ -1415,7 +1455,6 @@ public class StatusBarPolicy {
mService.setIcon("phone_signal", mPhoneSignalIconId, 0);
}
private class StatusBarHandler extends Handler {
@Override
public void handleMessage(Message msg) {