summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SettingsLib/MainSwitchPreference/res/layout-v31/settingslib_main_switch_bar.xml2
-rw-r--r--packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/MainSwitchBarTest.java8
2 files changed, 10 insertions, 0 deletions
diff --git a/packages/SettingsLib/MainSwitchPreference/res/layout-v31/settingslib_main_switch_bar.xml b/packages/SettingsLib/MainSwitchPreference/res/layout-v31/settingslib_main_switch_bar.xml
index 010b9ba4324b..e46ea4a5f56c 100644
--- a/packages/SettingsLib/MainSwitchPreference/res/layout-v31/settingslib_main_switch_bar.xml
+++ b/packages/SettingsLib/MainSwitchPreference/res/layout-v31/settingslib_main_switch_bar.xml
@@ -59,6 +59,8 @@
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
+ android:focusable="false"
+ android:clickable="false"
android:track="@drawable/settingslib_track_selector"
android:thumb="@drawable/settingslib_thumb_selector"
android:theme="@style/MainSwitch.Settingslib"/>
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/MainSwitchBarTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/MainSwitchBarTest.java
index 701a343c79f7..0845ca325d38 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/MainSwitchBarTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/widget/MainSwitchBarTest.java
@@ -76,6 +76,14 @@ public class MainSwitchBarTest {
}
@Test
+ public void getSwitch_shouldNotFocusableAndClickable() {
+ final Switch switchObj = mBar.getSwitch();
+
+ assertThat(switchObj.isFocusable()).isFalse();
+ assertThat(switchObj.isClickable()).isFalse();
+ }
+
+ @Test
public void show_shouldVisible() {
mBar.show();