Merge "Fix the memory leak in TetherSettings"

This commit is contained in:
Robert Greenwalt
2016-06-13 18:35:31 +00:00
committed by Gerrit Code Review

View File

@@ -182,6 +182,16 @@ public class TetherSettings extends SettingsPreferenceFragment
com.android.internal.R.array.config_mobile_hotspot_provision_app); com.android.internal.R.array.config_mobile_hotspot_provision_app);
} }
@Override
public void onDestroy() {
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
BluetoothProfile profile = mBluetoothPan.getAndSet(null);
if (profile != null && adapter != null) {
adapter.closeProfileProxy(BluetoothProfile.PAN, profile);
}
super.onDestroy();
}
@Override @Override
public void onSaveInstanceState(Bundle savedInstanceState) { public void onSaveInstanceState(Bundle savedInstanceState) {
savedInstanceState.putInt(TETHER_CHOICE, mTetherChoice); savedInstanceState.putInt(TETHER_CHOICE, mTetherChoice);