diff options
author | Joey Grover <joeygrover@gmail.com> | 2019-09-24 11:48:17 -0400 |
---|---|---|
committer | Joey Grover <joeygrover@gmail.com> | 2019-09-24 11:48:17 -0400 |
commit | d5b3c985fc28d6b1bd59de0f429cf4e1041f8eeb (patch) | |
tree | bcfbaef04a577db021eca92cb0c2eaae48d62c5e /android/sdl_android/src/main/java | |
parent | 2a1049baee0ea2857fbbe2818436ca23f1b073a0 (diff) | |
download | sdl_android-d5b3c985fc28d6b1bd59de0f429cf4e1041f8eeb.tar.gz |
Fix lint issues
Diffstat (limited to 'android/sdl_android/src/main/java')
-rw-r--r-- | android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java | 18 |
1 files changed, 14 insertions, 4 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 fbd284faa..644cda21b 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 @@ -19,6 +19,7 @@ package com.smartdevicelink.transport; +import android.Manifest; import android.annotation.SuppressLint; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; @@ -28,6 +29,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.Message; +import android.support.annotation.RequiresPermission; import android.util.Log; import com.smartdevicelink.protocol.SdlPacket; @@ -40,6 +42,7 @@ import java.io.OutputStream; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.Arrays; import java.util.UUID; /** @@ -146,6 +149,8 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ /** * Start the chat service. Specifically start AcceptThread to begin a * session in listening (server) mode. Called by the Activity onResume() */ + @SuppressLint("MissingPermission") + @RequiresPermission(Manifest.permission.BLUETOOTH) public synchronized void start() { //Log.d(TAG, "Starting up Bluetooth Server to Listen"); // Cancel any thread attempting to make a connection @@ -202,6 +207,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ * @param socket The BluetoothSocket on which the connection was made * @param device The BluetoothDevice that has been connected */ + @RequiresPermission(Manifest.permission.BLUETOOTH) public synchronized void connected(BluetoothSocket socket, BluetoothDevice device) { // Cancel the thread that completed the connection if (mConnectThread != null) { @@ -284,7 +290,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ /** * Write to the ConnectedThread in an unsynchronized manner * @param out The bytes to write - * @see ConnectedThread#write(byte[]) + * @see ConnectedWriteThread#write(byte[],int,int) */ public void write(byte[] out, int offset, int count) { // Create temporary object @@ -356,7 +362,8 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ final BluetoothServerSocket mmServerSocket; @SuppressLint("NewApi") - public AcceptThread(boolean secure) { + @RequiresPermission(Manifest.permission.BLUETOOTH) + public AcceptThread(boolean secure) { synchronized(THREAD_LOCK){ //Log.d(TAG, "Creating an Accept Thread"); BluetoothServerSocket tmp = null; @@ -379,7 +386,8 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ //Log.d(TAG, "Accepting Connections on SDP Server Port Number: " + getChannel(mySock) + "\r\n"); } } - + + @RequiresPermission(Manifest.permission.BLUETOOTH) public void run() { synchronized(THREAD_LOCK){ Log.d(TAG, "Socket Type: " + mSocketType + @@ -475,6 +483,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ } + @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) public void attemptCancelDiscovery(){ try{ mAdapter.cancelDiscovery(); @@ -482,7 +491,8 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{ Log.e(TAG, "Don't have required permision to cancel discovery. Moving on"); } } - + + @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) public void run() { setName("ConnectThread"); // Always cancel discovery because it will slow down a connection |