diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 5a310e980f3..16baf544f81 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2384,7 +2384,7 @@
+ android:value="com.android.settings.security.CryptKeeperSettings" />
-
-
+ android:paddingStart="@dimen/preference_no_icon_padding_start"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:orientation="vertical">
+ android:layout_weight="1">
+ android:orientation="vertical">
+ android:text="@string/crypt_keeper_desc" />
+ android:visibility="gone" />
+ android:visibility="gone" />
-
-
+ android:layout_gravity="end"
+ android:text="@string/crypt_keeper_button_text" />
diff --git a/res/xml/encryption_and_credential.xml b/res/xml/encryption_and_credential.xml
index 715ea141158..4960f257410 100644
--- a/res/xml/encryption_and_credential.xml
+++ b/res/xml/encryption_and_credential.xml
@@ -14,45 +14,66 @@
limitations under the License.
-->
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
-
+
-
+
diff --git a/res/xml/security_settings_encrypted.xml b/res/xml/security_settings_encrypted.xml
deleted file mode 100644
index fd7cbce9fbb..00000000000
--- a/res/xml/security_settings_encrypted.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/xml/security_settings_unencrypted.xml b/res/xml/security_settings_unencrypted.xml
deleted file mode 100644
index 4b51376e90e..00000000000
--- a/res/xml/security_settings_unencrypted.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/com/android/settings/applications/DefaultAppSettings.java b/src/com/android/settings/applications/DefaultAppSettings.java
index 1487da3092e..34b635b0eb5 100644
--- a/src/com/android/settings/applications/DefaultAppSettings.java
+++ b/src/com/android/settings/applications/DefaultAppSettings.java
@@ -30,12 +30,12 @@ import com.android.settings.applications.defaultapps.DefaultPaymentSettingsPrefe
import com.android.settings.applications.defaultapps.DefaultPhonePreferenceController;
import com.android.settings.applications.defaultapps.DefaultSmsPreferenceController;
import com.android.settings.applications.defaultapps.DefaultWorkBrowserPreferenceController;
-import com.android.settings.widget.WorkOnlyCategoryPreferenceController;
import com.android.settings.applications.defaultapps.DefaultWorkPhonePreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settings.widget.PreferenceCategoryController;
import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
@@ -75,7 +75,7 @@ public class DefaultAppSettings extends DashboardFragment {
workControllers.add(new DefaultWorkPhonePreferenceController(context));
workControllers.add(new DefaultWorkBrowserPreferenceController(context));
controllers.addAll(workControllers);
- controllers.add(new WorkOnlyCategoryPreferenceController(
+ controllers.add(new PreferenceCategoryController(
context, KEY_DEFAULT_WORK_CATEGORY, workControllers));
controllers.add(new DefaultAssistPreferenceController(context, KEY_ASSIST_VOICE_INPUT,
false /* showSetting */));
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index 588e465b641..8eb75ba3561 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -18,7 +18,6 @@ package com.android.settings.core.gateway;
import com.android.settings.ApnEditor;
import com.android.settings.ApnSettings;
-import com.android.settings.CryptKeeperSettings;
import com.android.settings.DateTimeSettings;
import com.android.settings.DeviceAdminSettings;
import com.android.settings.DeviceInfoSettings;
@@ -45,7 +44,6 @@ import com.android.settings.applications.DefaultAppSettings;
import com.android.settings.applications.DrawOverlayDetails;
import com.android.settings.applications.ExternalSourcesDetails;
import com.android.settings.applications.InstalledAppDetails;
-import com.android.settings.applications.manageapplications.ManageApplications;
import com.android.settings.applications.ManageDomainUrls;
import com.android.settings.applications.NotificationApps;
import com.android.settings.applications.PictureInPictureDetails;
@@ -56,6 +54,7 @@ import com.android.settings.applications.UsageAccessDetails;
import com.android.settings.applications.VrListenerSettings;
import com.android.settings.applications.WriteSettingsDetails;
import com.android.settings.applications.assist.ManageAssist;
+import com.android.settings.applications.manageapplications.ManageApplications;
import com.android.settings.bluetooth.BluetoothDeviceDetailsFragment;
import com.android.settings.bluetooth.BluetoothSettings;
import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
@@ -106,8 +105,8 @@ import com.android.settings.notification.NotificationAccessSettings;
import com.android.settings.notification.NotificationStation;
import com.android.settings.notification.SoundSettings;
import com.android.settings.notification.ZenAccessSettings;
-import com.android.settings.notification.ZenModeBehaviorSettings;
import com.android.settings.notification.ZenModeAutomationSettings;
+import com.android.settings.notification.ZenModeBehaviorSettings;
import com.android.settings.notification.ZenModeEventRuleSettings;
import com.android.settings.notification.ZenModeScheduleRuleSettings;
import com.android.settings.notification.ZenModeSettings;
@@ -115,6 +114,7 @@ import com.android.settings.password.ChooseLockPassword;
import com.android.settings.password.ChooseLockPattern;
import com.android.settings.print.PrintJobSettingsFragment;
import com.android.settings.print.PrintSettingsFragment;
+import com.android.settings.security.CryptKeeperSettings;
import com.android.settings.security.LockscreenDashboardFragment;
import com.android.settings.sim.SimSettings;
import com.android.settings.support.SupportDashboardActivity;
diff --git a/src/com/android/settings/CryptKeeperSettings.java b/src/com/android/settings/security/CryptKeeperSettings.java
similarity index 98%
rename from src/com/android/settings/CryptKeeperSettings.java
rename to src/com/android/settings/security/CryptKeeperSettings.java
index e11bccd7cc0..7d5ee9d4357 100644
--- a/src/com/android/settings/CryptKeeperSettings.java
+++ b/src/com/android/settings/security/CryptKeeperSettings.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.settings;
+package com.android.settings.security;
import android.app.Activity;
import android.app.AlertDialog;
@@ -36,6 +36,9 @@ import android.view.ViewGroup;
import android.widget.Button;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.settings.CryptKeeperConfirm;
+import com.android.settings.R;
+import com.android.settings.SettingsActivity;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settings.password.ConfirmLockPattern;
diff --git a/src/com/android/settings/security/EncryptionAndCredential.java b/src/com/android/settings/security/EncryptionAndCredential.java
index 0972e3e6e47..b281fb7efdb 100644
--- a/src/com/android/settings/security/EncryptionAndCredential.java
+++ b/src/com/android/settings/security/EncryptionAndCredential.java
@@ -16,7 +16,6 @@
package com.android.settings.security;
-import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.os.UserHandle;
@@ -27,15 +26,16 @@ import android.support.v7.preference.PreferenceGroup;
import android.support.v7.preference.PreferenceScreen;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.widget.PreferenceCategoryController;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedPreference;
import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -55,13 +55,9 @@ public class EncryptionAndCredential extends DashboardFragment {
private static final int MY_USER_ID = UserHandle.myUserId();
- private UserManager mUm;
-
private KeyStore mKeyStore;
private RestrictedPreference mResetCredentials;
- private boolean mIsAdmin;
-
@Override
public int getMetricsCategory() {
return MetricsEvent.ENCRYPTION_AND_CREDENTIAL;
@@ -74,13 +70,23 @@ public class EncryptionAndCredential extends DashboardFragment {
@Override
protected List getPreferenceControllers(Context context) {
- mUm = (UserManager) context.getSystemService(Context.USER_SERVICE);
- return null;
+ return buildPreferenceControllers(context);
}
@Override
protected int getPreferenceScreenResId() {
- return 0;
+ return R.xml.encryption_and_credential;
+ }
+
+ private static List buildPreferenceControllers(Context context) {
+ final List controllers = new ArrayList<>();
+ final EncryptionStatusPreferenceController encryptStatusController =
+ new EncryptionStatusPreferenceController(context);
+ controllers.add(encryptStatusController);
+ controllers.add(new PreferenceCategoryController(context,
+ "encryption_and_credentials_status_category",
+ Arrays.asList(encryptStatusController)));
+ return controllers;
}
/**
@@ -90,26 +96,7 @@ public class EncryptionAndCredential extends DashboardFragment {
* logic or adding/removing preferences here.
*/
private PreferenceScreen createPreferenceHierarchy() {
- PreferenceScreen root = getPreferenceScreen();
- if (root != null) {
- root.removeAll();
- }
- addPreferencesFromResource(R.xml.encryption_and_credential);
- root = getPreferenceScreen();
-
- // Add options for device encryption
- mIsAdmin = mUm.isAdminUser();
-
- if (mIsAdmin) {
- if (LockPatternUtils.isDeviceEncryptionEnabled()) {
- // The device is currently encrypted.
- addPreferencesFromResource(R.xml.security_settings_encrypted);
- } else {
- // This device supports encryption but isn't encrypted.
- addPreferencesFromResource(R.xml.security_settings_unencrypted);
- }
- }
-
+ final PreferenceScreen root = getPreferenceScreen();
// Credential storage
mKeyStore = KeyStore.getInstance(); // needs to be initialized for onResume()
@@ -185,14 +172,14 @@ public class EncryptionAndCredential extends DashboardFragment {
@Override
public List getXmlResourcesToIndex(
Context context, boolean enabled) {
- final List index = new ArrayList<>();
+ final SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.encryption_and_credential;
+ return Arrays.asList(sir);
+ }
- // Add everything. We will suppress some of them in getNonIndexableKeys()
- index.add(getSearchResource(context, R.xml.encryption_and_credential));
- index.add(getSearchResource(context, R.xml.security_settings_encrypted));
- index.add(getSearchResource(context, R.xml.security_settings_unencrypted));
-
- return index;
+ @Override
+ public List getPreferenceControllers(Context context) {
+ return buildPreferenceControllers(context);
}
@Override
@@ -201,12 +188,6 @@ public class EncryptionAndCredential extends DashboardFragment {
return um.isAdminUser();
}
- private SearchIndexableResource getSearchResource(Context context, int xmlResId) {
- final SearchIndexableResource sir = new SearchIndexableResource(context);
- sir.xmlResId = xmlResId;
- return sir;
- }
-
@Override
public List getNonIndexableKeys(Context context) {
final List keys = super.getNonIndexableKeys(context);
@@ -223,21 +204,6 @@ public class EncryptionAndCredential extends DashboardFragment {
keys.add(KEY_USER_CREDENTIALS);
}
- final DevicePolicyManager dpm = (DevicePolicyManager)
- context.getSystemService(Context.DEVICE_POLICY_SERVICE);
- switch (dpm.getStorageEncryptionStatus()) {
- case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE:
- // The device is currently encrypted. Disable security_settings_unencrypted
- keys.addAll(getNonIndexableKeysFromXml(
- context, R.xml.security_settings_unencrypted));
- break;
- default:
- // This device supports encryption but isn't encrypted.
- keys.addAll(getNonIndexableKeysFromXml(
- context, R.xml.security_settings_encrypted));
- break;
- }
-
return keys;
}
}
diff --git a/src/com/android/settings/security/EncryptionStatusPreferenceController.java b/src/com/android/settings/security/EncryptionStatusPreferenceController.java
new file mode 100644
index 00000000000..7d84421bbd1
--- /dev/null
+++ b/src/com/android/settings/security/EncryptionStatusPreferenceController.java
@@ -0,0 +1,61 @@
+/*
+ * 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.support.v7.preference.Preference;
+
+import com.android.internal.widget.LockPatternUtils;
+import com.android.settings.R;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
+
+public class EncryptionStatusPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin {
+
+ private static final String PREF_KEY = "encryption_and_credentials_encryption_status";
+
+ private final UserManager mUserManager;
+
+ public EncryptionStatusPreferenceController(Context context) {
+ super(context);
+ mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
+ }
+
+ @Override
+ public boolean isAvailable() {
+ return mUserManager.isAdminUser();
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return PREF_KEY;
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ final boolean encryptionEnabled = LockPatternUtils.isDeviceEncryptionEnabled();
+ if (encryptionEnabled) {
+ preference.setFragment(null);
+ preference.setSummary(R.string.crypt_keeper_encrypted_summary);
+ } else {
+ preference.setFragment(CryptKeeperSettings.class.getName());
+ preference.setSummary(R.string.summary_placeholder);
+ }
+ }
+}
diff --git a/src/com/android/settings/widget/WorkOnlyCategoryPreferenceController.java b/src/com/android/settings/widget/PreferenceCategoryController.java
similarity index 82%
rename from src/com/android/settings/widget/WorkOnlyCategoryPreferenceController.java
rename to src/com/android/settings/widget/PreferenceCategoryController.java
index a308b2f1b10..98364769e47 100644
--- a/src/com/android/settings/widget/WorkOnlyCategoryPreferenceController.java
+++ b/src/com/android/settings/widget/PreferenceCategoryController.java
@@ -23,13 +23,18 @@ import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
-public class WorkOnlyCategoryPreferenceController extends AbstractPreferenceController
+/**
+ * A controller for generic Preference categories. If all controllers for its children reports
+ * not-available, this controller will also report not-available, and subsequently will be hidden by
+ * UI.
+ */
+public class PreferenceCategoryController extends AbstractPreferenceController
implements PreferenceControllerMixin {
private final String mKey;
private final List mChildren;
- public WorkOnlyCategoryPreferenceController(Context context,
+ public PreferenceCategoryController(Context context,
String key, List childrenControllers) {
super(context);
mKey = key;
diff --git a/tests/robotests/src/com/android/settings/security/EncryptionAndCredentialTest.java b/tests/robotests/src/com/android/settings/security/EncryptionAndCredentialTest.java
index c87c96476ca..60e7dee6d21 100644
--- a/tests/robotests/src/com/android/settings/security/EncryptionAndCredentialTest.java
+++ b/tests/robotests/src/com/android/settings/security/EncryptionAndCredentialTest.java
@@ -16,8 +16,6 @@
package com.android.settings.security;
-import static android.app.admin.DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE;
-import static android.app.admin.DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE;
import static com.android.settings.security.EncryptionAndCredential.SEARCH_INDEX_DATA_PROVIDER;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.when;
@@ -28,7 +26,6 @@ import android.os.UserManager;
import android.provider.SearchIndexableResource;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.R;
import com.android.settings.TestConfig;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
@@ -71,16 +68,6 @@ public class EncryptionAndCredentialTest {
assertThat(fragment.getMetricsCategory()).isEqualTo(MetricsEvent.ENCRYPTION_AND_CREDENTIAL);
}
- // Search provider tests
- @Test
- public void getXmlResourcesToIndex_shouldReturnAllXmls() {
- final List index =
- SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
- mContext, true /* enabled */);
-
- assertThat(index).hasSize(3);
- }
-
@Test
public void getNonIndexableKeys_pageIsDisabled_shouldReturnAllKeysAsNonIndexable() {
when(mUserManager.isAdminUser()).thenReturn(false);
@@ -96,32 +83,4 @@ public class EncryptionAndCredentialTest {
assertThat(keys).containsExactlyElementsIn(expectedKeys);
}
-
- @Test
- public void getNonIndexableKeys_deviceEncrypted_shouldReturnUnencryptedKeys() {
- when(mUserManager.isAdminUser()).thenReturn(true);
- when(mDevicePolicyManager.getStorageEncryptionStatus()).thenReturn(
- ENCRYPTION_STATUS_ACTIVE);
-
- final List expectedKeys = new ArrayList<>();
- expectedKeys.addAll(((BaseSearchIndexProvider) SEARCH_INDEX_DATA_PROVIDER)
- .getNonIndexableKeysFromXml(mContext, R.xml.security_settings_unencrypted));
- final List keys = SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
-
- assertThat(keys).containsExactlyElementsIn(expectedKeys);
- }
-
- @Test
- public void getNonIndexableKeys_deviceNotEncrypted_shouldReturnEncryptedKeys() {
- when(mUserManager.isAdminUser()).thenReturn(true);
- when(mDevicePolicyManager.getStorageEncryptionStatus())
- .thenReturn(ENCRYPTION_STATUS_INACTIVE);
-
- final List expectedKeys = new ArrayList<>();
- expectedKeys.addAll(((BaseSearchIndexProvider) SEARCH_INDEX_DATA_PROVIDER)
- .getNonIndexableKeysFromXml(mContext, R.xml.security_settings_encrypted));
- final List keys = SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
-
- assertThat(keys).containsExactlyElementsIn(expectedKeys);
- }
}
diff --git a/tests/robotests/src/com/android/settings/security/EncryptionStatusPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/EncryptionStatusPreferenceControllerTest.java
new file mode 100644
index 00000000000..a53ee4245d7
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/security/EncryptionStatusPreferenceControllerTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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 android.support.v7.preference.Preference;
+
+import com.android.settings.R;
+import com.android.settings.TestConfig;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
+import com.android.settings.testutils.shadow.ShadowUserManager;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+ shadows = {
+ ShadowUserManager.class,
+ ShadowLockPatternUtils.class
+ })
+public class EncryptionStatusPreferenceControllerTest {
+
+ private Context mContext;
+ private EncryptionStatusPreferenceController mController;
+ private Preference mPreference;
+
+ @Before
+ public void setUp() {
+ mContext = RuntimeEnvironment.application;
+ mController = new EncryptionStatusPreferenceController(mContext);
+ mPreference = new Preference(mContext);
+ }
+
+ @Test
+ public void isAvailable_admin_true() {
+ ShadowUserManager.getShadow().setIsAdminUser(true);
+
+ assertThat(mController.isAvailable()).isTrue();
+ }
+
+ @Test
+ public void isAvailable_notAdmin_false() {
+ ShadowUserManager.getShadow().setIsAdminUser(false);
+
+ assertThat(mController.isAvailable()).isFalse();
+ }
+
+ @Test
+ public void updateSummary_encrypted_shouldSayEncrypted() {
+ ShadowLockPatternUtils.setDeviceEncryptionEnabled(true);
+
+ mController.updateState(mPreference);
+
+ assertThat(mPreference.getFragment()).isNull();
+ assertThat(mPreference.getSummary())
+ .isEqualTo(mContext.getText(R.string.crypt_keeper_encrypted_summary));
+ }
+
+ @Test
+ public void updateSummary_unencrypted_shouldHasEncryptionFragment() {
+ ShadowLockPatternUtils.setDeviceEncryptionEnabled(false);
+
+ mController.updateState(mPreference);
+
+ assertThat(mPreference.getSummary())
+ .isEqualTo(mContext.getText(R.string.summary_placeholder));
+ assertThat(mPreference.getFragment()).isEqualTo(CryptKeeperSettings.class.getName());
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java
index 3182a935d5d..e7f6be5f743 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowLockPatternUtils.java
@@ -27,6 +27,8 @@ import org.robolectric.annotation.Implements;
public class ShadowLockPatternUtils {
private int mPasswordQuality = 1;
+ private static boolean sDeviceEncryptionEnabled;
+
@Implementation
public boolean isSecure(int id) {
return true;
@@ -42,6 +44,15 @@ public class ShadowLockPatternUtils {
return mPasswordQuality;
}
+ @Implementation
+ public static boolean isDeviceEncryptionEnabled() {
+ return sDeviceEncryptionEnabled;
+ }
+
+ public static void setDeviceEncryptionEnabled(boolean deviceEncryptionEnabled) {
+ sDeviceEncryptionEnabled = deviceEncryptionEnabled;
+ }
+
// Non-Android accessor.
public int getPasswordQuality() {
return mPasswordQuality;
diff --git a/tests/robotests/src/com/android/settings/widget/WorkOnlyCategoryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/widget/PreferenceCategoryControllerTest.java
similarity index 91%
rename from tests/robotests/src/com/android/settings/widget/WorkOnlyCategoryPreferenceControllerTest.java
rename to tests/robotests/src/com/android/settings/widget/PreferenceCategoryControllerTest.java
index 9c7e8fc5ede..23aa378dad1 100644
--- a/tests/robotests/src/com/android/settings/widget/WorkOnlyCategoryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/widget/PreferenceCategoryControllerTest.java
@@ -37,17 +37,17 @@ import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public class WorkOnlyCategoryPreferenceControllerTest {
+public class PreferenceCategoryControllerTest {
private Context mContext;
- private WorkOnlyCategoryPreferenceController mController;
+ private PreferenceCategoryController mController;
private List mChildren;
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
mChildren = new ArrayList<>();
- mController = new WorkOnlyCategoryPreferenceController(mContext, "pref_key", mChildren);
+ mController = new PreferenceCategoryController(mContext, "pref_key", mChildren);
}
@Test