OSDN Git Service

Allow multiuser use of keystore
authorKenny Root <kroot@google.com>
Mon, 8 Apr 2013 16:56:05 +0000 (09:56 -0700)
committerKenny Root <kroot@google.com>
Mon, 8 Apr 2013 17:36:05 +0000 (10:36 -0700)
Since keystore has been refactored to let muliple users use it
simultaneously, we can remove all the restrictions put into place to
prevent it.

(cherry picked from commit cc48b0104e4d81592055a578a33f2a59f29bf907)

Bug: 7249554
Change-Id: I419474151380c29e49e50451befbbdf3af65b175

src/com/android/settings/CredentialStorage.java
src/com/android/settings/SecuritySettings.java

index 1444a73..48c24f7 100644 (file)
@@ -25,7 +25,6 @@ import android.content.res.Resources;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.RemoteException;
-import android.os.UserHandle;
 import android.security.Credentials;
 import android.security.KeyChain.KeyChainConnection;
 import android.security.KeyChain;
@@ -109,12 +108,6 @@ public final class CredentialStorage extends Activity {
     protected void onResume() {
         super.onResume();
 
-        if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
-            Log.i(TAG, "Cannot install to CredentialStorage as non-primary user");
-            finish();
-            return;
-        }
-
         Intent intent = getIntent();
         String action = intent.getAction();
 
index d75d630..556f548 100644 (file)
@@ -234,21 +234,18 @@ public class SecuritySettings extends SettingsPreferenceFragment
         // Show password
         mShowPassword = (CheckBoxPreference) root.findPreference(KEY_SHOW_PASSWORD);
 
-        // Credential storage, only for primary user
-        if (mIsPrimary) {
-            mKeyStore = KeyStore.getInstance();
-            Preference credentialStorageType = root.findPreference(KEY_CREDENTIAL_STORAGE_TYPE);
+        // Credential storage
+        mKeyStore = KeyStore.getInstance();
+        Preference credentialStorageType = root.findPreference(KEY_CREDENTIAL_STORAGE_TYPE);
 
-            final int storageSummaryRes =
-                    mKeyStore.isHardwareBacked() ? R.string.credential_storage_type_hardware
-                            : R.string.credential_storage_type_software;
-            credentialStorageType.setSummary(storageSummaryRes);
+        final int storageSummaryRes =
+                mKeyStore.isHardwareBacked() ? R.string.credential_storage_type_hardware
+                        : R.string.credential_storage_type_software;
+        credentialStorageType.setSummary(storageSummaryRes);
 
-            mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS);
-        } else {
-            removePreference(KEY_CREDENTIALS_MANAGER);
-        }
+        mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS);
 
+        // Application install
         PreferenceGroup deviceAdminCategory= (PreferenceGroup)
                 root.findPreference(KEY_DEVICE_ADMIN_CATEGORY);
         mToggleAppInstallation = (CheckBoxPreference) findPreference(