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

Commit 617650b5 authored by PETER LIANG's avatar PETER LIANG Committed by Android (Google) Code Review
Browse files

Merge "Support the rich content for accessibility service (1/n)"

parents 99e1534b 64f1374c
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  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.
  -->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clipToPadding="false"
    android:importantForAccessibility="noHideDescendants">

    <ImageView
        android:id="@+id/animated_img"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:focusable="false"
        android:clickable="false"
        android:adjustViewBounds="true"/>
</FrameLayout>
 No newline at end of file
+65 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  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.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:background="?android:attr/selectableItemBackground"
    android:clipToPadding="false">

    <FrameLayout
        android:id="@+id/icon_frame"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:minWidth="56dp"
        android:paddingEnd="12dp"
        android:paddingTop="16dp"
        android:paddingBottom="4dp">
        <ImageView
            android:id="@+android:id/icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </FrameLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingBottom="16dp"
        android:paddingTop="16dp">

        <TextView android:id="@+android:id/title"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"/>

        <TextView android:id="@+android:id/summary"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_below="@android:id/title"
                  android:layout_alignStart="@android:id/title"
                  android:textColor="?android:attr/textColorSecondary"/>
    </RelativeLayout>

    <LinearLayout android:id="@+android:id/widget_frame"
                  android:layout_width="wrap_content"
                  android:layout_height="match_parent"
                  android:gravity="center_vertical"
                  android:orientation="vertical" />
</LinearLayout>
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -164,7 +164,10 @@ public class AccessibilityDetailsSettingsFragment extends InstrumentedFragment {
                    new ComponentName(packageName, settingsClassName).flattenToString());
        }
        extras.putParcelable(AccessibilitySettings.EXTRA_COMPONENT_NAME, componentName);
        extras.putInt(AccessibilitySettings.EXTRA_ANIMATED_IMAGE_RES, info.getAnimatedImageRes());

        final String htmlDescription = info.loadHtmlDescription(getActivity().getPackageManager());
        extras.putString(AccessibilitySettings.EXTRA_HTML_DESCRIPTION, htmlDescription);
        return extras;
    }

+6 −0
Original line number Diff line number Diff line
@@ -111,6 +111,8 @@ public class AccessibilitySettings extends DashboardFragment {
    static final String EXTRA_SETTINGS_COMPONENT_NAME = "settings_component_name";
    static final String EXTRA_VIDEO_RAW_RESOURCE_ID = "video_resource";
    static final String EXTRA_LAUNCHED_FROM_SUW = "from_suw";
    static final String EXTRA_ANIMATED_IMAGE_RES = "animated_image_res";
    static final String EXTRA_HTML_DESCRIPTION = "html_description";

    // Timeout before we update the services if packages are added/removed
    // since the AccessibilityManagerService has to do that processing first
@@ -409,6 +411,10 @@ public class AccessibilitySettings extends DashboardFragment {
            extras.putString(EXTRA_TITLE, title);
            extras.putParcelable(EXTRA_RESOLVE_INFO, resolveInfo);
            extras.putString(EXTRA_SUMMARY, description);
            extras.putInt(EXTRA_ANIMATED_IMAGE_RES, info.getAnimatedImageRes());

            final String htmlDescription = info.loadHtmlDescription(getPackageManager());
            extras.putString(AccessibilitySettings.EXTRA_HTML_DESCRIPTION, htmlDescription);

            final String settingsClassName = info.getSettingsActivityName();
            if (!TextUtils.isEmpty(settingsClassName)) {
+3 −0
Original line number Diff line number Diff line
@@ -169,6 +169,9 @@ public class AccessibilitySettingsForSetupWizard extends SettingsPreferenceFragm
            description = getString(R.string.accessibility_service_default_description);
        }
        extras.putString(AccessibilitySettings.EXTRA_SUMMARY, description);

        final String htmlDescription = info.loadHtmlDescription(getPackageManager());
        extras.putString(AccessibilitySettings.EXTRA_HTML_DESCRIPTION, htmlDescription);
    }

    private static void configureMagnificationPreferenceIfNeeded(Preference preference) {
Loading