Loading res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -330,6 +330,9 @@ <!-- Whether device_model should be shown or not. --> <bool name="config_show_device_model">true</bool> <!-- Whether top_level_accessibility should be shown or not. --> <bool name="config_show_top_level_accessibility">true</bool> <!-- Whether top_level_battery should be shown or not. --> <bool name="config_show_top_level_battery">true</bool> Loading res/xml/top_level_settings.xml +2 −1 Original line number Diff line number Diff line Loading @@ -123,7 +123,8 @@ android:summary="@string/accessibility_settings_summary" android:icon="@drawable/ic_homepage_accessibility" android:order="-20" android:fragment="com.android.settings.accessibility.AccessibilitySettings"/> android:fragment="com.android.settings.accessibility.AccessibilitySettings" settings:controller="com.android.settings.accessibility.TopLevelAccessibilityPreferenceController"/> <Preference android:key="top_level_system" Loading src/com/android/settings/accessibility/TopLevelAccessibilityPreferenceController.java 0 → 100644 +38 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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.accessibility; import android.content.Context; import com.android.settings.R; import com.android.settings.core.BasePreferenceController; public class TopLevelAccessibilityPreferenceController extends BasePreferenceController { public TopLevelAccessibilityPreferenceController(Context context, String preferenceKey) { super(context, preferenceKey); } @Override public int getAvailabilityStatus() { return mContext.getResources().getBoolean(R.bool.config_show_top_level_accessibility) ? AVAILABLE_UNSEARCHABLE : UNSUPPORTED_ON_DEVICE; } } tests/robotests/res/values-mcc999/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ <bool name="config_show_reset_dashboard">false</bool> <bool name="config_show_system_update_settings">false</bool> <bool name="config_show_device_model">false</bool> <bool name="config_show_top_level_accessibility">false</bool> <bool name="config_show_top_level_battery">false</bool> <bool name="config_show_top_level_connected_devices">false</bool> <bool name="config_show_top_level_display">false</bool> Loading tests/robotests/src/com/android/settings/accessibility/TopLevelAccessibilityPreferenceControllerTest.java 0 → 100644 +59 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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.accessibility; import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE; import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE; import static com.google.common.truth.Truth.assertThat; import android.content.Context; import com.android.settings.R; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Config; import org.robolectric.annotation.Implementation; import org.robolectric.annotation.Implements; @RunWith(RobolectricTestRunner.class) public class TopLevelAccessibilityPreferenceControllerTest { private Context mContext; private TopLevelAccessibilityPreferenceController mController; @Before public void setUp() { mContext = RuntimeEnvironment.application; mController = new TopLevelAccessibilityPreferenceController(mContext, "test_key"); } @Test public void getAvailibilityStatus_availableByDefault() { assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE); } @Test @Config(qualifiers = "mcc999") public void getAvailabilityStatus_unsupportedWhenSet() { assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE); } } Loading
res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -330,6 +330,9 @@ <!-- Whether device_model should be shown or not. --> <bool name="config_show_device_model">true</bool> <!-- Whether top_level_accessibility should be shown or not. --> <bool name="config_show_top_level_accessibility">true</bool> <!-- Whether top_level_battery should be shown or not. --> <bool name="config_show_top_level_battery">true</bool> Loading
res/xml/top_level_settings.xml +2 −1 Original line number Diff line number Diff line Loading @@ -123,7 +123,8 @@ android:summary="@string/accessibility_settings_summary" android:icon="@drawable/ic_homepage_accessibility" android:order="-20" android:fragment="com.android.settings.accessibility.AccessibilitySettings"/> android:fragment="com.android.settings.accessibility.AccessibilitySettings" settings:controller="com.android.settings.accessibility.TopLevelAccessibilityPreferenceController"/> <Preference android:key="top_level_system" Loading
src/com/android/settings/accessibility/TopLevelAccessibilityPreferenceController.java 0 → 100644 +38 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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.accessibility; import android.content.Context; import com.android.settings.R; import com.android.settings.core.BasePreferenceController; public class TopLevelAccessibilityPreferenceController extends BasePreferenceController { public TopLevelAccessibilityPreferenceController(Context context, String preferenceKey) { super(context, preferenceKey); } @Override public int getAvailabilityStatus() { return mContext.getResources().getBoolean(R.bool.config_show_top_level_accessibility) ? AVAILABLE_UNSEARCHABLE : UNSUPPORTED_ON_DEVICE; } }
tests/robotests/res/values-mcc999/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ <bool name="config_show_reset_dashboard">false</bool> <bool name="config_show_system_update_settings">false</bool> <bool name="config_show_device_model">false</bool> <bool name="config_show_top_level_accessibility">false</bool> <bool name="config_show_top_level_battery">false</bool> <bool name="config_show_top_level_connected_devices">false</bool> <bool name="config_show_top_level_display">false</bool> Loading
tests/robotests/src/com/android/settings/accessibility/TopLevelAccessibilityPreferenceControllerTest.java 0 → 100644 +59 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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.accessibility; import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE; import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE; import static com.google.common.truth.Truth.assertThat; import android.content.Context; import com.android.settings.R; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Config; import org.robolectric.annotation.Implementation; import org.robolectric.annotation.Implements; @RunWith(RobolectricTestRunner.class) public class TopLevelAccessibilityPreferenceControllerTest { private Context mContext; private TopLevelAccessibilityPreferenceController mController; @Before public void setUp() { mContext = RuntimeEnvironment.application; mController = new TopLevelAccessibilityPreferenceController(mContext, "test_key"); } @Test public void getAvailibilityStatus_availableByDefault() { assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE); } @Test @Config(qualifiers = "mcc999") public void getAvailabilityStatus_unsupportedWhenSet() { assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE); } }