am a5c742bf: Merge "Update local cache before sending intent." into gingerbread
Merge commit 'a5c742bfd08df55849418cd1c77065ac54d83502' into gingerbread-plus-aosp * commit 'a5c742bfd08df55849418cd1c77065ac54d83502': Update local cache before sending intent.
This commit is contained in:
@@ -235,10 +235,10 @@ class BluetoothEventLoop {
|
|||||||
}
|
}
|
||||||
String name = propValues[0];
|
String name = propValues[0];
|
||||||
if (name.equals("Name")) {
|
if (name.equals("Name")) {
|
||||||
|
mBluetoothService.setProperty(name, propValues[1]);
|
||||||
Intent intent = new Intent(BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED);
|
Intent intent = new Intent(BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED);
|
||||||
intent.putExtra(BluetoothAdapter.EXTRA_LOCAL_NAME, propValues[1]);
|
intent.putExtra(BluetoothAdapter.EXTRA_LOCAL_NAME, propValues[1]);
|
||||||
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
|
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
|
||||||
mBluetoothService.setProperty(name, propValues[1]);
|
|
||||||
} else if (name.equals("Pairable") || name.equals("Discoverable")) {
|
} else if (name.equals("Pairable") || name.equals("Discoverable")) {
|
||||||
String pairable = name.equals("Pairable") ? propValues[1] :
|
String pairable = name.equals("Pairable") ? propValues[1] :
|
||||||
mBluetoothService.getPropertyInternal("Pairable");
|
mBluetoothService.getPropertyInternal("Pairable");
|
||||||
@@ -249,6 +249,7 @@ class BluetoothEventLoop {
|
|||||||
if (pairable == null || discoverable == null)
|
if (pairable == null || discoverable == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
mBluetoothService.setProperty(name, propValues[1]);
|
||||||
int mode = BluetoothService.bluezStringToScanMode(
|
int mode = BluetoothService.bluezStringToScanMode(
|
||||||
pairable.equals("true"),
|
pairable.equals("true"),
|
||||||
discoverable.equals("true"));
|
discoverable.equals("true"));
|
||||||
@@ -258,9 +259,9 @@ class BluetoothEventLoop {
|
|||||||
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
|
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
|
||||||
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
|
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
|
||||||
}
|
}
|
||||||
mBluetoothService.setProperty(name, propValues[1]);
|
|
||||||
} else if (name.equals("Discovering")) {
|
} else if (name.equals("Discovering")) {
|
||||||
Intent intent;
|
Intent intent;
|
||||||
|
mBluetoothService.setProperty(name, propValues[1]);
|
||||||
if (propValues[1].equals("true")) {
|
if (propValues[1].equals("true")) {
|
||||||
mBluetoothService.setIsDiscovering(true);
|
mBluetoothService.setIsDiscovering(true);
|
||||||
intent = new Intent(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
|
intent = new Intent(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
|
||||||
@@ -271,7 +272,6 @@ class BluetoothEventLoop {
|
|||||||
intent = new Intent(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
|
intent = new Intent(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
|
||||||
}
|
}
|
||||||
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
|
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
|
||||||
mBluetoothService.setProperty(name, propValues[1]);
|
|
||||||
} else if (name.equals("Devices")) {
|
} else if (name.equals("Devices")) {
|
||||||
String value = null;
|
String value = null;
|
||||||
int len = Integer.valueOf(propValues[1]);
|
int len = Integer.valueOf(propValues[1]);
|
||||||
@@ -304,19 +304,20 @@ class BluetoothEventLoop {
|
|||||||
}
|
}
|
||||||
BluetoothDevice device = mAdapter.getRemoteDevice(address);
|
BluetoothDevice device = mAdapter.getRemoteDevice(address);
|
||||||
if (name.equals("Name")) {
|
if (name.equals("Name")) {
|
||||||
|
mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]);
|
||||||
Intent intent = new Intent(BluetoothDevice.ACTION_NAME_CHANGED);
|
Intent intent = new Intent(BluetoothDevice.ACTION_NAME_CHANGED);
|
||||||
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
|
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
|
||||||
intent.putExtra(BluetoothDevice.EXTRA_NAME, propValues[1]);
|
intent.putExtra(BluetoothDevice.EXTRA_NAME, propValues[1]);
|
||||||
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
|
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
|
||||||
mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]);
|
|
||||||
} else if (name.equals("Class")) {
|
} else if (name.equals("Class")) {
|
||||||
|
mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]);
|
||||||
Intent intent = new Intent(BluetoothDevice.ACTION_CLASS_CHANGED);
|
Intent intent = new Intent(BluetoothDevice.ACTION_CLASS_CHANGED);
|
||||||
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
|
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
|
||||||
intent.putExtra(BluetoothDevice.EXTRA_CLASS,
|
intent.putExtra(BluetoothDevice.EXTRA_CLASS,
|
||||||
new BluetoothClass(Integer.valueOf(propValues[1])));
|
new BluetoothClass(Integer.valueOf(propValues[1])));
|
||||||
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
|
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
|
||||||
mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]);
|
|
||||||
} else if (name.equals("Connected")) {
|
} else if (name.equals("Connected")) {
|
||||||
|
mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]);
|
||||||
Intent intent = null;
|
Intent intent = null;
|
||||||
if (propValues[1].equals("true")) {
|
if (propValues[1].equals("true")) {
|
||||||
intent = new Intent(BluetoothDevice.ACTION_ACL_CONNECTED);
|
intent = new Intent(BluetoothDevice.ACTION_ACL_CONNECTED);
|
||||||
@@ -330,7 +331,6 @@ class BluetoothEventLoop {
|
|||||||
}
|
}
|
||||||
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
|
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
|
||||||
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
|
mContext.sendBroadcast(intent, BLUETOOTH_PERM);
|
||||||
mBluetoothService.setRemoteDeviceProperty(address, name, propValues[1]);
|
|
||||||
} else if (name.equals("UUIDs")) {
|
} else if (name.equals("UUIDs")) {
|
||||||
String uuid = null;
|
String uuid = null;
|
||||||
int len = Integer.valueOf(propValues[1]);
|
int len = Integer.valueOf(propValues[1]);
|
||||||
|
|||||||
Reference in New Issue
Block a user