Merge "Bluetooth: Fix Resource Leak in OPP (1/2)"
This commit is contained in:
@@ -103,12 +103,24 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
|||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
addCachedDevices();
|
addCachedDevices();
|
||||||
|
mSelectedDevice = null;
|
||||||
if (mStartScanOnStart) {
|
if (mStartScanOnStart) {
|
||||||
mLocalAdapter.startScanning(true);
|
mLocalAdapter.startScanning(true);
|
||||||
mStartScanOnStart = false;
|
mStartScanOnStart = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
/* Check if any device was selected, if no device selected
|
||||||
|
* send ACTION_DEVICE_SELECTED with a null device, otherwise
|
||||||
|
* don't do anything */
|
||||||
|
if (mSelectedDevice == null) {
|
||||||
|
sendDevicePickedIntent(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void onDevicePreferenceClick(BluetoothDevicePreference btPreference) {
|
void onDevicePreferenceClick(BluetoothDevicePreference btPreference) {
|
||||||
mLocalAdapter.stopScanning();
|
mLocalAdapter.stopScanning();
|
||||||
|
Reference in New Issue
Block a user