Restriction pin changes.

Fixed bug in WirelessSettings where it was asking users for a PIN when
they weren't restricted.  Did this by refactoring the preference level
pin checking into the superclass, where it checks for the restricted mode first.
Also pin protected changes to certificates for restricted users.

Change-Id: I8310fd39f0862159668318fc1360ec6859cc00d5
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index ecb984d..81c1794 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -16,7 +16,6 @@
 
 package com.android.settings;
 
-import java.util.HashSet;
 
 import android.app.Activity;
 import android.app.AlertDialog;
@@ -75,7 +74,6 @@
 
     private static final int MANAGE_MOBILE_PLAN_DIALOG_ID = 1;
     private static final String SAVED_MANAGE_MOBILE_PLAN_MSG = "mManageMobilePlanMessage";
-    private final HashSet<Preference> mProtectedByRestictionsPrefs = new HashSet<Preference>();
 
     public WirelessSettings() {
         super(null);
@@ -87,9 +85,8 @@
      */
     @Override
     public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
-        if (mProtectedByRestictionsPrefs.contains(preference) && !hasChallengeSucceeded()) {
-            restrictionsPinCheck(RESTRICTIONS_PIN_SET);
-            return false;
+        if (ensurePinRestrictedPreference(preference)) {
+            return true;
         }
         log("onPreferenceTreeClick: preference=" + preference);
         if (preference == mAirplaneModePreference && Boolean.parseBoolean(
@@ -155,13 +152,6 @@
         }
     }
 
-    private void protectByRestrictions(String key) {
-        Preference pref = findPreference(key);
-        if (pref != null) {
-            mProtectedByRestictionsPrefs.add(pref);
-        }
-    }
-
     @Override
     public Dialog onCreateDialog(int dialogId) {
         log("onCreateDialog: dialogId=" + dialogId);