Merge "Update status bar icons for BT reverse tethering." into honeycomb
This commit is contained in:
committed by
Android (Google) Code Review
commit
0c84855334
@@ -108,4 +108,6 @@
|
|||||||
<!-- Recent apps label. Shown as title on recent apps panel -->
|
<!-- Recent apps label. Shown as title on recent apps panel -->
|
||||||
<string name="recent_tasks_app_label">Apps</string>
|
<string name="recent_tasks_app_label">Apps</string>
|
||||||
|
|
||||||
|
<!-- Network connection string for Bluetooth Reverse Tethering -->
|
||||||
|
<string name="bluetooth_tethered">Bluetooth tethered"</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
int mDataDirectionIconId;
|
int mDataDirectionIconId;
|
||||||
int mDataSignalIconId;
|
int mDataSignalIconId;
|
||||||
int mDataTypeIconId;
|
int mDataTypeIconId;
|
||||||
|
|
||||||
// wifi
|
// wifi
|
||||||
final WifiManager mWifiManager;
|
final WifiManager mWifiManager;
|
||||||
boolean mWifiEnabled, mWifiConnected;
|
boolean mWifiEnabled, mWifiConnected;
|
||||||
@@ -85,6 +85,11 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
String mWifiSsid;
|
String mWifiSsid;
|
||||||
int mWifiIconId;
|
int mWifiIconId;
|
||||||
|
|
||||||
|
// bluetooth
|
||||||
|
private boolean mBluetoothTethered = false;
|
||||||
|
private int mBluetoothTetherIconId =
|
||||||
|
com.android.internal.R.drawable.stat_sys_tether_bluetooth;
|
||||||
|
|
||||||
// data connectivity (regardless of state, can we access the internet?)
|
// data connectivity (regardless of state, can we access the internet?)
|
||||||
// state of inet connection - 0 not connected, 100 connected
|
// state of inet connection - 0 not connected, 100 connected
|
||||||
private int mInetCondition = 0;
|
private int mInetCondition = 0;
|
||||||
@@ -104,7 +109,7 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
int mLastCombinedSignalIconId = -1;
|
int mLastCombinedSignalIconId = -1;
|
||||||
int mLastDataTypeIconId = -1;
|
int mLastDataTypeIconId = -1;
|
||||||
String mLastLabel = "";
|
String mLastLabel = "";
|
||||||
|
|
||||||
// yuck -- stop doing this here and put it in the framework
|
// yuck -- stop doing this here and put it in the framework
|
||||||
IBatteryStats mBatteryStats;
|
IBatteryStats mBatteryStats;
|
||||||
|
|
||||||
@@ -235,7 +240,7 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
@Override
|
@Override
|
||||||
public void onDataConnectionStateChanged(int state, int networkType) {
|
public void onDataConnectionStateChanged(int state, int networkType) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.d(TAG, "onDataConnectionStateChanged: state=" + state
|
Slog.d(TAG, "onDataConnectionStateChanged: state=" + state
|
||||||
+ " type=" + networkType);
|
+ " type=" + networkType);
|
||||||
}
|
}
|
||||||
mDataState = state;
|
mDataState = state;
|
||||||
@@ -649,13 +654,22 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
mInetCondition = inetCondition;
|
mInetCondition = inetCondition;
|
||||||
updateWifiIcons();
|
updateWifiIcons();
|
||||||
break;
|
break;
|
||||||
|
case ConnectivityManager.TYPE_BLUETOOTH:
|
||||||
|
mInetCondition = inetCondition;
|
||||||
|
if (info != null) {
|
||||||
|
mBluetoothTethered = info.isConnected() ? true: false;
|
||||||
|
} else {
|
||||||
|
mBluetoothTethered = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ===== Update the views =======================================================
|
// ===== Update the views =======================================================
|
||||||
|
|
||||||
// figure out what to show: first wifi, then 3G, then nothing
|
// figure out what to show- there should be one connected network or nothing
|
||||||
|
// General order of preference is: wifi, 3G than bluetooth. This might vary by product.
|
||||||
void refreshViews() {
|
void refreshViews() {
|
||||||
Context context = mContext;
|
Context context = mContext;
|
||||||
|
|
||||||
@@ -672,12 +686,16 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
combinedSignalIconId = mWifiIconId;
|
combinedSignalIconId = mWifiIconId;
|
||||||
dataTypeIconId = 0;
|
dataTypeIconId = 0;
|
||||||
|
} else if (mDataConnected) {
|
||||||
|
label = mNetworkName;
|
||||||
|
combinedSignalIconId = mDataSignalIconId;
|
||||||
|
dataTypeIconId = mDataTypeIconId;
|
||||||
|
} else if (mBluetoothTethered) {
|
||||||
|
label = mContext.getString(R.string.bluetooth_tethered);
|
||||||
|
combinedSignalIconId = mBluetoothTetherIconId;
|
||||||
|
dataTypeIconId = 0;
|
||||||
} else {
|
} else {
|
||||||
if (mDataConnected) {
|
label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
|
||||||
label = mNetworkName;
|
|
||||||
} else {
|
|
||||||
label = context.getString(R.string.status_bar_settings_signal_meter_disconnected);
|
|
||||||
}
|
|
||||||
combinedSignalIconId = mDataSignalIconId;
|
combinedSignalIconId = mDataSignalIconId;
|
||||||
dataTypeIconId = mDataTypeIconId;
|
dataTypeIconId = mDataTypeIconId;
|
||||||
}
|
}
|
||||||
@@ -689,7 +707,8 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
+ " mDataDirectionIconId=0x" + Integer.toHexString(mDataDirectionIconId)
|
+ " mDataDirectionIconId=0x" + Integer.toHexString(mDataDirectionIconId)
|
||||||
+ " mDataSignalIconId=0x" + Integer.toHexString(mDataSignalIconId)
|
+ " mDataSignalIconId=0x" + Integer.toHexString(mDataSignalIconId)
|
||||||
+ " mDataTypeIconId=0x" + Integer.toHexString(mDataTypeIconId)
|
+ " mDataTypeIconId=0x" + Integer.toHexString(mDataTypeIconId)
|
||||||
+ " mWifiIconId=0x" + Integer.toHexString(mWifiIconId));
|
+ " mWifiIconId=0x" + Integer.toHexString(mWifiIconId)
|
||||||
|
+ "mBluetoothTetherIconId=0x" + Integer.toHexString(mBluetoothTetherIconId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// the phone icon on phones
|
// the phone icon on phones
|
||||||
@@ -809,6 +828,10 @@ public class NetworkController extends BroadcastReceiver {
|
|||||||
pw.print(" mWifiIconId=");
|
pw.print(" mWifiIconId=");
|
||||||
pw.println(mWifiIconId);
|
pw.println(mWifiIconId);
|
||||||
|
|
||||||
|
pw.println(" - Bluetooth ----");
|
||||||
|
pw.print(" mBtReverseTethered=");
|
||||||
|
pw.println(mBluetoothTethered);
|
||||||
|
|
||||||
pw.println(" - connectivity ------");
|
pw.println(" - connectivity ------");
|
||||||
pw.print(" mInetCondition=");
|
pw.print(" mInetCondition=");
|
||||||
pw.println(mInetCondition);
|
pw.println(mInetCondition);
|
||||||
|
|||||||
Reference in New Issue
Block a user