diff options
author | Julia Reynolds <juliacr@google.com> | 2014-06-13 17:31:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-06-12 17:09:07 +0000 |
commit | cbfda988167e5a08382dc64cb006f526faaa7c62 (patch) | |
tree | 3d9f4e21b2eb0c9b27b7ce5a50888f807b188fde /src | |
parent | 72a00c459cddc044524e265f0551d2cc67f0352d (diff) | |
parent | 565653cef1039ab4e34e505185f1c77d847357cd (diff) | |
download | packages_apps_Settings-cbfda988167e5a08382dc64cb006f526faaa7c62.zip packages_apps_Settings-cbfda988167e5a08382dc64cb006f526faaa7c62.tar.gz packages_apps_Settings-cbfda988167e5a08382dc64cb006f526faaa7c62.tar.bz2 |
Merge "Remove pin and add restrictions for Security settings."
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/CredentialStorage.java | 26 | ||||
-rw-r--r-- | src/com/android/settings/SecuritySettings.java | 23 | ||||
-rw-r--r-- | src/com/android/settings/TrustedCredentialsSettings.java | 5 |
3 files changed, 29 insertions, 25 deletions
diff --git a/src/com/android/settings/CredentialStorage.java b/src/com/android/settings/CredentialStorage.java index 44e966c..f515b36 100644 --- a/src/com/android/settings/CredentialStorage.java +++ b/src/com/android/settings/CredentialStorage.java @@ -19,6 +19,7 @@ package com.android.settings; import android.app.Activity; import android.app.AlertDialog; import android.app.admin.DevicePolicyManager; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.res.Resources; @@ -26,6 +27,7 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.RemoteException; import android.os.Process; +import android.os.UserManager; import android.security.Credentials; import android.security.KeyChain.KeyChainConnection; import android.security.KeyChain; @@ -38,8 +40,8 @@ import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; -import com.android.internal.widget.LockPatternUtils; +import com.android.internal.widget.LockPatternUtils; import com.android.org.bouncycastle.asn1.ASN1InputStream; import com.android.org.bouncycastle.asn1.pkcs.PrivateKeyInfo; @@ -119,16 +121,20 @@ public final class CredentialStorage extends Activity { Intent intent = getIntent(); String action = intent.getAction(); - - if (ACTION_RESET.equals(action)) { - new ResetDialog(); - } else { - if (ACTION_INSTALL.equals(action) - && "com.android.certinstaller".equals(getCallingPackage())) { - mInstallBundle = intent.getExtras(); + UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE); + if (!userManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_CREDENTIALS)) { + if (ACTION_RESET.equals(action)) { + new ResetDialog(); + } else { + if (ACTION_INSTALL.equals(action) + && "com.android.certinstaller".equals(getCallingPackage())) { + mInstallBundle = intent.getExtras(); + } + // ACTION_UNLOCK also handled here in addition to ACTION_INSTALL + handleUnlockOrInstall(); } - // ACTION_UNLOCK also handled here in addition to ACTION_INSTALL - handleUnlockOrInstall(); + } else { + finish(); } } diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index 5091eea..60a086a 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -58,7 +58,7 @@ import java.util.List; /** * Gesture lock pattern settings. */ -public class SecuritySettings extends RestrictedSettingsFragment +public class SecuritySettings extends SettingsPreferenceFragment implements OnPreferenceChangeListener, DialogInterface.OnClickListener, Indexable { static final String TAG = "SecuritySettings"; private static final Intent TRUST_AGENT_INTENT = @@ -115,10 +115,6 @@ public class SecuritySettings extends RestrictedSettingsFragment private boolean mIsPrimary; - public SecuritySettings() { - super(null /* Don't ask for restrictions pin on creation. */); - } - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -274,6 +270,7 @@ public class SecuritySettings extends RestrictedSettingsFragment } else { removePreference(KEY_CREDENTIALS_MANAGER); + removePreference(KEY_CREDENTIALS_INSTALL); } // Application install @@ -282,9 +279,12 @@ public class SecuritySettings extends RestrictedSettingsFragment mToggleAppInstallation = (CheckBoxPreference) findPreference( KEY_TOGGLE_INSTALL_APPLICATIONS); mToggleAppInstallation.setChecked(isNonMarketAppsAllowed()); - // Side loading of apps. mToggleAppInstallation.setEnabled(mIsPrimary); + if (um.hasUserRestriction(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES) + || um.hasUserRestriction(UserManager.DISALLOW_INSTALL_APPS)) { + mToggleAppInstallation.setEnabled(false); + } // Package verification, only visible to primary user and if enabled mToggleVerifyApps = (CheckBoxPreference) findPreference(KEY_TOGGLE_VERIFY_APPLICATIONS); @@ -302,12 +302,8 @@ public class SecuritySettings extends RestrictedSettingsFragment mToggleVerifyApps.setEnabled(false); } } - - if (shouldBePinProtected(RESTRICTIONS_PIN_SET)) { - protectByRestrictions(mToggleAppInstallation); - protectByRestrictions(mToggleVerifyApps); - protectByRestrictions(mResetCredentials); - protectByRestrictions(root.findPreference(KEY_CREDENTIALS_INSTALL)); + if (um.hasUserRestriction(UserManager.ENSURE_VERIFY_APPS)) { + mToggleVerifyApps.setEnabled(false); } // Trust Agent preferences @@ -504,9 +500,6 @@ public class SecuritySettings extends RestrictedSettingsFragment @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { - if (ensurePinRestrictedPreference(preference)) { - return true; - } final String key = preference.getKey(); final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils(); diff --git a/src/com/android/settings/TrustedCredentialsSettings.java b/src/com/android/settings/TrustedCredentialsSettings.java index 65d0934..eb7b142 100644 --- a/src/com/android/settings/TrustedCredentialsSettings.java +++ b/src/com/android/settings/TrustedCredentialsSettings.java @@ -47,6 +47,7 @@ import android.widget.ProgressBar; import android.widget.Spinner; import android.widget.TabHost; import android.widget.TextView; + import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; @@ -170,6 +171,10 @@ public class TrustedCredentialsSettings extends Fragment { @Override public View onCreateView( LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { + if (mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_CREDENTIALS)) { + return inflater.inflate(R.layout.credentials_disallowed_preference_screen, + parent, false); + } mTabHost = (TabHost) inflater.inflate(R.layout.trusted_credentials, parent, false); mTabHost.setup(); addTab(Tab.SYSTEM); |