diff --git a/src/com/android/settings/bluetooth/BluetoothEnabler.java b/src/com/android/settings/bluetooth/BluetoothEnabler.java
index f08e083..87cf4ee 100644
--- a/src/com/android/settings/bluetooth/BluetoothEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothEnabler.java
@@ -37,7 +37,7 @@
 public final class BluetoothEnabler implements CompoundButton.OnCheckedChangeListener {
     private final Context mContext;
     private Switch mSwitch;
-
+    private boolean mValidListener;
     private final LocalBluetoothAdapter mLocalAdapter;
     private final IntentFilter mIntentFilter;
 
@@ -52,6 +52,7 @@
     public BluetoothEnabler(Context context, Switch switch_) {
         mContext = context;
         mSwitch = switch_;
+        mValidListener = false;
 
         LocalBluetoothManager manager = LocalBluetoothManager.getInstance(context);
         if (manager == null) {
@@ -74,7 +75,10 @@
         handleStateChanged(mLocalAdapter.getBluetoothState());
 
         mContext.registerReceiver(mReceiver, mIntentFilter);
-        mSwitch.setOnCheckedChangeListener(this);
+        synchronized(this) {
+            mSwitch.setOnCheckedChangeListener(this);
+            mValidListener = true;
+        }
     }
 
     public void pause() {
@@ -83,20 +87,26 @@
         }
 
         mContext.unregisterReceiver(mReceiver);
-        mSwitch.setOnCheckedChangeListener(null);
+        synchronized(this) {
+            mSwitch.setOnCheckedChangeListener(null);
+            mValidListener = false;
+        }
     }
 
     public void setSwitch(Switch switch_) {
         if (mSwitch == switch_) return;
-        mSwitch.setOnCheckedChangeListener(null);
-        mSwitch = switch_;
-        mSwitch.setOnCheckedChangeListener(this);
 
         int bluetoothState = BluetoothAdapter.STATE_OFF;
         if (mLocalAdapter != null) bluetoothState = mLocalAdapter.getBluetoothState();
         boolean isOn = bluetoothState == BluetoothAdapter.STATE_ON;
         boolean isOff = bluetoothState == BluetoothAdapter.STATE_OFF;
-        mSwitch.setChecked(isOn);
+
+        synchronized(this) {
+            mSwitch.setOnCheckedChangeListener(null);
+            mSwitch = switch_;
+            mSwitch.setOnCheckedChangeListener(null);
+        }
+        setChecked(isOn);
         mSwitch.setEnabled(isOn || isOff);
     }
 
@@ -121,19 +131,31 @@
                 mSwitch.setEnabled(false);
                 break;
             case BluetoothAdapter.STATE_ON:
-                mSwitch.setChecked(true);
+                setChecked(true);
                 mSwitch.setEnabled(true);
                 break;
             case BluetoothAdapter.STATE_TURNING_OFF:
                 mSwitch.setEnabled(false);
                 break;
             case BluetoothAdapter.STATE_OFF:
-                mSwitch.setChecked(false);
+                setChecked(false);
                 mSwitch.setEnabled(true);
                 break;
             default:
-                mSwitch.setChecked(false);
+                setChecked(false);
                 mSwitch.setEnabled(true);
         }
     }
+
+    private synchronized void setChecked(boolean isChecked) {
+        // set listener to null, so onCheckedChanged won't be called
+        // if the checked status on Switch isn't changed by user click
+        if (mValidListener) {
+            mSwitch.setOnCheckedChangeListener(null);
+        }
+        mSwitch.setChecked(isChecked);
+        if (mValidListener) {
+            mSwitch.setOnCheckedChangeListener(this);
+        }
+    }
 }
