Loading core/java/android/accessibilityservice/AccessibilityShortcutInfo.java +37 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,16 @@ public final class AccessibilityShortcutInfo { */ private final int mDescriptionResId; /** * Resource id of the animated image of the accessibility shortcut target. */ private final int mAnimatedImageRes; /** * Resource id of the html description of the accessibility shortcut target. */ private final int mHtmlDescriptionRes; /** * Creates a new instance. * Loading Loading @@ -119,6 +129,14 @@ public final class AccessibilityShortcutInfo { // Gets summary mSummaryResId = asAttributes.getResourceId( com.android.internal.R.styleable.AccessibilityShortcutTarget_summary, 0); // Gets animated image mAnimatedImageRes = asAttributes.getResourceId( com.android.internal.R.styleable .AccessibilityShortcutTarget_animatedImageDrawable, 0); // Gets html description mHtmlDescriptionRes = asAttributes.getResourceId( com.android.internal.R.styleable.AccessibilityShortcutTarget_htmlDescription, 0); asAttributes.recycle(); if (mDescriptionResId == 0 || mSummaryResId == 0) { Loading Loading @@ -171,6 +189,25 @@ public final class AccessibilityShortcutInfo { return loadResourceString(packageManager, mActivityInfo, mDescriptionResId); } /** * The animated image resource id of the accessibility shortcut target. * * @return The animated image resource id. */ public int getAnimatedImageRes() { return mAnimatedImageRes; } /** * The localized html description of the accessibility shortcut target. * * @return The localized html description. */ @Nullable public String loadHtmlDescription(@NonNull PackageManager packageManager) { return loadResourceString(packageManager, mActivityInfo, mHtmlDescriptionRes); } /** * Gets string resource by the given activity and resource id. */ Loading core/java/android/content/Intent.java +5 −2 Original line number Diff line number Diff line Loading @@ -4972,11 +4972,14 @@ public class Intent implements Parcelable, Cloneable { * <pre> * <accessibility-shortcut-target * android:description="@string/shortcut_target_description" * android:summary="@string/shortcut_target_summary" /> * android:summary="@string/shortcut_target_summary" * android:animatedImageDrawable="@drawable/shortcut_target_animated_image" * android:htmlDescription="@string/shortcut_target_html_description" /> * </pre> * <p> * Both description and summary are necessary. The system will ignore the accessibility * shortcut target if they are missing. * shortcut target if they are missing. The animated image and html description are supported * to help users understand how to use the shortcut target. * </p> */ @SdkConstant(SdkConstantType.INTENT_CATEGORY) Loading core/res/res/values/attrs.xml +6 −0 Original line number Diff line number Diff line Loading @@ -3790,6 +3790,12 @@ <attr name="description" /> <!-- Brief summary of the target of accessibility shortcut purpose or behavior. --> <attr name="summary" /> <!-- Animated image of the target of accessibility shortcut purpose or behavior, to help users understand how the target of accessibility shortcut can help them.--> <attr name="animatedImageDrawable" format="reference"/> <!-- Html description of the target of accessibility shortcut purpose or behavior, to help users understand how the target of accessibility shortcut can help them. --> <attr name="htmlDescription" format="string"/> </declare-styleable> <!-- Use <code>print-service</code> as the root tag of the XML resource that Loading core/tests/coretests/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -148,4 +148,7 @@ <!-- Summary of the accessibility shortcut [CHAR LIMIT=NONE] --> <string name="accessibility_shortcut_summary">Accessibility shortcut summary</string> <!-- Html description of the accessibility shortcut [CHAR LIMIT=NONE] --> <string name="accessibility_shortcut_html_description">Accessibility shortcut html description</string> </resources> core/tests/coretests/res/xml/accessibility_shortcut_test_activity.xml +2 −0 Original line number Diff line number Diff line Loading @@ -19,4 +19,6 @@ <accessibility-shortcut-target xmlns:android="http://schemas.android.com/apk/res/android" android:description="@string/accessibility_shortcut_description" android:summary="@string/accessibility_shortcut_summary" android:animatedImageDrawable="@drawable/bitmap_drawable" android:htmlDescription="@string/accessibility_shortcut_html_description" /> No newline at end of file Loading
core/java/android/accessibilityservice/AccessibilityShortcutInfo.java +37 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,16 @@ public final class AccessibilityShortcutInfo { */ private final int mDescriptionResId; /** * Resource id of the animated image of the accessibility shortcut target. */ private final int mAnimatedImageRes; /** * Resource id of the html description of the accessibility shortcut target. */ private final int mHtmlDescriptionRes; /** * Creates a new instance. * Loading Loading @@ -119,6 +129,14 @@ public final class AccessibilityShortcutInfo { // Gets summary mSummaryResId = asAttributes.getResourceId( com.android.internal.R.styleable.AccessibilityShortcutTarget_summary, 0); // Gets animated image mAnimatedImageRes = asAttributes.getResourceId( com.android.internal.R.styleable .AccessibilityShortcutTarget_animatedImageDrawable, 0); // Gets html description mHtmlDescriptionRes = asAttributes.getResourceId( com.android.internal.R.styleable.AccessibilityShortcutTarget_htmlDescription, 0); asAttributes.recycle(); if (mDescriptionResId == 0 || mSummaryResId == 0) { Loading Loading @@ -171,6 +189,25 @@ public final class AccessibilityShortcutInfo { return loadResourceString(packageManager, mActivityInfo, mDescriptionResId); } /** * The animated image resource id of the accessibility shortcut target. * * @return The animated image resource id. */ public int getAnimatedImageRes() { return mAnimatedImageRes; } /** * The localized html description of the accessibility shortcut target. * * @return The localized html description. */ @Nullable public String loadHtmlDescription(@NonNull PackageManager packageManager) { return loadResourceString(packageManager, mActivityInfo, mHtmlDescriptionRes); } /** * Gets string resource by the given activity and resource id. */ Loading
core/java/android/content/Intent.java +5 −2 Original line number Diff line number Diff line Loading @@ -4972,11 +4972,14 @@ public class Intent implements Parcelable, Cloneable { * <pre> * <accessibility-shortcut-target * android:description="@string/shortcut_target_description" * android:summary="@string/shortcut_target_summary" /> * android:summary="@string/shortcut_target_summary" * android:animatedImageDrawable="@drawable/shortcut_target_animated_image" * android:htmlDescription="@string/shortcut_target_html_description" /> * </pre> * <p> * Both description and summary are necessary. The system will ignore the accessibility * shortcut target if they are missing. * shortcut target if they are missing. The animated image and html description are supported * to help users understand how to use the shortcut target. * </p> */ @SdkConstant(SdkConstantType.INTENT_CATEGORY) Loading
core/res/res/values/attrs.xml +6 −0 Original line number Diff line number Diff line Loading @@ -3790,6 +3790,12 @@ <attr name="description" /> <!-- Brief summary of the target of accessibility shortcut purpose or behavior. --> <attr name="summary" /> <!-- Animated image of the target of accessibility shortcut purpose or behavior, to help users understand how the target of accessibility shortcut can help them.--> <attr name="animatedImageDrawable" format="reference"/> <!-- Html description of the target of accessibility shortcut purpose or behavior, to help users understand how the target of accessibility shortcut can help them. --> <attr name="htmlDescription" format="string"/> </declare-styleable> <!-- Use <code>print-service</code> as the root tag of the XML resource that Loading
core/tests/coretests/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -148,4 +148,7 @@ <!-- Summary of the accessibility shortcut [CHAR LIMIT=NONE] --> <string name="accessibility_shortcut_summary">Accessibility shortcut summary</string> <!-- Html description of the accessibility shortcut [CHAR LIMIT=NONE] --> <string name="accessibility_shortcut_html_description">Accessibility shortcut html description</string> </resources>
core/tests/coretests/res/xml/accessibility_shortcut_test_activity.xml +2 −0 Original line number Diff line number Diff line Loading @@ -19,4 +19,6 @@ <accessibility-shortcut-target xmlns:android="http://schemas.android.com/apk/res/android" android:description="@string/accessibility_shortcut_description" android:summary="@string/accessibility_shortcut_summary" android:animatedImageDrawable="@drawable/bitmap_drawable" android:htmlDescription="@string/accessibility_shortcut_html_description" /> No newline at end of file