Merge change 21748 into eclair

* changes:
  Get At command count from Bluetooth headset.
This commit is contained in:
Android (Google) Code Review
2009-08-18 12:39:34 -07:00
2 changed files with 5 additions and 1 deletions

View File

@@ -978,10 +978,13 @@ public final class BatteryStatsImpl extends BatteryStats {
} else if (mBtHeadset != null) { } else if (mBtHeadset != null) {
return getCurrentBluetoothPingCount() - mBluetoothPingStart; return getCurrentBluetoothPingCount() - mBluetoothPingStart;
} }
return -1; return 0;
} }
public void setBtHeadset(BluetoothHeadset headset) { public void setBtHeadset(BluetoothHeadset headset) {
if (headset != null && mBtHeadset == null && isOnBattery() && mBluetoothPingStart == -1) {
mBluetoothPingStart = getCurrentBluetoothPingCount();
}
mBtHeadset = headset; mBtHeadset = headset;
} }

View File

@@ -260,6 +260,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub {
enforceCallingPermission(); enforceCallingPermission();
synchronized (mStats) { synchronized (mStats) {
mStats.noteBluetoothOnLocked(); mStats.noteBluetoothOnLocked();
mStats.setBtHeadset(new android.bluetooth.BluetoothHeadset(mContext, null));
} }
} }