diff --git a/res/xml/connected_devices.xml b/res/xml/connected_devices.xml
index 75f9988..54de927 100644
--- a/res/xml/connected_devices.xml
+++ b/res/xml/connected_devices.xml
@@ -46,7 +46,8 @@
         android:title="@string/connected_device_previously_connected_title"
         android:icon="@drawable/ic_devices_other_black"
         android:fragment="com.android.settings.connecteddevice.PreviouslyConnectedDeviceDashboardFragment"
-        settings:allowDividerAbove="true"/>
+        settings:allowDividerAbove="true"
+        settings:controller="com.android.settings.connecteddevice.PreviouslyConnectedDevicePreferenceController"/>
 
     <Preference
         android:key="connection_preferences"
diff --git a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
index 3dc1437..26ff930 100644
--- a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
+++ b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
@@ -64,6 +64,7 @@
         super.onAttach(context);
         use(AvailableMediaDeviceGroupController.class).init(this);
         use(ConnectedDeviceGroupController.class).init(this);
+        use(PreviouslyConnectedDevicePreferenceController.class).init(this);
     }
 
     @VisibleForTesting
diff --git a/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceController.java b/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceController.java
new file mode 100644
index 0000000..ba3ee1f
--- /dev/null
+++ b/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceController.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.settings.connecteddevice;
+
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.support.annotation.VisibleForTesting;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
+
+import android.util.Log;
+import com.android.settings.bluetooth.BluetoothDeviceUpdater;
+import com.android.settings.bluetooth.SavedBluetoothDeviceUpdater;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.dashboard.DashboardFragment;
+
+import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnStart;
+import com.android.settingslib.core.lifecycle.events.OnStop;
+import com.android.settingslib.utils.ThreadUtils;
+
+public class PreviouslyConnectedDevicePreferenceController extends BasePreferenceController
+        implements LifecycleObserver, OnStart, OnStop, DevicePreferenceCallback {
+
+    private Preference mPreference;
+    private BluetoothDeviceUpdater mBluetoothDeviceUpdater;
+    private int mPreferenceSize;
+
+    public PreviouslyConnectedDevicePreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)
+                ? AVAILABLE
+                : CONDITIONALLY_UNAVAILABLE;
+    }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        if (isAvailable()) {
+            mPreference = screen.findPreference(getPreferenceKey());
+            mBluetoothDeviceUpdater.setPrefContext(screen.getContext());
+        }
+    }
+
+    @Override
+    public void onStart() {
+        mBluetoothDeviceUpdater.registerCallback();
+        updatePreferenceOnSizeChanged();
+    }
+
+    @Override
+    public void onStop() {
+        mBluetoothDeviceUpdater.unregisterCallback();
+    }
+
+    public void init(DashboardFragment fragment) {
+        mBluetoothDeviceUpdater = new SavedBluetoothDeviceUpdater(fragment.getContext(),
+                fragment, PreviouslyConnectedDevicePreferenceController.this);
+    }
+
+    @Override
+    public void onDeviceAdded(Preference preference) {
+        mPreferenceSize++;
+        updatePreferenceOnSizeChanged();
+    }
+
+    @Override
+    public void onDeviceRemoved(Preference preference) {
+        mPreferenceSize--;
+        updatePreferenceOnSizeChanged();
+    }
+
+    @VisibleForTesting
+    void setBluetoothDeviceUpdater(BluetoothDeviceUpdater bluetoothDeviceUpdater) {
+        mBluetoothDeviceUpdater = bluetoothDeviceUpdater;
+    }
+
+    @VisibleForTesting
+    void setPreferenceSize(int size) {
+        mPreferenceSize = size;
+    }
+
+    @VisibleForTesting
+    void setPreference(Preference preference) {
+        mPreference = preference;
+    }
+
+    private void updatePreferenceOnSizeChanged() {
+        if (isAvailable()) {
+            mPreference.setEnabled(mPreferenceSize != 0);
+        }
+    }
+}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceControllerTest.java
new file mode 100644
index 0000000..444728a
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceControllerTest.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+package com.android.settings.connecteddevice;
+
+import android.content.Context;
+import android.content.pm.PackageManager;
+
+import android.support.v7.preference.Preference;
+
+import com.android.settings.bluetooth.BluetoothDeviceUpdater;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RuntimeEnvironment;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
+import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.*;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+public class PreviouslyConnectedDevicePreferenceControllerTest {
+
+    private final String KEY = "test_key";
+
+    @Mock
+    private DashboardFragment mDashboardFragment;
+    @Mock
+    private BluetoothDeviceUpdater mBluetoothDeviceUpdater;
+    @Mock
+    private PackageManager mPackageManager;
+
+    private Context mContext;
+    private PreviouslyConnectedDevicePreferenceController mPreConnectedDeviceController;
+    private Preference mPreference;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = spy(RuntimeEnvironment.application);
+        doReturn(mContext).when(mDashboardFragment).getContext();
+        doReturn(mPackageManager).when(mContext).getPackageManager();
+        mPreConnectedDeviceController =
+                new PreviouslyConnectedDevicePreferenceController(mContext, KEY);
+        mPreConnectedDeviceController.setBluetoothDeviceUpdater(mBluetoothDeviceUpdater);
+
+        mPreference = new Preference(mContext);
+        mPreConnectedDeviceController.setPreference(mPreference);
+    }
+
+    @Test
+    public void callbackCanRegisterAndUnregister() {
+        // register the callback in onStart()
+        mPreConnectedDeviceController.onStart();
+        verify(mBluetoothDeviceUpdater).registerCallback();
+
+        // unregister the callback in onStop()
+        mPreConnectedDeviceController.onStop();
+        verify(mBluetoothDeviceUpdater).unregisterCallback();
+    }
+
+    @Test
+    public void getAvailabilityStatus_noBluetoothFeature_returnUnSupported() {
+        doReturn(false).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
+        assertThat(mPreConnectedDeviceController.getAvailabilityStatus()).isEqualTo(
+                CONDITIONALLY_UNAVAILABLE);
+    }
+    @Test
+    public void getAvailabilityStatus_hasBluetoothFeature_returnSupported() {
+        doReturn(true).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
+        assertThat(mPreConnectedDeviceController.getAvailabilityStatus()).isEqualTo(
+                AVAILABLE);
+    }
+
+    @Test
+    public void onDeviceAdded_addFirstDevice_preferenceIsEnable() {
+        doReturn(true).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
+        mPreConnectedDeviceController.setPreferenceSize(0);
+        mPreConnectedDeviceController.onDeviceAdded(mPreference);
+
+        assertThat(mPreference.isEnabled()).isTrue();
+    }
+
+    @Test
+    public void onDeviceRemoved_removeLastDevice_preferenceIsDisable() {
+        doReturn(true).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
+        mPreConnectedDeviceController.setPreferenceSize(1);
+        mPreConnectedDeviceController.onDeviceRemoved(mPreference);
+
+        assertThat(mPreference.isEnabled()).isFalse();
+    }
+}
