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

Commit 24b3dcb4 authored by Chavi Weingarten's avatar Chavi Weingarten
Browse files

Make UiAutomation#takeScreenshot(Window) public

This API is useful when trying to take a screenshot of a window instead
of the entire display. It allows the screenshot to ignore anything else
on screen, except the specified window.

Test: ASurfaceControlTestActivity
Fixes: 237681925
Change-Id: Idc08af39645f572ead4fc191d7f26970813241e2
parent cded2761
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -7050,6 +7050,7 @@ package android.app {
    method public void setRunAsMonkey(boolean);
    method public void setRunAsMonkey(boolean);
    method public void setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo);
    method public void setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo);
    method public android.graphics.Bitmap takeScreenshot();
    method public android.graphics.Bitmap takeScreenshot();
    method @Nullable public android.graphics.Bitmap takeScreenshot(@NonNull android.view.Window);
    method public void waitForIdle(long, long) throws java.util.concurrent.TimeoutException;
    method public void waitForIdle(long, long) throws java.util.concurrent.TimeoutException;
    field public static final int FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES = 1; // 0x1
    field public static final int FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES = 1; // 0x1
    field public static final int FLAG_DONT_USE_ACCESSIBILITY = 2; // 0x2
    field public static final int FLAG_DONT_USE_ACCESSIBILITY = 2; // 0x2
+0 −1
Original line number Original line Diff line number Diff line
@@ -438,7 +438,6 @@ package android.app {
    method @Deprecated public boolean revokeRuntimePermission(String, String, android.os.UserHandle);
    method @Deprecated public boolean revokeRuntimePermission(String, String, android.os.UserHandle);
    method public void syncInputTransactions();
    method public void syncInputTransactions();
    method public void syncInputTransactions(boolean);
    method public void syncInputTransactions(boolean);
    method @Nullable public android.graphics.Bitmap takeScreenshot(@NonNull android.view.Window);
    field @NonNull public static final java.util.Set<java.lang.String> ALL_PERMISSIONS;
    field @NonNull public static final java.util.Set<java.lang.String> ALL_PERMISSIONS;
  }
  }


+0 −3
Original line number Original line Diff line number Diff line
@@ -1068,10 +1068,7 @@ public final class UiAutomation {
     * @param window Window to take a screenshot of
     * @param window Window to take a screenshot of
     *
     *
     * @return The screenshot bitmap on success, null otherwise.
     * @return The screenshot bitmap on success, null otherwise.
     *
     * @hide
     */
     */
    @TestApi
    @Nullable
    @Nullable
    public Bitmap takeScreenshot(@NonNull Window window) {
    public Bitmap takeScreenshot(@NonNull Window window) {
        if (window == null) {
        if (window == null) {