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

Commit 301d6216 authored by Sally's avatar Sally Committed by sallyyuen
Browse files

Set a pane title on the some a11y windows' root views

This allows a service to identify a window based on the title.
Configuration changes will restart the activity, losing a11y focus.
A11y focus may be retained by matching windows and unique ids. This
CL allows matching by window/pane title.

Test: manual
Bug: 175182916
Bug: 175184180
Change-Id: Iae4627795c2a35e57b651d9e7ce7527a0ddb1353
parent bbab3240
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import androidx.annotation.IntDef;
@@ -104,6 +105,16 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
        }
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        final View rootView = getActivity().getWindow().peekDecorView();
        if (rootView != null) {
            rootView.setAccessibilityPaneTitle(getString(
                    R.string.accessibility_text_reading_options_title));
        }
    }

    @Override
    protected int getPreferenceScreenResId() {
        return R.xml.accessibility_text_reading_options;
+10 −0
Original line number Diff line number Diff line
@@ -44,6 +44,16 @@ public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePrefere

    private static final String ENABLED = Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED;

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        final View rootView = getActivity().getWindow().peekDecorView();
        if (rootView != null) {
            rootView.setAccessibilityPaneTitle(getString(
                    R.string.accessibility_display_inversion_preference_title));
        }
    }

    @Override
    public int getMetricsCategory() {
        return SettingsEnums.ACCESSIBILITY_COLOR_INVERSION_SETTINGS;
+10 −0
Original line number Diff line number Diff line
@@ -73,6 +73,16 @@ public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePrefe
        return sControllers;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        final View rootView = getActivity().getWindow().peekDecorView();
        if (rootView != null) {
            rootView.setAccessibilityPaneTitle(getString(
                    R.string.accessibility_display_daltonizer_preference_title));
        }
    }

    @Override
    public void onCheckedChanged(Preference preference) {
        for (AbstractPreferenceController controller : sControllers) {