OSDN Git Service

Ability to hide verification settings
authorrich cannings <richc@google.com>
Sun, 16 Sep 2012 20:58:07 +0000 (13:58 -0700)
committerrich cannings <richc@google.com>
Sun, 16 Sep 2012 20:58:07 +0000 (13:58 -0700)
Add a setting that controls the visibility of the package verification
setting in the Settings app.

Bug:7022814
Change-Id: I6e503924adc112b4528d94b1e533baae6079e85e

src/com/android/settings/SecuritySettings.java

index ce59fdd..d896a68 100644 (file)
@@ -245,12 +245,14 @@ public class SecuritySettings extends SettingsPreferenceFragment
         mToggleAppInstallation.setChecked(isNonMarketAppsAllowed());
 
         // Package verification
-        mToggleVerifyApps = (CheckBoxPreference) findPreference(KEY_TOGGLE_VERIFY_APPLICATIONS);
-        if (isVerifierInstalled()) {
-            mToggleVerifyApps.setChecked(isVerifyAppsEnabled());
-        } else {
-            mToggleVerifyApps.setChecked(false);
-            mToggleVerifyApps.setEnabled(false);
+        if (showVerifierSetting()) {
+            mToggleVerifyApps = (CheckBoxPreference) findPreference(KEY_TOGGLE_VERIFY_APPLICATIONS);
+            if (isVerifierInstalled()) {
+                mToggleVerifyApps.setChecked(isVerifyAppsEnabled());
+            } else {
+                mToggleVerifyApps.setChecked(false);
+                mToggleVerifyApps.setEnabled(false);
+            }
         }
 
         mUserSelectedWidget = root.findPreference(KEY_CHOOSE_USER_SELECTED_LOCKSCREEN_WIDGET);
@@ -300,6 +302,11 @@ public class SecuritySettings extends SettingsPreferenceFragment
         return (receivers.size() > 0) ? true : false;
     }
 
+    private boolean showVerifierSetting() {
+        return Settings.Global.getInt(getContentResolver(),
+                                      Settings.Global.PACKAGE_VERIFIER_SETTING_VISIBLE, 1) > 0;
+    }
+
     private void warnAppInstallation() {
         // TODO: DialogFragment?
         mWarnInstallApps = new AlertDialog.Builder(getActivity()).setTitle(