Snap for 10103804 from e72d0b88c6b4dacf2789f39b418e95829a8f9145 to mainline-tzdata5-release
Change-Id: I360175ff62b4e16746cea5c905d97143e660ff60
diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothConnectionFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothConnectionFacade.java
index 8e54d81..33a667e 100644
--- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothConnectionFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothConnectionFacade.java
@@ -635,32 +635,39 @@
}
/**
- * Bond to a device using Out of Band Data over LE transport.
+ * Bond to a device using Out of Band Data over LE transport. Note that there is a distinction
+ * between the address with type supplied in the oob data and the address and type of the
+ * BluetoothDevice object.
*
- * @param address String representation of address like "00:11:22:33:44:55"
+ * @param oobDataAddress is the MAC address to be used in the oob data
+ * @param oobDataAddressType is the BluetoothDevice.AddressType for the oob data MAC address
* @param transport String "1", "2", "3" to match TRANSPORT_*
* @param c Hex String of the 16 octet confirmation
* @param r Hex String of the 16 octet randomizer
- * @param addressType type of address provided to match BluetoothDevice#ADDRESS_TYPE_*
+ * @param address String representation of MAC address for the BluetoothDevice object
+ * @param addressType the BluetoothDevice.AddressType for the BluetoothDevice object
*/
@Rpc(description = "Creates and Out of Band LE bond.")
- public void bluetoothCreateLeBondOutOfBand(@RpcParameter(name = "address") String address,
+ public boolean bluetoothCreateLeBondOutOfBand(
+ @RpcParameter(name = "oobDataAddress") String oobDataAddress,
+ @RpcParameter(name = "oobDataAddressType") Integer oobDataAddressType,
@RpcParameter(name = "c") String c, @RpcParameter(name = "r") String r,
+ @RpcParameter(name = "address") String address,
@RpcParameter(name = "addressType") @RpcDefault("1") Integer addressType) {
Log.d("bluetoothCreateLeBondOutOfBand(" + address + ", " + addressType + "," + c + ", "
+ r + ")");
BluetoothDevice remoteDevice = mBluetoothAdapter.getRemoteLeDevice(address, addressType);
byte[] addressBytes = new byte[7];
int i = 0;
- for (String s : address.split(":")) {
+ for (String s : oobDataAddress.split(":")) {
addressBytes[i] = hexStringToByteArray(s)[0];
i++;
}
- // Inserts the address type if one is provided
- if (addressType == BluetoothDevice.ADDRESS_TYPE_PUBLIC
- || addressType == BluetoothDevice.ADDRESS_TYPE_RANDOM) {
- addressBytes[i] = addressType.byteValue();
+ // Inserts the oob address type if one is provided
+ if (oobDataAddressType == BluetoothDevice.ADDRESS_TYPE_PUBLIC
+ || oobDataAddressType == BluetoothDevice.ADDRESS_TYPE_RANDOM) {
+ addressBytes[i] = oobDataAddressType.byteValue();
}
OobData p192 = null;
@@ -670,7 +677,7 @@
.build();
mContext.registerReceiver(new BondBroadcastReceiver(),
new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
- remoteDevice.createBondOutOfBand(BluetoothDevice.TRANSPORT_LE, p192, p256);
+ return remoteDevice.createBondOutOfBand(BluetoothDevice.TRANSPORT_LE, p192, p256);
}
private class BondBroadcastReceiver extends BroadcastReceiver {
diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothSocketConnFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothSocketConnFacade.java
index 18ca858..49efe6c 100644
--- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothSocketConnFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothSocketConnFacade.java
@@ -21,6 +21,7 @@
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
+import android.os.Bundle;
import com.googlecode.android_scripting.Log;
import com.googlecode.android_scripting.facade.EventFacade;
@@ -55,6 +56,9 @@
private AcceptThread mAcceptThread;
private byte mTxPktIndex = 0;
+ private final Bundle mGoodNews;
+ private final Bundle mBadNews;
+
private static final String DEFAULT_PSM = "161"; //=0x00A1
// UUID for SL4A.
@@ -68,6 +72,11 @@
mEventFacade = manager.getReceiver(EventFacade.class);
mService = manager.getService();
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+
+ mGoodNews = new Bundle();
+ mGoodNews.putBoolean("Status", true);
+ mBadNews = new Bundle();
+ mBadNews.putBoolean("Status", false);
}
private BluetoothConnection getConnection(String connID) throws IOException {
@@ -731,9 +740,15 @@
mConnUuid = addConnection(conn);
Log.d("ConnectThread:run: isConnected=" + mSocket.isConnected() + ", address="
+ mSocket.getRemoteDevice().getAddress() + ", uuid=" + mConnUuid);
+ if (mSocket.isConnected()) {
+ mEventFacade.postEvent("BluetoothSocketConnectSuccess", mGoodNews);
+ } else {
+ mEventFacade.postEvent("BluetoothSocketConnectError", mBadNews);
+ }
} catch (IOException connectException) {
Log.e("ConnectThread::run(): Error: Connection Unsuccessful");
cancel();
+ mEventFacade.postEvent("BluetoothSocketConnectError", mBadNews);
return;
}
}
diff --git a/Common/src/com/googlecode/android_scripting/facade/uwb/UwbManagerFacade.java b/Common/src/com/googlecode/android_scripting/facade/uwb/UwbManagerFacade.java
index 9f6c6da..03a9a29 100644
--- a/Common/src/com/googlecode/android_scripting/facade/uwb/UwbManagerFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/uwb/UwbManagerFacade.java
@@ -430,7 +430,7 @@
builder.setDestAddressList(Arrays.asList(destinationUwbAddresses));
}
if (j.has("initiationTimeMs")) {
- builder.setInitiationTimeMs(j.getInt("initiationTimeMs"));
+ builder.setInitiationTime(j.getInt("initiationTimeMs"));
}
if (j.has("slotDurationRstu")) {
builder.setSlotDurationRstu(j.getInt("slotDurationRstu"));
diff --git a/ScriptingLayerForAndroid/AndroidManifest.xml b/ScriptingLayerForAndroid/AndroidManifest.xml
index de7442d..e937bcf 100644
--- a/ScriptingLayerForAndroid/AndroidManifest.xml
+++ b/ScriptingLayerForAndroid/AndroidManifest.xml
@@ -132,6 +132,7 @@
android:icon="@drawable/sl4a_logo_48"
android:label="@string/application_title"
android:name=".Sl4aApplication"
+ android:testOnly="true"
android:theme="@android:style/Theme.DeviceDefault"
android:usesCleartextTraffic="true">
<activity android:name=".activity.ScriptManager" android:configChanges="keyboardHidden|orientation" android:windowSoftInputMode="adjustResize" android:launchMode="singleTop" android:exported="true">