Make preference unselectable
Because Encrypt phone is not an entry which can launch to next page,
let's make it unselectable now.
Change-Id: I860c76c501fccc488b2e120a4702c652f1bee134
Test: Manual test
Fix: 249193859
diff --git a/res/xml/encryption_and_credential.xml b/res/xml/encryption_and_credential.xml
index cc8210a..5663df1 100644
--- a/res/xml/encryption_and_credential.xml
+++ b/res/xml/encryption_and_credential.xml
@@ -27,6 +27,7 @@
android:key="encryption_and_credentials_encryption_status"
android:title="@string/encrypt_title"
android:summary="@string/summary_placeholder"
+ android:selectable="false"
settings:controller="com.android.settings.security.EncryptionStatusPreferenceController"/>
</PreferenceCategory>
diff --git a/tests/robotests/src/com/android/settings/security/EncryptionAndCredentialTest.java b/tests/robotests/src/com/android/settings/security/EncryptionAndCredentialTest.java
index 1d7a4a7..446fd6c 100644
--- a/tests/robotests/src/com/android/settings/security/EncryptionAndCredentialTest.java
+++ b/tests/robotests/src/com/android/settings/security/EncryptionAndCredentialTest.java
@@ -20,8 +20,12 @@
import android.app.admin.DevicePolicyManager;
import android.content.Context;
+import android.os.Bundle;
import android.os.UserManager;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceFragmentCompat;
+
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import org.junit.Before;
@@ -32,6 +36,7 @@
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.shadows.ShadowApplication;
+import org.robolectric.shadows.androidx.fragment.FragmentController;
@RunWith(RobolectricTestRunner.class)
public class EncryptionAndCredentialTest {
@@ -58,4 +63,24 @@
assertThat(fragment.getMetricsCategory()).isEqualTo(MetricsEvent.ENCRYPTION_AND_CREDENTIAL);
}
+ @Test
+ public void isSelectable_encryptionPreferenceStatus_isNotSelectable() {
+ final PreferenceFragmentCompat fragment =
+ FragmentController.of(new TestFragment(), new Bundle())
+ .create()
+ .start()
+ .resume()
+ .get();
+ final Preference preference =
+ fragment.findPreference("encryption_and_credentials_encryption_status");
+
+ assertThat(preference.isSelectable()).isFalse();
+ }
+
+ public static class TestFragment extends PreferenceFragmentCompat {
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ addPreferencesFromResource(com.android.settings.R.xml.encryption_and_credential);
+ }
+ }
}