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

Commit 24fb844a authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 13299163 from 177d7338 to 25Q3-release

Change-Id: Ib257361b5cdad4bb3dbd169c7238bc347ac249ec
parents 7db4a5e6 177d7338
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -77,7 +77,9 @@ public class UsbCommand extends Svc.Command {
                + "         'V1_2', 'V1_3'\n"
                + "       svc usb resetUsbPort [port number]\n"
                + "         Reset the specified connected usb port\n"
                + "         default: the first connected usb port\n";
                + "         default: the first connected usb port\n"
                + "       svc usb enableUsbDataSignal [enable]\n"
                + "         Toggle USB data signaling, possible values are `true` and `false`\n";
    }

    @Override
@@ -213,6 +215,9 @@ public class UsbCommand extends Svc.Command {
                    System.err.println("Error communicating with UsbManager: " + e);
                }
                return;
            } else if ("enableUsbDataSignal".equals(args[1])) {
                usbManager.enableUsbDataSignal(Boolean.parseBoolean(args[2]));
                return;
            }
        }
        System.err.println(longHelp());
+1 −0
Original line number Diff line number Diff line
@@ -485,6 +485,7 @@ package android.app {
    method @Deprecated public boolean revokeRuntimePermission(String, String, android.os.UserHandle);
    method public void syncInputTransactions();
    method public void syncInputTransactions(boolean);
    method @NonNull public android.graphics.Bitmap takeScreenshot(int) throws java.io.IOException;
    field @NonNull public static final java.util.Set<java.lang.String> ALL_PERMISSIONS;
    field public static final int FLAG_NOT_ACCESSIBILITY_TOOL = 4; // 0x4
  }
+58 −0
Original line number Diff line number Diff line
@@ -1315,6 +1315,64 @@ public final class UiAutomation {
        return swBitmap;
    }

    /**
     * Takes a screenshot from the specified display.
     *
     * @param displayId The ID of the display to capture.
     * @return A {@link android.graphics.Bitmap} representing the screenshot of the specified
     *         display.
     * @throws IllegalArgumentException If the provided {@code displayId} does not correspond to
     * a valid display.
     * @throws IOException If an error occurs while creating the screenshot or processing the
     * captured screenshot into a bitmap.
     * @hide
     */
    @TestApi
    @NonNull
    @SuppressLint("UnflaggedApi") // TestApi
    public Bitmap takeScreenshot(int displayId) throws IOException {
        if (DEBUG) {
            Log.d(LOG_TAG, "Taking screenshot of display " + displayId);
        }
        Display display = DisplayManagerGlobal.getInstance().getRealDisplay(displayId);
        if (display == null) {
            throw new IllegalArgumentException("Error finding the display " + displayId);
        }
        Point displaySize = new Point();
        display.getRealSize(displaySize);

        // Take the screenshot
        ScreenCapture.SynchronousScreenCaptureListener syncScreenCapture =
                ScreenCapture.createSyncCaptureListener();
        try {
            if (!mUiAutomationConnection.takeScreenshot(
                    new Rect(0, 0, displaySize.x, displaySize.y), syncScreenCapture, displayId)) {
                throw new IOException("Fail to capture screenshot for display=" + displayId
                        + " due to remote error.");
            }
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }

        final ScreenshotHardwareBuffer screenshotBuffer = syncScreenCapture.getBuffer();
        if (screenshotBuffer == null) {
            throw new IOException("Empty screenshot buffer for display=" + displayId);
        }
        Bitmap screenShot = screenshotBuffer.asBitmap();
        if (screenShot == null) {
            throw new IOException("Fail to create screenshot bitmap for display=" + displayId);
        }
        Bitmap swBitmap;
        try (HardwareBuffer buffer = screenshotBuffer.getHardwareBuffer()) {
            swBitmap = screenShot.copy(Bitmap.Config.ARGB_8888, false);
        }
        screenShot.recycle();

        // Optimization
        swBitmap.setHasAlpha(false);
        return swBitmap;
    }

    /**
     * Used to capture a screenshot of a Window. This can return null in the following cases:
     * 1. Window content hasn't been layed out.
+10 −0
Original line number Diff line number Diff line
@@ -70,6 +70,16 @@ flag {
  bug: "325073410"
}

flag {
  name: "dpe_based_on_async_apis_enabled"
  namespace: "supervision"
  description: "Whether DPE's synchronous APIs use async APIs."
  bug: "374123015"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "coexistence_migration_for_supervision_enabled"
  is_exported: true
+10 −0
Original line number Diff line number Diff line
@@ -1195,6 +1195,16 @@ public final class Configuration implements Parcelable, Comparable<Configuration
            default: sb.append(" layoutLong=");
                    sb.append(screenLayout&SCREENLAYOUT_LONG_MASK); break;
        }
        switch ((screenLayout & SCREENLAYOUT_ROUND_MASK)) {
            case SCREENLAYOUT_ROUND_UNDEFINED: sb.append(" ?round"); break;
            case SCREENLAYOUT_ROUND_NO:  /* not-round is not interesting to print */ break;
            case SCREENLAYOUT_ROUND_YES: sb.append(" round"); break;
            default: sb.append(" layoutRound=");
                sb.append(screenLayout & SCREENLAYOUT_ROUND_MASK); break;
        }
        if ((screenLayout & SCREENLAYOUT_COMPAT_NEEDED) != 0) {
            sb.append(" compactNeeded");
        }
        switch ((colorMode &COLOR_MODE_HDR_MASK)) {
            case COLOR_MODE_HDR_UNDEFINED: sb.append(" ?ldr"); break; // most likely not HDR
            case COLOR_MODE_HDR_NO: /* ldr is not interesting to print */ break;
Loading