Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothRemoteGattCharacteristic.java

Issue 1618273002: Call BluetoothGatt#close() after disconnecting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call parent class' TearDown Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.device.bluetooth; 5 package org.chromium.device.bluetooth;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.bluetooth.BluetoothGattCharacteristic; 8 import android.bluetooth.BluetoothGattCharacteristic;
9 import android.bluetooth.BluetoothGattDescriptor; 9 import android.bluetooth.BluetoothGattDescriptor;
10 import android.os.Build; 10 import android.os.Build;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 Log.v(TAG, "ChromeBluetoothRemoteGattCharacteristic created."); 48 Log.v(TAG, "ChromeBluetoothRemoteGattCharacteristic created.");
49 } 49 }
50 50
51 /** 51 /**
52 * Handles C++ object being destroyed. 52 * Handles C++ object being destroyed.
53 */ 53 */
54 @CalledByNative 54 @CalledByNative
55 private void onBluetoothRemoteGattCharacteristicAndroidDestruction() { 55 private void onBluetoothRemoteGattCharacteristicAndroidDestruction() {
56 Log.v(TAG, "ChromeBluetoothRemoteGattCharacteristic Destroyed."); 56 Log.v(TAG, "ChromeBluetoothRemoteGattCharacteristic Destroyed.");
57 mChromeDevice.mBluetoothGatt.setCharacteristicNotification(mCharacterist ic, false); 57 if (mChromeDevice.mBluetoothGatt != null) {
58 mChromeDevice.mBluetoothGatt.setCharacteristicNotification(mCharacte ristic, false);
59 }
58 mNativeBluetoothRemoteGattCharacteristicAndroid = 0; 60 mNativeBluetoothRemoteGattCharacteristicAndroid = 0;
59 mChromeDevice.mWrapperToChromeCharacteristicsMap.remove(mCharacteristic) ; 61 mChromeDevice.mWrapperToChromeCharacteristicsMap.remove(mCharacteristic) ;
60 } 62 }
61 63
62 void onCharacteristicChanged() { 64 void onCharacteristicChanged() {
63 Log.i(TAG, "onCharacteristicChanged"); 65 Log.i(TAG, "onCharacteristicChanged");
64 if (mNativeBluetoothRemoteGattCharacteristicAndroid != 0) { 66 if (mNativeBluetoothRemoteGattCharacteristicAndroid != 0) {
65 nativeOnChanged( 67 nativeOnChanged(
66 mNativeBluetoothRemoteGattCharacteristicAndroid, mCharacteri stic.getValue()); 68 mNativeBluetoothRemoteGattCharacteristicAndroid, mCharacteri stic.getValue());
67 } 69 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 211
210 // Binds to BluetoothRemoteGattCharacteristicAndroid::OnWrite. 212 // Binds to BluetoothRemoteGattCharacteristicAndroid::OnWrite.
211 native void nativeOnWrite(long nativeBluetoothRemoteGattCharacteristicAndroi d, int status); 213 native void nativeOnWrite(long nativeBluetoothRemoteGattCharacteristicAndroi d, int status);
212 214
213 // Binds to BluetoothRemoteGattCharacteristicAndroid::CreateGattRemoteDescri ptor. 215 // Binds to BluetoothRemoteGattCharacteristicAndroid::CreateGattRemoteDescri ptor.
214 // TODO(http://crbug.com/505554): Replace 'Object' with specific type when J NI fixed. 216 // TODO(http://crbug.com/505554): Replace 'Object' with specific type when J NI fixed.
215 private native void nativeCreateGattRemoteDescriptor( 217 private native void nativeCreateGattRemoteDescriptor(
216 long nativeBluetoothRemoteGattCharacteristicAndroid, String instance Id, 218 long nativeBluetoothRemoteGattCharacteristicAndroid, String instance Id,
217 Object bluetoothGattDescriptorWrapper, Object chromeBluetoothDevice) ; 219 Object bluetoothGattDescriptorWrapper, Object chromeBluetoothDevice) ;
218 } 220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698