Merge "Respect user's choice on a11y shortcut dialog" into oc-dev
diff --git a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
index 6ed06da..24320b3 100644
--- a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
@@ -42,12 +42,9 @@
 
     public static final String SHORTCUT_SERVICE_KEY = "accessibility_shortcut_service";
     public static final String ON_LOCK_SCREEN_KEY = "accessibility_shortcut_on_lock_screen";
-    // ID for dialog that confirms shortcut capabilities
-    private static final int DIALOG_ID_ADD_SHORTCUT_WARNING = 1;
 
     private Preference mServicePreference;
     private SwitchPreference mOnLockScreenSwitchPreference;
-    private String mSelectedServiceComponentNameString;
 
     @Override
     public int getMetricsCategory() {
diff --git a/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java b/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java
index 8b6d52a..3250521 100644
--- a/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java
+++ b/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java
@@ -15,6 +15,8 @@
  */
 package com.android.settings.accessibility;
 
+import static android.content.DialogInterface.BUTTON_POSITIVE;
+
 import android.accessibilityservice.AccessibilityServiceInfo;
 import android.app.Activity;
 import android.app.AlertDialog;
@@ -147,7 +149,7 @@
         @Override
         public void onClick(DialogInterface dialog, int which) {
             final Fragment fragment = getTargetFragment();
-            if (fragment instanceof DefaultAppPickerFragment) {
+            if ((which == BUTTON_POSITIVE) && (fragment instanceof DefaultAppPickerFragment)) {
                 final Bundle bundle = getArguments();
                 ((ShortcutServicePickerFragment) fragment).onServiceConfirmed(
                         bundle.getString(EXTRA_KEY));