|
74 | 74 | import com.android.server.am.BatteryStatsService; |
75 | 75 |
|
76 | 76 | import com.android.systemui.R; |
| 77 | +import android.net.wimax.WimaxManagerConstants; |
77 | 78 |
|
78 | 79 | /** |
79 | 80 | * This class contains all of the policy about which icons are installed in the status |
@@ -341,6 +342,19 @@ public class StatusBarPolicy { |
341 | 342 | private int mLastWifiSignalLevel = -1; |
342 | 343 | private boolean mIsWifiConnected = false; |
343 | 344 |
|
| 345 | + //4G |
| 346 | + private static final int[][] sDataNetType_4g = { |
| 347 | + { R.drawable.stat_sys_data_connected_4g, |
| 348 | + R.drawable.stat_sys_data_out_4g, |
| 349 | + R.drawable.stat_sys_data_in_4g, |
| 350 | + R.drawable.stat_sys_data_inandout_4g }, |
| 351 | + { R.drawable.stat_sys_data_fully_connected_4g, |
| 352 | + R.drawable.stat_sys_data_fully_out_4g, |
| 353 | + R.drawable.stat_sys_data_fully_in_4g, |
| 354 | + R.drawable.stat_sys_data_fully_inandout_4g } |
| 355 | + }; |
| 356 | + private boolean mIsWimaxConnected = false; |
| 357 | + |
344 | 358 | // state of inet connection - 0 not connected, 100 connected |
345 | 359 | private int mInetCondition = 0; |
346 | 360 |
|
@@ -398,6 +412,9 @@ else if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION) || |
398 | 412 | // TODO - stop using other means to get wifi/mobile info |
399 | 413 | updateConnectivity(intent); |
400 | 414 | } |
| 415 | + else if (action.equals(WimaxManagerConstants.WIMAX_DATA_USED_ACTION)) { |
| 416 | + updateWiMAX(intent); |
| 417 | + } |
401 | 418 | } |
402 | 419 | }; |
403 | 420 |
|
@@ -438,6 +455,15 @@ public StatusBarPolicy(Context context) { |
438 | 455 | mService.setIconVisibility("wifi", false); |
439 | 456 | // wifi will get updated by the sticky intents |
440 | 457 |
|
| 458 | + // wimax |
| 459 | + //enable/disable wimax depending on the value in config.xml |
| 460 | + boolean isWimaxEnabled = mContext.getResources().getBoolean( |
| 461 | + com.android.internal.R.bool.config_wimaxEnabled); |
| 462 | + if (isWimaxEnabled) { |
| 463 | + mService.setIcon("wimax", R.drawable.stat_sys_data_connected_4g, 0); |
| 464 | + mService.setIconVisibility("wimax", false); |
| 465 | + } |
| 466 | + |
441 | 467 | // TTY status |
442 | 468 | mService.setIcon("tty", R.drawable.stat_sys_tty_mode, 0); |
443 | 469 | mService.setIconVisibility("tty", false); |
@@ -503,6 +529,8 @@ public StatusBarPolicy(Context context) { |
503 | 529 | filter.addAction(TtyIntent.TTY_ENABLED_CHANGE_ACTION); |
504 | 530 | filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); |
505 | 531 | filter.addAction(ConnectivityManager.INET_CONDITION_ACTION); |
| 532 | + filter.addAction(WimaxManagerConstants.WIMAX_DATA_USED_ACTION); |
| 533 | + |
506 | 534 | mContext.registerReceiver(mIntentReceiver, filter, null, mHandler); |
507 | 535 |
|
508 | 536 | // load config to determine if to distinguish Hspa data icon |
@@ -744,6 +772,17 @@ private void updateConnectivity(Intent intent) { |
744 | 772 | } |
745 | 773 | updateSignalStrength(); // apply any change in mInetCondition |
746 | 774 | break; |
| 775 | + case ConnectivityManager.TYPE_WIMAX: |
| 776 | + mInetCondition = inetCondition; |
| 777 | + if (info.isConnected()) { |
| 778 | + mIsWimaxConnected = true; |
| 779 | + mService.setIconVisibility("wimax", true); |
| 780 | + } else { |
| 781 | + mIsWimaxConnected = false; |
| 782 | + mService.setIconVisibility("wimax", false); |
| 783 | + } |
| 784 | + updateWiMAX(intent); |
| 785 | + break; |
747 | 786 | } |
748 | 787 | } |
749 | 788 |
|
@@ -1124,6 +1163,17 @@ private final void updateWifi(Intent intent) { |
1124 | 1163 | } |
1125 | 1164 | } |
1126 | 1165 |
|
| 1166 | + private final void updateWiMAX(Intent intent) { |
| 1167 | + final String action = intent.getAction(); |
| 1168 | + int iconId = sDataNetType_4g[0][0]; |
| 1169 | + if (action.equals(WimaxManagerConstants.WIMAX_DATA_USED_ACTION)) { |
| 1170 | + int nUpDown = intent.getIntExtra(WimaxManagerConstants.EXTRA_UP_DOWN_DATA, 0); |
| 1171 | + iconId = sDataNetType_4g[mInetCondition][nUpDown]; |
| 1172 | + mService.setIcon("wimax", iconId, 0); |
| 1173 | + mService.setIconVisibility("wimax", mIsWimaxConnected); |
| 1174 | + } |
| 1175 | + } |
| 1176 | + |
1127 | 1177 | private final void updateGps(Intent intent) { |
1128 | 1178 | final String action = intent.getAction(); |
1129 | 1179 | final boolean enabled = intent.getBooleanExtra(LocationManager.EXTRA_GPS_ENABLED, false); |
|
0 commit comments