diff options
author | Julian Kast <julian@livio.com> | 2020-09-03 14:58:53 -0400 |
---|---|---|
committer | Julian Kast <julian@livio.com> | 2020-09-03 14:58:53 -0400 |
commit | 36051b6f5fcd1f7082328f7b6a701974c8cd21ba (patch) | |
tree | ef21813223d0061112ccc0ed91809bc9e160bac1 | |
parent | 690bd44878ec3d428b096b6bd93e432175ffb4b4 (diff) | |
download | sdl_android-remove_deprecated_APIs_transport.tar.gz |
Removed getBluetoothPrefs and setBluetoothPrefs from SdlRouterService and all calls from MultiplexBluetoothTransportremove_deprecated_APIs_transport
2 files changed, 2 insertions, 48 deletions
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java index 138b1adb2..7a61a627e 100644 --- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java +++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java @@ -85,8 +85,6 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ */ public MultiplexBluetoothTransport(Handler handler) { super(handler, TransportType.BLUETOOTH); - //This will keep track of which method worked last night - mBluetoothLevel = SdlRouterService.getBluetoothPrefs(SHARED_PREFS); } //These methods are used so we can have a semi-static reference to the Accept Thread (Static reference inherited by housing class) @@ -487,7 +485,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ try { // This is a blocking call and will only return on a // successful connection or an exception - mBluetoothLevel = SdlRouterService.getBluetoothPrefs(SHARED_PREFS); + mBluetoothLevel = 0; long waitTime = 3000; try { Thread.sleep(waitTime); @@ -503,7 +501,6 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ if(mBluetoothLevel<=1){ try { - SdlRouterService.setBluetoothPrefs(2,SHARED_PREFS); Method m = mmDevice.getClass().getMethod("createRfcommSocket", new Class[] {int.class}); //Log.i(TAG,"connecting using createRfcommSocket"); mmSocket = (BluetoothSocket) m.invoke(mmDevice, Integer.valueOf(1)); @@ -517,14 +514,10 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ Looper.myLooper().quit(); } success=true; - SdlRouterService.setBluetoothPrefs(1,SHARED_PREFS); break; } else{trySecure = true;} } catch (Exception e) { - //Log.e(TAG,"createRfcommSocket exception - " + e.toString()); - SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS); - trySecure = true; try { Thread.sleep(500); @@ -535,7 +528,6 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ }else{trySecure = true;} if(trySecure && mBluetoothLevel<=2){ try { - SdlRouterService.setBluetoothPrefs(3,SHARED_PREFS); //Log.i(TAG, "connecting using createRfcommSocketToServiceRecord "); mmSocket = mmDevice.createRfcommSocketToServiceRecord(SERVER_UUID); if(mmSocket!=null){ @@ -548,25 +540,19 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ Looper.myLooper().quit(); } success=true; - SdlRouterService.setBluetoothPrefs(2,SHARED_PREFS); break; }else{tryInsecure = true;} } catch (IOException io) { tryInsecure = true; DebugTool.logError(TAG, "createRfcommSocketToServiceRecord exception - " + io.toString()); - SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS); - } catch (Exception e){ DebugTool.logError(TAG, "createRfcommSocketToServiceRecord exception - " + e.toString()); - SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS); - } }else{tryInsecure = true;} if (tryInsecure && mBluetoothLevel<=3) { // try again using insecure comm if available try { - SdlRouterService.setBluetoothPrefs(4,SHARED_PREFS); //Log.i(TAG,"connecting using createInsecureRfcommSocketToServiceRecord"); Method m = mmDevice.getClass().getMethod("createInsecureRfcommSocketToServiceRecord", new Class[] {UUID.class}); mmSocket = (BluetoothSocket) m.invoke(mmDevice, new Object[] {SERVER_UUID}); @@ -580,24 +566,19 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ } success=true; tryInsecure = false; - SdlRouterService.setBluetoothPrefs(3,SHARED_PREFS); break; } catch (NoSuchMethodException ie) { - SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS); } catch (IllegalAccessException ie) { - SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS); } catch (InvocationTargetException ie) { - SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS); } } if (tryInsecure && mBluetoothLevel<=4) { // try again using insecure comm if available try { - SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS); //Log.i(TAG,"connecting using createInsecureRfcommSocket()"); Method m = mmDevice.getClass().getMethod("createInsecureRfcommSocket()", new Class[] {UUID.class}); mmSocket = (BluetoothSocket) m.invoke(mmDevice, new Object[] {SERVER_UUID}); - //Looper.prepare(); + //Looper.prepare(); timerDelayRemoveDialog(mmSocket); //Looper.loop(); mmSocket.connect(); @@ -606,14 +587,10 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ Looper.myLooper().quit(); } success=true; - SdlRouterService.setBluetoothPrefs(4,SHARED_PREFS); break; } catch (NoSuchMethodException ie) { - SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS); } catch (IllegalAccessException ie) { - SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS); } catch (InvocationTargetException ie) { - SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS); } } } catch (IOException e) { diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java index 2d36b2ebb..0178eb140 100644 --- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java +++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java @@ -2398,29 +2398,6 @@ public class SdlRouterService extends Service{ //************************************************************************************************************************************** //********************************************************* PREFERENCES **************************************************************** //************************************************************************************************************************************** - /** - * @deprecated - * This method will set the last known bluetooth connection method that worked with this phone. - * This helps speed up the process of connecting - * @param level The level of bluetooth connecting method that last worked - * @param prefLocation Where the preference should be stored - */ - @SuppressWarnings("DeprecatedIsStillUsed") - @Deprecated - public static void setBluetoothPrefs (int level, String prefLocation) { - DebugTool.logWarning(TAG, "This method is deprecated and will not take any action"); - } - - /** - * @deprecated - * This method has been deprecated as it was bad practice. - */ - @SuppressWarnings({"DeprecatedIsStillUsed", "SameReturnValue"}) - @Deprecated - public static int getBluetoothPrefs(String prefLocation) - { - return 0; - } /** * Set the connection establishment status of the particular device |