am 0c75b2d2: Merge change I80790bdb into eclair

Merge commit '0c75b2d2dc35b88d5cb9db96afc72ed074ca5350' into eclair-mr2

* commit '0c75b2d2dc35b88d5cb9db96afc72ed074ca5350':
  b/2296110 Dialog for setting up dock audio.
This commit is contained in:
Michael Chan
2009-12-07 20:50:32 -08:00
committed by Android Git Automerger
8 changed files with 667 additions and 453 deletions

View File

@@ -227,44 +227,46 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
}
public void onProfileStateChanged(Profile profile, int newProfileState) {
if (D) {
Log.d(TAG, "onProfileStateChanged:" + workQueue.toString());
}
int newState = LocalBluetoothProfileManager.getProfileManager(mLocalManager,
profile).convertState(newProfileState);
if (newState == SettingsBtStatus.CONNECTION_STATUS_CONNECTED) {
if (!mProfiles.contains(profile)) {
mProfiles.add(profile);
synchronized (workQueue) {
if (D) {
Log.d(TAG, "onProfileStateChanged:" + workQueue.toString());
}
}
/* Ignore the transient states e.g. connecting, disconnecting */
if (newState == SettingsBtStatus.CONNECTION_STATUS_CONNECTED ||
newState == SettingsBtStatus.CONNECTION_STATUS_DISCONNECTED) {
BluetoothJob job = workQueue.peek();
if (job == null) {
return;
} else if (!job.cachedDevice.mDevice.equals(mDevice)) {
// This can happen in 2 cases: 1) BT device initiated pairing and
// 2) disconnects of one headset that's triggered by connects of
// another.
if (D) {
Log.d(TAG, "mDevice:" + mDevice + " != head:" + job.toString());
int newState = LocalBluetoothProfileManager.getProfileManager(mLocalManager,
profile).convertState(newProfileState);
if (newState == SettingsBtStatus.CONNECTION_STATUS_CONNECTED) {
if (!mProfiles.contains(profile)) {
mProfiles.add(profile);
}
}
// Check to see if we need to remove the stale items from the queue
if (!pruneQueue(null)) {
// nothing in the queue was modify. Just ignore the notification and return.
/* Ignore the transient states e.g. connecting, disconnecting */
if (newState == SettingsBtStatus.CONNECTION_STATUS_CONNECTED ||
newState == SettingsBtStatus.CONNECTION_STATUS_DISCONNECTED) {
BluetoothJob job = workQueue.peek();
if (job == null) {
return;
}
} else {
// Remove the first item and process the next one
workQueue.poll();
}
} else if (!job.cachedDevice.mDevice.equals(mDevice)) {
// This can happen in 2 cases: 1) BT device initiated pairing and
// 2) disconnects of one headset that's triggered by connects of
// another.
if (D) {
Log.d(TAG, "mDevice:" + mDevice + " != head:" + job.toString());
}
processCommands();
// Check to see if we need to remove the stale items from the queue
if (!pruneQueue(null)) {
// nothing in the queue was modify. Just ignore the notification and return.
return;
}
} else {
// Remove the first item and process the next one
workQueue.poll();
}
processCommands();
}
}
}