Merge "Remove "storage type" preference from Settings" am: d6ac86d602
am: 44c538ccef
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1353609 Change-Id: I2e9fc90f247f4b088f749afeb75a0b3e67e73198
This commit is contained in:
@@ -6200,12 +6200,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] -->
|
||||
|
@@ -37,12 +37,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"
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -72,7 +72,6 @@ public class EncryptionAndCredential extends DashboardFragment {
|
||||
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));
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
@@ -39,7 +39,6 @@ public class RestrictedEncryptionPreferenceControllerTest {
|
||||
|
||||
private Context mContext;
|
||||
private ShadowUserManager mUserManager;
|
||||
private CredentialStoragePreferenceController mCredentialStoragePreferenceController;
|
||||
private InstallCertificatePreferenceController mInstallCertificatePreferenceController;
|
||||
private ResetCredentialsPreferenceController mResetCredentialsPreferenceController;
|
||||
private UserCredentialsPreferenceController mUserCredentialsPreferenceController;
|
||||
@@ -54,8 +53,6 @@ public class RestrictedEncryptionPreferenceControllerTest {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mLifecycleOwner = () -> mLifecycle;
|
||||
mLifecycle = new Lifecycle(mLifecycleOwner);
|
||||
mCredentialStoragePreferenceController =
|
||||
new CredentialStoragePreferenceController(mContext);
|
||||
mInstallCertificatePreferenceController =
|
||||
new InstallCertificatePreferenceController(mContext);
|
||||
mResetCredentialsPreferenceController =
|
||||
@@ -73,7 +70,6 @@ public class RestrictedEncryptionPreferenceControllerTest {
|
||||
|
||||
@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 class RestrictedEncryptionPreferenceControllerTest {
|
||||
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();
|
||||
|
Reference in New Issue
Block a user