Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 613ad3f8 authored by Ben Chung's avatar Ben Chung Committed by Android (Google) Code Review
Browse files

Merge "Accessibility settings interaction controls category restructure, add...

Merge "Accessibility settings interaction controls category restructure, add system controls fragment for related accessibility services."
parents e63109e4 29ace16b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4952,6 +4952,8 @@
    <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 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] -->
    <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] -->
+10 −24
Original line number Diff line number Diff line
@@ -65,25 +65,6 @@
        android:persistent="false"
        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
            android:fragment="com.android.settings.accessibility.TapAssistanceFragment"
            android:key="tap_assistance_preference_screen"
@@ -92,12 +73,17 @@
            settings:searchable="true"/>

        <Preference
            android:fragment="com.android.settings.gestures.SystemNavigationGestureSettings"
            android:key="gesture_system_navigation_input_summary_accessibility"
            android:fragment="com.android.settings.accessibility.SystemControlsFragment"
            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:title="@string/system_navigation_title"
            settings:searchable="false"
            settings:controller="com.android.settings.gestures.SystemNavigationPreferenceController"/>
            android:title="@string/accessibility_vibration_settings_title"
            settings:controller="com.android.settings.accessibility.VibrationPreferenceController"/>

    </PreferenceCategory>

+42 −0
Original line number Diff line number Diff line
<?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>
 No newline at end of file
+50 −0
Original line number Diff line number Diff line
/*
 * 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);

}
+50 −0
Original line number Diff line number Diff line
/*
 * 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);
    }
}