diff --git a/src/com/android/settings/accessibility/ToggleAutoclickCustomSeekbarController.java b/src/com/android/settings/accessibility/ToggleAutoclickCustomSeekbarController.java
index b98a503..47c1ca7 100644
--- a/src/com/android/settings/accessibility/ToggleAutoclickCustomSeekbarController.java
+++ b/src/com/android/settings/accessibility/ToggleAutoclickCustomSeekbarController.java
@@ -153,7 +153,7 @@
     @Override
     public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
         if (KEY_DELAY_MODE.equals(key)) {
-            int delayMillis = getSharedPreferenceForDelayValue();
+            final int delayMillis = getSharedPreferenceForDelayValue();
             updateCustomDelayValue(delayMillis);
         }
     }
@@ -172,10 +172,11 @@
     }
 
     private int getSharedPreferenceForDelayValue() {
-        int delayMillis = mSharedPreferences.getInt(KEY_CUSTOM_DELAY_VALUE,
+        final int delayMillis = Settings.Secure.getInt(mContentResolver,
+                Settings.Secure.ACCESSIBILITY_AUTOCLICK_DELAY,
                 AccessibilityManager.AUTOCLICK_DELAY_DEFAULT);
 
-        return delayMillis;
+        return mSharedPreferences.getInt(KEY_CUSTOM_DELAY_VALUE, delayMillis);
     }
 
     private void putSecureInt(String name, int value) {
@@ -190,14 +191,14 @@
     }
 
     private void minusDelayByImageView() {
-        int delayMillis = getSharedPreferenceForDelayValue();
+        final int delayMillis = getSharedPreferenceForDelayValue();
         if (delayMillis > MIN_AUTOCLICK_DELAY_MS) {
             updateCustomDelayValue(delayMillis - AUTOCLICK_DELAY_STEP);
         }
     }
 
     private void plusDelayByImageView() {
-        int delayMillis = getSharedPreferenceForDelayValue();
+        final int delayMillis = getSharedPreferenceForDelayValue();
         if (delayMillis < MAX_AUTOCLICK_DELAY_MS) {
             updateCustomDelayValue(delayMillis + AUTOCLICK_DELAY_STEP);
         }
diff --git a/src/com/android/settings/accessibility/ToggleAutoclickPreferenceController.java b/src/com/android/settings/accessibility/ToggleAutoclickPreferenceController.java
index 45cdf91..b9af7ce 100644
--- a/src/com/android/settings/accessibility/ToggleAutoclickPreferenceController.java
+++ b/src/com/android/settings/accessibility/ToggleAutoclickPreferenceController.java
@@ -116,7 +116,7 @@
 
     @Override
     public void onRadioButtonClicked(RadioButtonPreference preference) {
-        int value = mAccessibilityAutoclickKeyToValueMap.get(mPreferenceKey);
+        final int value = mAccessibilityAutoclickKeyToValueMap.get(mPreferenceKey);
         handleRadioButtonPreferenceChange(value);
         if (mOnChangeListener != null) {
             mOnChangeListener.onCheckedChanged(mDelayModePref);
@@ -137,11 +137,15 @@
     public void updateState(Preference preference) {
         super.updateState(preference);
 
-        mCurrentUiAutoClickMode = getSharedPreferenceForAutoClickMode();
+        final boolean enabled = Settings.Secure.getInt(mContext.getContentResolver(),
+                Settings.Secure.ACCESSIBILITY_AUTOCLICK_ENABLED, 0) == 1;
+
+        mCurrentUiAutoClickMode =
+                enabled ? getSharedPreferenceForAutoClickMode() : AUTOCLICK_OFF_MODE;
 
         // Reset RadioButton.
         mDelayModePref.setChecked(false);
-        int mode = mAccessibilityAutoclickKeyToValueMap.get(mDelayModePref.getKey());
+        final int mode = mAccessibilityAutoclickKeyToValueMap.get(mDelayModePref.getKey());
         updatePreferenceCheckedState(mode);
         updatePreferenceVisibleState(mode);
     }
@@ -155,10 +159,10 @@
     }
 
     private void setAutoclickModeToKeyMap() {
-        String[] autoclickKeys = mResources.getStringArray(
+        final String[] autoclickKeys = mResources.getStringArray(
                 R.array.accessibility_autoclick_control_selector_keys);
 
-        int[] autoclickValues = mResources.getIntArray(
+        final int[] autoclickValues = mResources.getIntArray(
                 R.array.accessibility_autoclick_selector_values);
 
         final int autoclickValueCount = autoclickValues.length;
@@ -168,19 +172,14 @@
     }
 
     private void handleRadioButtonPreferenceChange(int preference) {
-        if (preference == AUTOCLICK_OFF_MODE) {
-            putSecureInt(Settings.Secure.ACCESSIBILITY_AUTOCLICK_ENABLED, /*value= */ 0);
-        } else {
-            putSecureInt(Settings.Secure.ACCESSIBILITY_AUTOCLICK_ENABLED, /*value= */ 1);
-        }
+        putSecureInt(Settings.Secure.ACCESSIBILITY_AUTOCLICK_ENABLED,
+                (preference != AUTOCLICK_OFF_MODE) ? /* enabled */ 1 : /* disabled */ 0);
 
         mSharedPreferences.edit().putInt(KEY_DELAY_MODE, preference).apply();
 
-        if (preference == AUTOCLICK_CUSTOM_MODE) {
-            return;
+        if (preference != AUTOCLICK_CUSTOM_MODE) {
+            putSecureInt(CONTROL_AUTOCLICK_DELAY_SECURE, preference);
         }
-
-        putSecureInt(CONTROL_AUTOCLICK_DELAY_SECURE, preference);
     }
 
     private void putSecureInt(String name, int value) {
@@ -188,6 +187,6 @@
     }
 
     private int getSharedPreferenceForAutoClickMode() {
-        return mSharedPreferences.getInt(KEY_DELAY_MODE, AUTOCLICK_OFF_MODE);
+        return mSharedPreferences.getInt(KEY_DELAY_MODE, AUTOCLICK_CUSTOM_MODE);
     }
 }
