Remove unused mContext from BluetoothGatt[Server].

All that this member variable is doing right now is leaking a
reference to a context without any benefit.

Bug: 31752040
Bug: 31710795
Change-Id: If2241422533318b866340e8dcc9f5fbd9518349c
This commit is contained in:
Jeremy Klein
2016-09-27 14:34:33 -07:00
committed by Andre Eisenbach
parent 4e236046ae
commit adc26ec1b4
4 changed files with 4 additions and 8 deletions

View File

@@ -1596,7 +1596,7 @@ public final class BluetoothDevice implements Parcelable {
// BLE is not supported // BLE is not supported
return null; return null;
} }
BluetoothGatt gatt = new BluetoothGatt(context, iGatt, this, transport); BluetoothGatt gatt = new BluetoothGatt(iGatt, this, transport);
gatt.connect(autoConnect, callback); gatt.connect(autoConnect, callback);
return gatt; return gatt;
} catch (RemoteException e) {Log.e(TAG, "", e);} } catch (RemoteException e) {Log.e(TAG, "", e);}

View File

@@ -41,7 +41,6 @@ public final class BluetoothGatt implements BluetoothProfile {
private static final boolean DBG = true; private static final boolean DBG = true;
private static final boolean VDBG = false; private static final boolean VDBG = false;
private final Context mContext;
private IBluetoothGatt mService; private IBluetoothGatt mService;
private BluetoothGattCallback mCallback; private BluetoothGattCallback mCallback;
private int mClientIf; private int mClientIf;
@@ -496,9 +495,8 @@ public final class BluetoothGatt implements BluetoothProfile {
} }
}; };
/*package*/ BluetoothGatt(Context context, IBluetoothGatt iGatt, BluetoothDevice device, /*package*/ BluetoothGatt(IBluetoothGatt iGatt, BluetoothDevice device,
int transport) { int transport) {
mContext = context;
mService = iGatt; mService = iGatt;
mDevice = device; mDevice = device;
mTransport = transport; mTransport = transport;

View File

@@ -44,7 +44,6 @@ public final class BluetoothGattServer implements BluetoothProfile {
private static final boolean DBG = true; private static final boolean DBG = true;
private static final boolean VDBG = false; private static final boolean VDBG = false;
private final Context mContext;
private BluetoothAdapter mAdapter; private BluetoothAdapter mAdapter;
private IBluetoothGatt mService; private IBluetoothGatt mService;
private BluetoothGattServerCallback mCallback; private BluetoothGattServerCallback mCallback;
@@ -307,8 +306,7 @@ public final class BluetoothGattServer implements BluetoothProfile {
/** /**
* Create a BluetoothGattServer proxy object. * Create a BluetoothGattServer proxy object.
*/ */
/*package*/ BluetoothGattServer(Context context, IBluetoothGatt iGatt, int transport) { /*package*/ BluetoothGattServer(IBluetoothGatt iGatt, int transport) {
mContext = context;
mService = iGatt; mService = iGatt;
mAdapter = BluetoothAdapter.getDefaultAdapter(); mAdapter = BluetoothAdapter.getDefaultAdapter();
mCallback = null; mCallback = null;

View File

@@ -236,7 +236,7 @@ public final class BluetoothManager {
Log.e(TAG, "Fail to get GATT Server connection"); Log.e(TAG, "Fail to get GATT Server connection");
return null; return null;
} }
BluetoothGattServer mGattServer = new BluetoothGattServer(context, iGatt,transport); BluetoothGattServer mGattServer = new BluetoothGattServer(iGatt,transport);
Boolean regStatus = mGattServer.registerCallback(callback); Boolean regStatus = mGattServer.registerCallback(callback);
return regStatus? mGattServer : null; return regStatus? mGattServer : null;
} catch (RemoteException e) { } catch (RemoteException e) {