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

This commit is contained in:
Ben Chung
2021-01-12 04:53:55 +00:00
committed by Android (Google) Code Review
5 changed files with 152 additions and 22 deletions

View File

@@ -4950,6 +4950,8 @@
<string name="accessibility_text_and_display_title">Text and display</string>
<!-- Title for the accessibility preference category of interaction control services and settings. [CHAR LIMIT=50] -->
<string name="interaction_control_category_title">Interaction controls</string>
<!-- Title for the accessibility tap assistance page. [CHAR LIMIT=50] -->
<string name="accessibility_tap_assistance_title">Tap assistance</string>
<!-- 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>
<!-- 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,13 +65,6 @@
android:persistent="false"
android:title="@string/interaction_control_category_title">
<Preference
android:fragment="com.android.settings.accessibility.ToggleAutoclickPreferenceFragment"
android:key="autoclick_preference"
android:persistent="false"
android:title="@string/accessibility_autoclick_preference_title"
settings:controller="com.android.settings.accessibility.AutoclickPreferenceController"/>
<SwitchPreference
android:key="toggle_power_button_ends_call_preference"
android:persistent="false"
@@ -84,21 +77,6 @@
android:title="@string/accelerometer_title"
settings:controller="com.android.settings.accessibility.LockScreenRotationPreferenceController"/>
<ListPreference
android:entries="@array/long_press_timeout_selector_list_titles"
android:entryValues="@array/long_press_timeout_selector_values"
android:key="select_long_press_timeout_preference"
android:persistent="false"
android:title="@string/accessibility_long_press_timeout_preference_title"
settings:controller="com.android.settings.accessibility.SelectLongPressTimeoutPreferenceController"/>
<Preference
android:fragment="com.android.settings.accessibility.AccessibilityControlTimeoutPreferenceFragment"
android:key="accessibility_control_timeout_preference_fragment"
android:persistent="false"
android:title="@string/accessibility_setting_item_control_timeout_title"
settings:controller="com.android.settings.accessibility.AccessibilityTimeoutPreferenceController"/>
<Preference
android:fragment="com.android.settings.accessibility.VibrationSettings"
android:key="vibration_preference_screen"
@@ -106,6 +84,13 @@
android:title="@string/accessibility_vibration_settings_title"
settings:controller="com.android.settings.accessibility.VibrationPreferenceController"/>
<Preference
android:fragment="com.android.settings.accessibility.TapAssistanceFragment"
android:key="tap_assistance_preference_screen"
android:persistent="false"
android:title="@string/accessibility_tap_assistance_title"
settings:searchable="true"/>
<Preference
android:fragment="com.android.settings.gestures.SystemNavigationGestureSettings"
android:key="gesture_system_navigation_input_summary_accessibility"

View File

@@ -0,0 +1,44 @@
<?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_tap_assistance"
android:persistent="false"
android:title="@string/accessibility_tap_assistance_title">
<ListPreference
android:entries="@array/long_press_timeout_selector_list_titles"
android:entryValues="@array/long_press_timeout_selector_values"
android:key="select_long_press_timeout_preference"
android:persistent="false"
android:title="@string/accessibility_long_press_timeout_preference_title"
settings:controller="com.android.settings.accessibility.SelectLongPressTimeoutPreferenceController"/>
<Preference
android:fragment="com.android.settings.accessibility.AccessibilityControlTimeoutPreferenceFragment"
android:key="accessibility_control_timeout_preference_fragment"
android:persistent="false"
android:title="@string/accessibility_setting_item_control_timeout_title"
settings:controller="com.android.settings.accessibility.AccessibilityTimeoutPreferenceController"/>
<Preference
android:fragment="com.android.settings.accessibility.ToggleAutoclickPreferenceFragment"
android:key="autoclick_preference"
android:persistent="false"
android:title="@string/accessibility_autoclick_preference_title"
settings:controller="com.android.settings.accessibility.AutoclickPreferenceController"/>
</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 tap assistance. */
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class TapAssistanceFragment extends DashboardFragment {
private static final String TAG = "TapAssistanceFragment";
@Override
public int getMetricsCategory() {
return SettingsEnums.ACCESSIBILITY_TAP_ASSISTANCE;
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.accessibility_tap_assistance;
}
@Override
protected String getLogTag() {
return TAG;
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.accessibility_tap_assistance);
}

View File

@@ -0,0 +1,49 @@
/*
* 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;
@RunWith(RobolectricTestRunner.class)
/** Tests for {@link TapAssistanceFragment}. */
public class TapAssistanceFragmentTest {
private Context mContext = ApplicationProvider.getApplicationContext();
@Test
public void getNonIndexableKeys_existInXmlLayout() {
final List<String> niks = TapAssistanceFragment.SEARCH_INDEX_DATA_PROVIDER
.getNonIndexableKeys(mContext);
final List<String> keys =
XmlTestUtils.getKeysFromPreferenceXml(mContext, R.xml.accessibility_tap_assistance);
assertThat(keys).containsAtLeastElementsIn(niks);
}
}