Loading res/values/bools.xml +3 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,9 @@ <!-- Whether device_administrators should be shown or not. --> <bool name="config_show_device_administrators">true</bool> <!-- Whether encryption_and_credentials_encryption_status should be shown or not. --> <bool name="config_show_encryption_and_credentials_encryption_status">true</bool> <!-- Whether premium_sms should be shown or not. --> <bool name="config_show_premium_sms">true</bool> Loading src/com/android/settings/security/EncryptionStatusPreferenceController.java +6 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,12 @@ public class EncryptionStatusPreferenceController extends BasePreferenceControll @Override public int getAvailabilityStatus() { if (TextUtils.equals(getPreferenceKey(), PREF_KEY_ENCRYPTION_DETAIL_PAGE) && !mContext.getResources().getBoolean( R.bool.config_show_encryption_and_credentials_encryption_status)) { return DISABLED_UNSUPPORTED; } return mUserManager.isAdminUser() ? AVAILABLE : DISABLED_FOR_USER; } Loading tests/robotests/res/values-mcc999/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ <bool name="config_show_screen_locking_sounds">false</bool> <bool name="config_show_touch_sounds">false</bool> <bool name="config_show_device_administrators">false</bool> <bool name="config_show_encryption_and_credentials_encryption_status">false</bool> <bool name="config_show_premium_sms">false</bool> <bool name="config_show_data_saver">false</bool> <bool name="config_show_enabled_vr_listeners">false</bool> Loading tests/robotests/src/com/android/settings/security/EncryptionStatusPreferenceControllerTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,23 @@ public class EncryptionStatusPreferenceControllerTest { assertThat(mController.isAvailable()).isFalse(); } @Test @Config(qualifiers = "mcc999") public void isAvailable_notVisible_false() { assertThat(mController.isAvailable()).isFalse(); } @Test @Config(qualifiers = "mcc999") public void isAvailable_notVisible_butNotDetailPage_true() { mController = new EncryptionStatusPreferenceController(mContext, PREF_KEY_ENCRYPTION_SECURITY_PAGE); UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); Shadows.shadowOf(userManager).setIsAdminUser(true); assertThat(mController.isAvailable()).isTrue(); } @Test public void updateSummary_encrypted_shouldSayEncrypted() { ShadowLockPatternUtils.setDeviceEncryptionEnabled(true); Loading Loading
res/values/bools.xml +3 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,9 @@ <!-- Whether device_administrators should be shown or not. --> <bool name="config_show_device_administrators">true</bool> <!-- Whether encryption_and_credentials_encryption_status should be shown or not. --> <bool name="config_show_encryption_and_credentials_encryption_status">true</bool> <!-- Whether premium_sms should be shown or not. --> <bool name="config_show_premium_sms">true</bool> Loading
src/com/android/settings/security/EncryptionStatusPreferenceController.java +6 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,12 @@ public class EncryptionStatusPreferenceController extends BasePreferenceControll @Override public int getAvailabilityStatus() { if (TextUtils.equals(getPreferenceKey(), PREF_KEY_ENCRYPTION_DETAIL_PAGE) && !mContext.getResources().getBoolean( R.bool.config_show_encryption_and_credentials_encryption_status)) { return DISABLED_UNSUPPORTED; } return mUserManager.isAdminUser() ? AVAILABLE : DISABLED_FOR_USER; } Loading
tests/robotests/res/values-mcc999/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ <bool name="config_show_screen_locking_sounds">false</bool> <bool name="config_show_touch_sounds">false</bool> <bool name="config_show_device_administrators">false</bool> <bool name="config_show_encryption_and_credentials_encryption_status">false</bool> <bool name="config_show_premium_sms">false</bool> <bool name="config_show_data_saver">false</bool> <bool name="config_show_enabled_vr_listeners">false</bool> Loading
tests/robotests/src/com/android/settings/security/EncryptionStatusPreferenceControllerTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,23 @@ public class EncryptionStatusPreferenceControllerTest { assertThat(mController.isAvailable()).isFalse(); } @Test @Config(qualifiers = "mcc999") public void isAvailable_notVisible_false() { assertThat(mController.isAvailable()).isFalse(); } @Test @Config(qualifiers = "mcc999") public void isAvailable_notVisible_butNotDetailPage_true() { mController = new EncryptionStatusPreferenceController(mContext, PREF_KEY_ENCRYPTION_SECURITY_PAGE); UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); Shadows.shadowOf(userManager).setIsAdminUser(true); assertThat(mController.isAvailable()).isTrue(); } @Test public void updateSummary_encrypted_shouldSayEncrypted() { ShadowLockPatternUtils.setDeviceEncryptionEnabled(true); Loading