From 93371d77c2237976df14765d3f54d6a36849370b Mon Sep 17 00:00:00 2001 From: Sungsoo Lim Date: Mon, 11 Sep 2023 05:35:47 +0000 Subject: Revert^2 "Remove the use of deprecasted methods" bd727c1e7ff4b9677b0d301af2b6fdcde619ecc4 Bug: 297983179 Change-Id: I13e0cb65b7e6c33325f93d05b11456f13006bb60 --- .../facade/bluetooth/BluetoothA2dpFacade.java | 6 +++--- .../facade/bluetooth/BluetoothA2dpSinkFacade.java | 6 +++--- .../facade/bluetooth/BluetoothHfpClientFacade.java | 8 ++++---- .../facade/bluetooth/BluetoothHidFacade.java | 4 ++-- .../facade/bluetooth/BluetoothMapClientFacade.java | 10 ++++++---- .../facade/bluetooth/BluetoothMapFacade.java | 11 ++++++----- .../facade/bluetooth/BluetoothPbapClientFacade.java | 6 +++--- 7 files changed, 27 insertions(+), 24 deletions(-) diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpFacade.java index 0a40f9e7..2c200d3e 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpFacade.java @@ -129,8 +129,8 @@ public class BluetoothA2dpFacade extends RpcReceiver { */ public Boolean a2dpDisconnect(BluetoothDevice device) { if (sA2dpProfile == null) return false; - if (sA2dpProfile.getPriority(device) > BluetoothProfile.PRIORITY_ON) { - sA2dpProfile.setPriority(device, BluetoothProfile.PRIORITY_ON); + if (sA2dpProfile.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { + sA2dpProfile.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return sA2dpProfile.disconnect(device); } @@ -162,7 +162,7 @@ public class BluetoothA2dpFacade extends RpcReceiver { BluetoothDevice device = BluetoothFacade.getDevice(mBluetoothAdapter.getBondedDevices(), deviceStr); Log.d("Changing priority of device " + device.getAlias() + " p: " + priority); - sA2dpProfile.setPriority(device, priority); + sA2dpProfile.setConnectionPolicy(device, priority); } diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpSinkFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpSinkFacade.java index 26124bfe..c725464b 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpSinkFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothA2dpSinkFacade.java @@ -101,7 +101,7 @@ public class BluetoothA2dpSinkFacade extends RpcReceiver { mBluetoothAdapter.getBondedDevices(), deviceStr); Log.d("Changing priority of device " + device.getAlias() + " p: " + priority); - sA2dpSinkProfile.setPriority(device, priority); + sA2dpSinkProfile.setConnectionPolicy(device, priority); } /** @@ -114,11 +114,11 @@ public class BluetoothA2dpSinkFacade extends RpcReceiver { @RpcParameter(name = "device", description = "Mac address of a BT device.") String deviceStr) throws Exception { - if (sA2dpSinkProfile == null) return BluetoothProfile.PRIORITY_UNDEFINED; + if (sA2dpSinkProfile == null) return BluetoothProfile.CONNECTION_POLICY_UNKNOWN; BluetoothDevice device = BluetoothFacade.getDevice( mBluetoothAdapter.getBondedDevices(), deviceStr); - return sA2dpSinkProfile.getPriority(device); + return sA2dpSinkProfile.getConnectionPolicy(device); } /** diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHfpClientFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHfpClientFacade.java index 8c6f93f8..0eb0e2fe 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHfpClientFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHfpClientFacade.java @@ -114,7 +114,7 @@ public class BluetoothHfpClientFacade extends RpcReceiver { deviceStr); Log.d("Changing priority of device " + device.getAlias() + " p: " + priority); - sHfpClientProfile.setPriority(device, priority); + sHfpClientProfile.setConnectionPolicy(device, priority); } /** @@ -127,10 +127,10 @@ public class BluetoothHfpClientFacade extends RpcReceiver { @RpcParameter(name = "device", description = "Mac address of a BT device.") String deviceStr) throws Exception { - if (sHfpClientProfile == null) return BluetoothProfile.PRIORITY_UNDEFINED; + if (sHfpClientProfile == null) return BluetoothProfile.CONNECTION_POLICY_UNKNOWN; BluetoothDevice device = BluetoothFacade.getDevice( mBluetoothAdapter.getBondedDevices(), deviceStr); - return sHfpClientProfile.getPriority(device); + return sHfpClientProfile.getConnectionPolicy(device); } /** @@ -392,4 +392,4 @@ public class BluetoothHfpClientFacade extends RpcReceiver { @Override public void shutdown() { } -} \ No newline at end of file +} diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHidFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHidFacade.java index 6829c90c..968e471c 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHidFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothHidFacade.java @@ -347,7 +347,7 @@ public class BluetoothHidFacade extends RpcReceiver { Integer priority) throws Exception { BluetoothDevice device = BluetoothFacade.getDevice(sHidProfile.getConnectedDevices(), deviceID); - return sHidProfile.setPriority(device, priority); + return sHidProfile.setConnectionPolicy(device, priority); } /** @@ -363,7 +363,7 @@ public class BluetoothHidFacade extends RpcReceiver { String deviceID) throws Exception { BluetoothDevice device = BluetoothFacade.getDevice(sHidProfile.getConnectedDevices(), deviceID); - return sHidProfile.getPriority(device); + return sHidProfile.getConnectionPolicy(device); } /** diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapClientFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapClientFacade.java index aaeac4c7..e0e80e04 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapClientFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapClientFacade.java @@ -157,8 +157,8 @@ public class BluetoothMapClientFacade extends RpcReceiver { } public Boolean mapDisconnect(BluetoothDevice device) { - if (sMapProfile.getPriority(device) > BluetoothProfile.PRIORITY_ON) { - sMapProfile.setPriority(device, BluetoothProfile.PRIORITY_ON); + if (sMapProfile.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { + sMapProfile.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return sMapProfile.disconnect(device); } @@ -182,8 +182,10 @@ public class BluetoothMapClientFacade extends RpcReceiver { connectedMapDevices, deviceID); if (!connectedMapDevices.isEmpty() && connectedMapDevices.get(0).equals(mDevice)) { - if (sMapProfile.getPriority(mDevice) > BluetoothProfile.PRIORITY_ON) { - sMapProfile.setPriority(mDevice, BluetoothProfile.PRIORITY_ON); + if (sMapProfile.getConnectionPolicy(mDevice) + > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { + sMapProfile.setConnectionPolicy( + mDevice, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return sMapProfile.disconnect(mDevice); } else { diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapFacade.java index e3fe007b..2e7c534a 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothMapFacade.java @@ -71,8 +71,8 @@ public class BluetoothMapFacade extends RpcReceiver { * @return if the disconnection was successfull or not. */ public Boolean mapDisconnect(BluetoothDevice device) { - if (sMapProfile.getPriority(device) > BluetoothProfile.PRIORITY_ON) { - sMapProfile.setPriority(device, BluetoothProfile.PRIORITY_ON); + if (sMapProfile.getConnectionPolicy(device) > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { + sMapProfile.setConnectionPolicy(device, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return sMapProfile.disconnect(device); } @@ -103,9 +103,10 @@ public class BluetoothMapFacade extends RpcReceiver { BluetoothDevice mDevice = BluetoothFacade.getDevice(connectedMapDevices, deviceID); if (!connectedMapDevices.isEmpty() && connectedMapDevices.get(0).equals(mDevice)) { - if (sMapProfile.getPriority(mDevice) - > BluetoothProfile.PRIORITY_ON) { - sMapProfile.setPriority(mDevice, BluetoothProfile.PRIORITY_ON); + if (sMapProfile.getConnectionPolicy(mDevice) + > BluetoothProfile.CONNECTION_POLICY_ALLOWED) { + sMapProfile.setConnectionPolicy( + mDevice, BluetoothProfile.CONNECTION_POLICY_ALLOWED); } return sMapProfile.disconnect(mDevice); } else { diff --git a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothPbapClientFacade.java b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothPbapClientFacade.java index 979a1384..717926e9 100644 --- a/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothPbapClientFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/bluetooth/BluetoothPbapClientFacade.java @@ -115,7 +115,7 @@ public class BluetoothPbapClientFacade extends RpcReceiver { deviceStr); Log.d("Changing priority of device " + device.getAlias() + " p: " + priority); - sPbapClientProfile.setPriority(device, priority); + sPbapClientProfile.setConnectionPolicy(device, priority); } /** @@ -128,12 +128,12 @@ public class BluetoothPbapClientFacade extends RpcReceiver { description = "Mac address of a BT device.") String deviceStr) throws Exception { if (sPbapClientProfile == null) { - return BluetoothProfile.PRIORITY_UNDEFINED; + return BluetoothProfile.CONNECTION_POLICY_UNKNOWN; } BluetoothDevice device = BluetoothFacade.getDevice(mBluetoothAdapter.getBondedDevices(), deviceStr); - return sPbapClientProfile.getPriority(device); + return sPbapClientProfile.getConnectionPolicy(device); } /** -- cgit v1.2.3