Update context on resume calls for BluetoothAdvertisingEnabler and BluetoothEnabler
The saved context could be invalid if not updated bug 12991455 Change-Id: I93abb8420d0fa53add1f0e843a5069d59743891c
This commit is contained in:
@@ -35,7 +35,7 @@ import com.android.settings.WirelessSettings;
|
||||
* preference reflects the current state.
|
||||
*/
|
||||
public final class BluetoothEnabler implements CompoundButton.OnCheckedChangeListener {
|
||||
private final Context mContext;
|
||||
private Context mContext;
|
||||
private Switch mSwitch;
|
||||
private boolean mValidListener;
|
||||
private final LocalBluetoothAdapter mLocalAdapter;
|
||||
@@ -67,12 +67,16 @@ public final class BluetoothEnabler implements CompoundButton.OnCheckedChangeLis
|
||||
mIntentFilter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
|
||||
}
|
||||
|
||||
public void resume() {
|
||||
public void resume(Context context) {
|
||||
if (mLocalAdapter == null) {
|
||||
mSwitch.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mContext != context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
// Bluetooth state is not sticky, so set it manually
|
||||
handleStateChanged(mLocalAdapter.getBluetoothState());
|
||||
|
||||
|
Reference in New Issue
Block a user