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
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
android:key="encryption_and_credentials_encryption_status"
|
android:key="encryption_and_credentials_encryption_status"
|
||||||
android:title="@string/encrypt_title"
|
android:title="@string/encrypt_title"
|
||||||
android:summary="@string/summary_placeholder"
|
android:summary="@string/summary_placeholder"
|
||||||
|
android:selectable="false"
|
||||||
settings:controller="com.android.settings.security.EncryptionStatusPreferenceController"/>
|
settings:controller="com.android.settings.security.EncryptionStatusPreferenceController"/>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
@@ -20,8 +20,12 @@ import static com.google.common.truth.Truth.assertThat;
|
|||||||
|
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
|
|
||||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -32,6 +36,7 @@ import org.mockito.MockitoAnnotations;
|
|||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
import org.robolectric.RuntimeEnvironment;
|
import org.robolectric.RuntimeEnvironment;
|
||||||
import org.robolectric.shadows.ShadowApplication;
|
import org.robolectric.shadows.ShadowApplication;
|
||||||
|
import org.robolectric.shadows.androidx.fragment.FragmentController;
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
public class EncryptionAndCredentialTest {
|
public class EncryptionAndCredentialTest {
|
||||||
@@ -58,4 +63,24 @@ public class EncryptionAndCredentialTest {
|
|||||||
assertThat(fragment.getMetricsCategory()).isEqualTo(MetricsEvent.ENCRYPTION_AND_CREDENTIAL);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user