Remove "storage type" preference from Settings
Since storage type is mandated as hardware-backed, this preference is no longer meaningful.
Bug: 160225361
Test: atest SettingsRoboTests
Change-Id: I9b6c1d6afdd3563201b1e85673acf4d8cb81c0a1
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9a7271d..09a8957 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5907,12 +5907,6 @@
<string name="user_credentials_summary">View and modify stored credentials</string>
<!-- Title of preference group for advance security settings [CHAR LIMIT=30] -->
<string name="advanced_security_title">Advanced</string>
- <!-- Title of preference of what type of credential storage this device has: hardware or software [CHAR LIMIT=30] -->
- <string name="credential_storage_type">Storage type</string>
- <!-- Summary text for preference showing what type of credential storage this device has when it is stored in a hardware-backed storage (as opposed to "software only") [CHAR LIMIT=NONE] -->
- <string name="credential_storage_type_hardware">Hardware-backed</string>
- <!-- Summary text for preference showing what type of credential storage this device has when it is stored in software only (as opposed to "hardware-backed") [CHAR LIMIT=NONE] -->
- <string name="credential_storage_type_software">Software only</string>
<!-- Error message for users that aren't allowed to see or modify credentials [CHAR LIMIT=none] -->
<string name="credentials_settings_not_available">Credentials are not available for this user</string>
<!-- Sub-heading for a user credential installed to be used by apps and as part of VPN configurations. [CHAR LIMIT=NONE] -->
diff --git a/res/xml/encryption_and_credential.xml b/res/xml/encryption_and_credential.xml
index f7e7184..c10cccc 100644
--- a/res/xml/encryption_and_credential.xml
+++ b/res/xml/encryption_and_credential.xml
@@ -38,12 +38,6 @@
android:persistent="false"
android:order="100">
- <com.android.settingslib.RestrictedPreference
- android:key="credential_storage_type"
- android:title="@string/credential_storage_type"
- android:summary="@string/summary_placeholder"
- settings:userRestriction="no_config_credentials" />
-
<Preference
android:key="trusted_credentials"
android:title="@string/trusted_credentials"
diff --git a/src/com/android/settings/security/CredentialStoragePreferenceController.java b/src/com/android/settings/security/CredentialStoragePreferenceController.java
deleted file mode 100644
index 060d964..0000000
--- a/src/com/android/settings/security/CredentialStoragePreferenceController.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.security;
-
-import android.content.Context;
-import android.os.UserManager;
-import android.security.KeyStore;
-
-import androidx.preference.Preference;
-
-import com.android.settings.R;
-
-public class CredentialStoragePreferenceController extends
- RestrictedEncryptionPreferenceController {
-
- private static final String KEY_CREDENTIAL_STORAGE_TYPE = "credential_storage_type";
- private final KeyStore mKeyStore;
-
- public CredentialStoragePreferenceController(Context context) {
- super(context, UserManager.DISALLOW_CONFIG_CREDENTIALS);
- mKeyStore = KeyStore.getInstance();
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_CREDENTIAL_STORAGE_TYPE;
- }
-
- @Override
- public void updateState(Preference preference) {
- preference.setSummary(mKeyStore.isHardwareBacked()
- ? R.string.credential_storage_type_hardware
- : R.string.credential_storage_type_software);
- }
-}
diff --git a/src/com/android/settings/security/EncryptionAndCredential.java b/src/com/android/settings/security/EncryptionAndCredential.java
index e5f82f5..8551475 100644
--- a/src/com/android/settings/security/EncryptionAndCredential.java
+++ b/src/com/android/settings/security/EncryptionAndCredential.java
@@ -73,7 +73,6 @@
controllers.add(new PreferenceCategoryController(context,
"encryption_and_credentials_status_category").setChildren(
Arrays.asList(encryptStatusController)));
- controllers.add(new CredentialStoragePreferenceController(context));
controllers.add(new UserCredentialsPreferenceController(context));
controllers.add(new ResetCredentialsPreferenceController(context, lifecycle));
controllers.add(new InstallCertificatePreferenceController(context));
diff --git a/tests/robotests/src/com/android/settings/security/CredentialStoragePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/CredentialStoragePreferenceControllerTest.java
deleted file mode 100644
index 3eb21cf..0000000
--- a/tests/robotests/src/com/android/settings/security/CredentialStoragePreferenceControllerTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.security;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-
-import androidx.preference.Preference;
-
-import com.android.settings.R;
-import com.android.settings.testutils.shadow.ShadowKeyStore;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-
-@RunWith(RobolectricTestRunner.class)
-@Config(shadows = ShadowKeyStore.class)
-public class CredentialStoragePreferenceControllerTest {
-
- private Context mContext;
- private CredentialStoragePreferenceController mController;
- private Preference mPreference;
-
- @Before
- public void setUp() {
- mContext = RuntimeEnvironment.application;
- mController = new CredentialStoragePreferenceController(mContext);
- mPreference = new Preference(mContext);
- }
-
- @Test
- public void updateState_hardwareBacked_showHardwareSummary() {
- ShadowKeyStore.setHardwareBacked(true);
-
- mController.updateState(mPreference);
-
- assertThat(mPreference.getSummary())
- .isEqualTo(mContext.getText(R.string.credential_storage_type_hardware));
- }
-
- @Test
- public void updateState_hardwareBacked_showSoftwareSummary() {
- ShadowKeyStore.setHardwareBacked(false);
-
- mController.updateState(mPreference);
-
- assertThat(mPreference.getSummary())
- .isEqualTo(mContext.getText(R.string.credential_storage_type_software));
- }
-}
diff --git a/tests/robotests/src/com/android/settings/security/RestrictedEncryptionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/RestrictedEncryptionPreferenceControllerTest.java
index 672d317..c0f1cca 100644
--- a/tests/robotests/src/com/android/settings/security/RestrictedEncryptionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/security/RestrictedEncryptionPreferenceControllerTest.java
@@ -39,7 +39,6 @@
private Context mContext;
private ShadowUserManager mUserManager;
- private CredentialStoragePreferenceController mCredentialStoragePreferenceController;
private InstallCertificatePreferenceController mInstallCertificatePreferenceController;
private ResetCredentialsPreferenceController mResetCredentialsPreferenceController;
private UserCredentialsPreferenceController mUserCredentialsPreferenceController;
@@ -54,8 +53,6 @@
mContext = RuntimeEnvironment.application;
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
- mCredentialStoragePreferenceController =
- new CredentialStoragePreferenceController(mContext);
mInstallCertificatePreferenceController =
new InstallCertificatePreferenceController(mContext);
mResetCredentialsPreferenceController =
@@ -73,7 +70,6 @@
@Test
public void isAvailable_noRestriction_shouldReturnTrue() {
- assertThat(mCredentialStoragePreferenceController.isAvailable()).isTrue();
assertThat(mInstallCertificatePreferenceController.isAvailable()).isTrue();
assertThat(mResetCredentialsPreferenceController.isAvailable()).isTrue();
assertThat(mUserCredentialsPreferenceController.isAvailable()).isTrue();
@@ -86,7 +82,6 @@
public void isAvailable_hasRestriction_shouldReturnFalse() {
mUserManager.addBaseUserRestriction(UserManager.DISALLOW_CONFIG_CREDENTIALS);
- assertThat(mCredentialStoragePreferenceController.isAvailable()).isFalse();
assertThat(mInstallCertificatePreferenceController.isAvailable()).isFalse();
assertThat(mResetCredentialsPreferenceController.isAvailable()).isFalse();
assertThat(mUserCredentialsPreferenceController.isAvailable()).isFalse();