Merge "Disable Gestures Settings by default." into nyc-mr1-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c6b278c..ab4a9ab 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7499,13 +7499,10 @@
     <string name="button_confirm_convert_fbe">Wipe and convert</string>
 
     <!-- Reset rate-limiting in the system service ShortcutManager. [CHAR_LIMIT=none] -->
-    <string name="reset_shortcut_manager_throttling">Reset ShortcutManager rate-limiting counters</string>
+    <string name="reset_shortcut_manager_throttling">Reset ShortcutManager rate-limiting</string>
 
-    <!-- Title of the dialog box to confirm resetting rate-limiting in the system service ShortcutManager. [CHAR_LIMIT=none] -->
-    <string name="confirm_reset_shortcut_manager_throttling_title">Reset ShortcutManager rate-limiting?</string>
-
-    <!-- Message of the dialog box to confirm resetting rate-limiting in the system service ShortcutManager. [CHAR_LIMIT=none] -->
-    <string name="confirm_reset_shortcut_manager_throttling_message">Reset ShortcutManager rate-limiting counters?</string>
+    <!-- Toast message shown when "Reset ShortcutManager rate-limiting" has been performed. [CHAR_LIMIT=none] -->
+    <string name="reset_shortcut_manager_throttling_complete">ShortcutManager rate-limiting has been reset</string>
 
     <!-- Title of notification suggestion during optional steps of setup. [CHAR_LIMIT=60] -->
     <string name="notification_suggestion_title">Control lock screen notifications</string>
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 29363ad..2288520 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -372,6 +372,10 @@
             android:key="force_resizable_activities"
             android:title="@string/force_resizable_activities"
             android:summary="@string/force_resizable_activities_summary"/>
+
+        <Preference
+            android:key="reset_shortcut_manager_throttling"
+            android:title="@string/reset_shortcut_manager_throttling" />
      </PreferenceCategory>
 
 </PreferenceScreen>
diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java
index 5a8960c..801f008 100644
--- a/src/com/android/settings/ChooseLockPassword.java
+++ b/src/com/android/settings/ChooseLockPassword.java
@@ -290,10 +290,7 @@
         @Override
         public View onCreateView(LayoutInflater inflater, ViewGroup container,
                 Bundle savedInstanceState) {
-            GlifLayout layout = (GlifLayout) inflater.inflate(
-                    R.layout.choose_lock_password, container, false);
-            layout.setHeaderText(getActivity().getTitle());
-            return layout;
+            return inflater.inflate(R.layout.choose_lock_password, container, false);
         }
 
         @Override
@@ -365,6 +362,7 @@
                         : R.string.lockpassword_choose_your_pin_header;
                 CharSequence title = getText(id);
                 sa.setTitle(title);
+                ((GlifLayout) view).setHeaderText(title);
             }
         }
 
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 934e752..db6a373 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -1911,7 +1911,7 @@
         } else if (preference == mWebViewMultiprocess) {
             writeWebViewMultiprocessOptions();
         } else if (SHORTCUT_MANAGER_RESET_KEY.equals(preference.getKey())) {
-            confirmResetShortcutManagerThrottling();
+            resetShortcutManagerThrottling();
         } else {
             return super.onPreferenceTreeClick(preference);
         }
@@ -2153,30 +2153,18 @@
                 }
             };
 
-    private void confirmResetShortcutManagerThrottling() {
+    private void resetShortcutManagerThrottling() {
         final IShortcutService service = IShortcutService.Stub.asInterface(
                 ServiceManager.getService(Context.SHORTCUT_SERVICE));
-
-        DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
-            @Override
-            public void onClick(DialogInterface dialog, int which) {
-                if (which == DialogInterface.BUTTON_POSITIVE) {
-                    try {
-                        service.resetThrottling();
-                    } catch (RemoteException e) {
-                    }
-                }
+        if (service != null) {
+            try {
+                service.resetThrottling();
+                Toast.makeText(getActivity(), R.string.reset_shortcut_manager_throttling_complete,
+                        Toast.LENGTH_SHORT).show();
+            } catch (RemoteException e) {
+                Log.e(TAG, "Failed to reset rate limiting", e);
             }
-        };
-
-        new AlertDialog.Builder(getActivity())
-                .setTitle(R.string.confirm_reset_shortcut_manager_throttling_title)
-                .setMessage(R.string.confirm_reset_shortcut_manager_throttling_message)
-                .setPositiveButton(R.string.okay, onClickListener)
-                .setNegativeButton(android.R.string.cancel, null)
-                .create()
-                .show();
-
+        }
     }
 
     private void updateOemUnlockSettingDescription() {
diff --git a/src/com/android/settings/vpn2/AppManagementFragment.java b/src/com/android/settings/vpn2/AppManagementFragment.java
index 99d2f55..b306577 100644
--- a/src/com/android/settings/vpn2/AppManagementFragment.java
+++ b/src/com/android/settings/vpn2/AppManagementFragment.java
@@ -80,7 +80,7 @@
         public void onForget() {
             // Unset always-on-vpn when forgetting the VPN
             if (isVpnAlwaysOn()) {
-                setAlwaysOnVpnByUI(false);
+                setAlwaysOnVpn(false);
             }
             // Also dismiss and go back to VPN list
             finish();
@@ -187,14 +187,18 @@
         if (mUserId == UserHandle.USER_SYSTEM) {
             VpnUtils.clearLockdownVpn(getContext());
         }
-        final boolean success = mConnectivityManager.setAlwaysOnVpnPackageForUser(mUserId,
-                isEnabled ? mPackageName : null, /* lockdownEnabled */ false);
+        final boolean success = setAlwaysOnVpn(isEnabled);
         if (isEnabled && (!success || !isVpnAlwaysOn())) {
             CannotConnectFragment.show(this, mVpnLabel);
         }
         return success;
     }
 
+    private boolean setAlwaysOnVpn(boolean isEnabled) {
+         return mConnectivityManager.setAlwaysOnVpnPackageForUser(mUserId,
+                isEnabled ? mPackageName : null, /* lockdownEnabled */ false);
+    }
+
     private boolean checkTargetVersion() {
         if (mPackageInfo == null || mPackageInfo.applicationInfo == null) {
             return true;