Add flag to hide top-level accessibility.
Bug: None Test: robotests Change-Id: I67cee6054e54389812bc025e637029547c8f2896
This commit is contained in:
@@ -330,6 +330,9 @@
|
|||||||
<!-- Whether device_model should be shown or not. -->
|
<!-- Whether device_model should be shown or not. -->
|
||||||
<bool name="config_show_device_model">true</bool>
|
<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. -->
|
<!-- Whether top_level_battery should be shown or not. -->
|
||||||
<bool name="config_show_top_level_battery">true</bool>
|
<bool name="config_show_top_level_battery">true</bool>
|
||||||
|
|
||||||
|
@@ -123,7 +123,8 @@
|
|||||||
android:summary="@string/accessibility_settings_summary"
|
android:summary="@string/accessibility_settings_summary"
|
||||||
android:icon="@drawable/ic_homepage_accessibility"
|
android:icon="@drawable/ic_homepage_accessibility"
|
||||||
android:order="-20"
|
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
|
<Preference
|
||||||
android:key="top_level_system"
|
android:key="top_level_system"
|
||||||
|
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@@ -57,6 +57,7 @@
|
|||||||
<bool name="config_show_reset_dashboard">false</bool>
|
<bool name="config_show_reset_dashboard">false</bool>
|
||||||
<bool name="config_show_system_update_settings">false</bool>
|
<bool name="config_show_system_update_settings">false</bool>
|
||||||
<bool name="config_show_device_model">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_battery">false</bool>
|
||||||
<bool name="config_show_top_level_connected_devices">false</bool>
|
<bool name="config_show_top_level_connected_devices">false</bool>
|
||||||
<bool name="config_show_top_level_display">false</bool>
|
<bool name="config_show_top_level_display">false</bool>
|
||||||
|
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user