Merge "Invert STYLUS_BUTTONS_DISABLED to avoid double negatives."
diff --git a/src/com/android/settings/connecteddevice/stylus/StylusDevicesController.java b/src/com/android/settings/connecteddevice/stylus/StylusDevicesController.java
index a7e94e9..ac895df 100644
--- a/src/com/android/settings/connecteddevice/stylus/StylusDevicesController.java
+++ b/src/com/android/settings/connecteddevice/stylus/StylusDevicesController.java
@@ -140,7 +140,7 @@
         pref.setIcon(R.drawable.ic_block);
         pref.setOnPreferenceClickListener(this);
         pref.setChecked(Settings.Secure.getInt(mContext.getContentResolver(),
-                Settings.Secure.STYLUS_BUTTONS_DISABLED, 0) == 1);
+                Settings.Secure.STYLUS_BUTTONS_ENABLED, 1) == 0);
         return pref;
     }
 
@@ -175,8 +175,8 @@
                 break;
             case KEY_IGNORE_BUTTON:
                 Settings.Secure.putInt(mContext.getContentResolver(),
-                        Secure.STYLUS_BUTTONS_DISABLED,
-                        ((SwitchPreference) preference).isChecked() ? 1 : 0);
+                        Secure.STYLUS_BUTTONS_ENABLED,
+                        ((SwitchPreference) preference).isChecked() ? 0 : 1);
                 break;
         }
         return true;
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/stylus/StylusDevicesControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/stylus/StylusDevicesControllerTest.java
index cd6b4bd..56a8373 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/stylus/StylusDevicesControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/stylus/StylusDevicesControllerTest.java
@@ -364,7 +364,7 @@
     @Test
     public void buttonsPreference_checkedWhenFlagTrue() {
         Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.STYLUS_BUTTONS_DISABLED, 1);
+                Settings.Secure.STYLUS_BUTTONS_ENABLED, 0);
 
         showScreen(mController);
         SwitchPreference buttonsPref = (SwitchPreference) mPreferenceContainer.getPreference(2);
@@ -375,7 +375,7 @@
     @Test
     public void buttonsPreference_uncheckedWhenFlagFalse() {
         Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.STYLUS_BUTTONS_DISABLED, 0);
+                Settings.Secure.STYLUS_BUTTONS_ENABLED, 1);
 
         showScreen(mController);
         SwitchPreference buttonsPref = (SwitchPreference) mPreferenceContainer.getPreference(2);
@@ -386,7 +386,7 @@
     @Test
     public void buttonsPreference_updatesFlagOnClick() {
         Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.STYLUS_BUTTONS_DISABLED, 1);
+                Settings.Secure.STYLUS_BUTTONS_ENABLED, 0);
         showScreen(mController);
         SwitchPreference buttonsPref = (SwitchPreference) mPreferenceContainer.getPreference(2);
 
@@ -394,7 +394,7 @@
 
         assertThat(buttonsPref.isChecked()).isEqualTo(false);
         assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
-                Secure.STYLUS_BUTTONS_DISABLED, -1)).isEqualTo(0);
+                Secure.STYLUS_BUTTONS_ENABLED, -1)).isEqualTo(0);
     }
 
     private void showScreen(StylusDevicesController controller) {