From 26402ea95a57b000039fa0a2094482dfd4c43194 Mon Sep 17 00:00:00 2001 From: Mark Renouf Date: Fri, 15 Jan 2021 14:43:42 -0500 Subject: [PATCH 1/2] Correctly identify screenshot from a11y service Switches a constant to correctly identify the source Test: self explanatory Bug: 177675113 Change-Id: I562d3e9334333d5d514b7aea801e4116b0c38062 --- .../src/com/android/systemui/accessibility/SystemActions.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java index e6ad1cb9ea882..13da2b06c9768 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java @@ -16,7 +16,7 @@ package com.android.systemui.accessibility; -import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_GLOBAL_ACTIONS; +import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_ACCESSIBILITY_ACTIONS; import static com.android.internal.accessibility.common.ShortcutConstants.CHOOSER_PACKAGE_NAME; @@ -349,7 +349,7 @@ public class SystemActions extends SystemUI { private void handleTakeScreenshot() { ScreenshotHelper screenshotHelper = new ScreenshotHelper(mContext); screenshotHelper.takeScreenshot(WindowManager.TAKE_SCREENSHOT_FULLSCREEN, true, true, - SCREENSHOT_GLOBAL_ACTIONS, new Handler(Looper.getMainLooper()), null); + SCREENSHOT_ACCESSIBILITY_ACTIONS, new Handler(Looper.getMainLooper()), null); } private void handleAccessibilityButton() { From e91f47b1fd685ec6da4d8b57edc7875939cff53c Mon Sep 17 00:00:00 2001 From: Mark Renouf Date: Fri, 15 Jan 2021 16:35:59 -0500 Subject: [PATCH 2/2] Define an @IntDef for the screenshot type constants Test: n/a Change-Id: Ic927170c302f4798750df29f05fcbbb46179def6 --- core/java/android/view/WindowManager.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 7f639fff20e6c..9b737a721c3fe 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -663,23 +663,33 @@ public interface WindowManager extends ViewManager { } /** - * Message for taking fullscreen screenshot + * Invoke screenshot flow to capture a full-screen image. * @hide */ int TAKE_SCREENSHOT_FULLSCREEN = 1; /** - * Message for taking screenshot of selected region. + * Invoke screenshot flow allowing the user to select a region. * @hide */ int TAKE_SCREENSHOT_SELECTED_REGION = 2; /** - * Message for handling a screenshot flow with an image provided by the caller. + * Invoke screenshot flow with an image provided by the caller. * @hide */ int TAKE_SCREENSHOT_PROVIDED_IMAGE = 3; + /** + * Enum listing the types of screenshot requests available. + * + * @hide + */ + @IntDef({TAKE_SCREENSHOT_FULLSCREEN, + TAKE_SCREENSHOT_SELECTED_REGION, + TAKE_SCREENSHOT_PROVIDED_IMAGE}) + @interface ScreenshotType {} + /** * Enum listing the possible sources from which a screenshot was originated. Used for logging. *