diff options
| author | 2020-10-06 14:58:46 -0400 | |
|---|---|---|
| committer | 2020-10-07 09:34:35 -0400 | |
| commit | ab5bdc3a679d40f4b0735884766f6d8fa403a4ba (patch) | |
| tree | c5c85db1b2739cea2a75c51626ec1e6a98914694 | |
| parent | e2b1b3b94d75eb0b8960dec4dba7f87b44af9db7 (diff) | |
Add accessibility event when saving screenshot
Send an accessibility event with "Saving screenshot" as the
screenshot is saved, so that it can be read out through e.g.
TalkBack.
Bug: 149832748
Test: manual; turned on talkback and ensured that the text was
read out when saving the screenshot from keychord/overview.
Change-Id: Ibe237a81cec0961065bf741eb5f3bb9dc9d14712
| -rw-r--r-- | packages/SystemUI/res/values/strings.xml | 2 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 2427d36076c5..9c22e7edb743 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -218,7 +218,7 @@ <!-- Notification ticker displayed when a screenshot is being saved to the Gallery. [CHAR LIMIT=30] --> <string name="screenshot_saving_ticker">Saving screenshot\u2026</string> - <!-- Notification title displayed when a screenshot is being saved to the Gallery. [CHAR LIMIT=50] --> + <!-- Informs the user that a screenshot is being saved. [CHAR LIMIT=50] --> <string name="screenshot_saving_title">Saving screenshot\u2026</string> <!-- Notification title displayed when a screenshot is saved to the Gallery. [CHAR LIMIT=50] --> <string name="screenshot_saved_title">Screenshot saved</string> diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 2b4fa2a23a07..0413c304ca72 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -69,6 +69,7 @@ import android.view.ViewOutlineProvider; import android.view.ViewTreeObserver; import android.view.WindowInsets; import android.view.WindowManager; +import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.animation.AccelerateInterpolator; import android.view.animation.AnimationUtils; @@ -184,6 +185,7 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset private final WindowManager.LayoutParams mWindowLayoutParams; private final Display mDisplay; private final DisplayMetrics mDisplayMetrics; + private final AccessibilityManager mAccessibilityManager; private View mScreenshotLayout; private ScreenshotSelectorView mScreenshotSelectorView; @@ -242,6 +244,7 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset mScreenshotSmartActions = screenshotSmartActions; mNotificationsController = screenshotNotificationsController; mUiEventLogger = uiEventLogger; + mAccessibilityManager = AccessibilityManager.getInstance(mContext); reloadAssets(); Configuration config = mContext.getResources().getConfiguration(); @@ -573,6 +576,14 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset private void saveScreenshot(Bitmap screenshot, Consumer<Uri> finisher, Rect screenRect, Insets screenInsets, boolean showFlash) { + if (mAccessibilityManager.isEnabled()) { + AccessibilityEvent event = + new AccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); + event.setContentDescription( + mContext.getResources().getString(R.string.screenshot_saving_title)); + mAccessibilityManager.sendAccessibilityEvent(event); + } + if (mScreenshotLayout.isAttachedToWindow()) { // if we didn't already dismiss for another reason if (mDismissAnimation == null || !mDismissAnimation.isRunning()) { |