Merge "Accessibility settings interaction controls category restructure, add system controls fragment for related accessibility services."

This commit is contained in:
Ben Chung
2021-01-13 11:19:57 +00:00
committed by Android (Google) Code Review
5 changed files with 154 additions and 24 deletions

View File

@@ -4952,6 +4952,8 @@
<string name="interaction_control_category_title">Interaction controls</string> <string name="interaction_control_category_title">Interaction controls</string>
<!-- Title for the accessibility tap assistance page. [CHAR LIMIT=50] --> <!-- Title for the accessibility tap assistance page. [CHAR LIMIT=50] -->
<string name="accessibility_tap_assistance_title">Tap assistance</string> <string name="accessibility_tap_assistance_title">Tap assistance</string>
<!-- Title for the accessibility system controls page. [CHAR LIMIT=50] -->
<string name="accessibility_system_controls_title">System controls</string>
<!-- Title for the accessibility preference category of services downloaded by the user. [CHAR LIMIT=50] --> <!-- Title for the accessibility preference category of services downloaded by the user. [CHAR LIMIT=50] -->
<string name="user_installed_services_category_title">Downloaded apps</string> <string name="user_installed_services_category_title">Downloaded apps</string>
<!-- Title for the accessibility preference category of settings considered to be experimental, meaning they might be changed or removed in the future. [CHAR LIMIT=50] --> <!-- Title for the accessibility preference category of settings considered to be experimental, meaning they might be changed or removed in the future. [CHAR LIMIT=50] -->

View File

@@ -65,25 +65,6 @@
android:persistent="false" android:persistent="false"
android:title="@string/interaction_control_category_title"> android:title="@string/interaction_control_category_title">
<SwitchPreference
android:key="toggle_power_button_ends_call_preference"
android:persistent="false"
android:title="@string/accessibility_power_button_ends_call_prerefence_title"
settings:controller="com.android.settings.accessibility.PowerButtonEndsCallPreferenceController"/>
<SwitchPreference
android:key="toggle_lock_screen_rotation_preference"
android:persistent="false"
android:title="@string/accelerometer_title"
settings:controller="com.android.settings.accessibility.LockScreenRotationPreferenceController"/>
<Preference
android:fragment="com.android.settings.accessibility.VibrationSettings"
android:key="vibration_preference_screen"
android:persistent="false"
android:title="@string/accessibility_vibration_settings_title"
settings:controller="com.android.settings.accessibility.VibrationPreferenceController"/>
<Preference <Preference
android:fragment="com.android.settings.accessibility.TapAssistanceFragment" android:fragment="com.android.settings.accessibility.TapAssistanceFragment"
android:key="tap_assistance_preference_screen" android:key="tap_assistance_preference_screen"
@@ -92,12 +73,17 @@
settings:searchable="true"/> settings:searchable="true"/>
<Preference <Preference
android:fragment="com.android.settings.gestures.SystemNavigationGestureSettings" android:fragment="com.android.settings.accessibility.SystemControlsFragment"
android:key="gesture_system_navigation_input_summary_accessibility" android:key="system_controls_preference_screen"
android:title="@string/accessibility_system_controls_title"
settings:searchable="true"/>
<Preference
android:fragment="com.android.settings.accessibility.VibrationSettings"
android:key="vibration_preference_screen"
android:persistent="false" android:persistent="false"
android:title="@string/system_navigation_title" android:title="@string/accessibility_vibration_settings_title"
settings:searchable="false" settings:controller="com.android.settings.accessibility.VibrationPreferenceController"/>
settings:controller="com.android.settings.gestures.SystemNavigationPreferenceController"/>
</PreferenceCategory> </PreferenceCategory>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 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.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="accessibility_system_controls"
android:persistent="false"
android:title="@string/accessibility_system_controls_title">
<Preference
android:fragment="com.android.settings.gestures.SystemNavigationGestureSettings"
android:key="gesture_system_navigation_input_summary_accessibility"
android:persistent="false"
android:title="@string/system_navigation_title"
settings:searchable="false"
settings:controller="com.android.settings.gestures.SystemNavigationPreferenceController"/>
<SwitchPreference
android:key="toggle_power_button_ends_call_preference"
android:persistent="false"
android:title="@string/accessibility_power_button_ends_call_prerefence_title"
settings:controller="com.android.settings.accessibility.PowerButtonEndsCallPreferenceController"/>
<SwitchPreference
android:key="toggle_lock_screen_rotation_preference"
android:persistent="false"
android:title="@string/accelerometer_title"
settings:controller="com.android.settings.accessibility.LockScreenRotationPreferenceController"/>
</PreferenceScreen>

View File

@@ -0,0 +1,50 @@
/*
* Copyright (C) 2021 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.app.settings.SettingsEnums;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable;
/** Accessibility settings for system controls. */
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class SystemControlsFragment extends DashboardFragment {
private static final String TAG = "SystemControlsFragment";
@Override
public int getMetricsCategory() {
return SettingsEnums.ACCESSIBILITY_SYSTEM_CONTROLS;
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.accessibility_system_controls;
}
@Override
protected String getLogTag() {
return TAG;
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.accessibility_system_controls);
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (C) 2021 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.google.common.truth.Truth.assertThat;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import com.android.settings.R;
import com.android.settings.testutils.XmlTestUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import java.util.List;
/** Tests for {@link SystemControlsFragment}. */
@RunWith(RobolectricTestRunner.class)
public class SystemControlsFragmentTest {
private Context mContext = ApplicationProvider.getApplicationContext();
@Test
public void getNonIndexableKeys_existInXmlLayout() {
final List<String> niks = SystemControlsFragment.SEARCH_INDEX_DATA_PROVIDER
.getNonIndexableKeys(mContext);
final List<String> keys =
XmlTestUtils.getKeysFromPreferenceXml(mContext,
R.xml.accessibility_system_controls);
assertThat(keys).containsAtLeastElementsIn(niks);
}
}