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

Commit 9ece5edf authored by Joy Yoonhyung Lee's avatar Joy Yoonhyung Lee Committed by Android (Google) Code Review
Browse files

Merge "Add BUGREPORT_FLAG_CAPTURE_MULTI_DISPLAY_SCREENSHOT to BugreportParams" into main

parents d3ec03ee e986b12f
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -145,7 +145,8 @@ public final class BugreportParams {
    @IntDef(flag = true, prefix = { "BUGREPORT_FLAG_" }, value = {
            BUGREPORT_FLAG_USE_PREDUMPED_UI_DATA,
            BUGREPORT_FLAG_DEFER_CONSENT,
            BUGREPORT_FLAG_KEEP_BUGREPORT_ON_RETRIEVAL
            BUGREPORT_FLAG_KEEP_BUGREPORT_ON_RETRIEVAL,
            BUGREPORT_FLAG_CAPTURE_MULTI_DISPLAY_SCREENSHOT
    })
    public @interface BugreportFlag {}

@@ -178,4 +179,13 @@ public final class BugreportParams {
    @FlaggedApi(Flags.FLAG_ONBOARDING_BUGREPORT_V2_ENABLED)
    public static final int BUGREPORT_FLAG_KEEP_BUGREPORT_ON_RETRIEVAL =
            IDumpstate.BUGREPORT_FLAG_KEEP_BUGREPORT_ON_RETRIEVAL;

    /**
     * Flag for taking screenshots of all displays.
     * @hide
     */
    @FlaggedApi(android.os.Flags.FLAG_BUGREPORT_MULTI_DISPLAY_SCREENSHOT_ENABLED)
    public static final int BUGREPORT_FLAG_CAPTURE_MULTI_DISPLAY_SCREENSHOT =
            IDumpstate.BUGREPORT_FLAG_CAPTURE_MULTI_DISPLAY_SCREENSHOT;

}
+2 −1
Original line number Diff line number Diff line
@@ -666,7 +666,8 @@ class BugreportManagerServiceImpl extends IDumpstate.Stub {
        flags = clearBugreportFlag(flags,
                BugreportParams.BUGREPORT_FLAG_USE_PREDUMPED_UI_DATA
                        | BugreportParams.BUGREPORT_FLAG_DEFER_CONSENT
                        | BugreportParams.BUGREPORT_FLAG_KEEP_BUGREPORT_ON_RETRIEVAL);
                        | BugreportParams.BUGREPORT_FLAG_KEEP_BUGREPORT_ON_RETRIEVAL
                        | BugreportParams.BUGREPORT_FLAG_CAPTURE_MULTI_DISPLAY_SCREENSHOT);
        if (flags != 0) {
            Slog.w(TAG, "Unknown bugreport flags: " + flags);
            throw new IllegalArgumentException("Unknown bugreport flags: " + flags);
+14 −0
Original line number Diff line number Diff line
@@ -241,6 +241,20 @@ public class BugreportManagerServiceImplTest {
        assertThat(thrown.getMessage()).contains("not affiliated to the device owner");
    }

    @Test
    @RequiresFlagsEnabled(android.os.Flags.FLAG_BUGREPORT_MULTI_DISPLAY_SCREENSHOT_ENABLED)
    public void testStartBugreportWithMultiDisplayScreenshotFlag() {
        mService.startBugreport(mCallingUid, mContext.getPackageName(),
                new FileDescriptor(), new FileDescriptor(),
                BugreportParams.BUGREPORT_MODE_FULL,
                BugreportParams.BUGREPORT_FLAG_CAPTURE_MULTI_DISPLAY_SCREENSHOT,
                new Listener(new CountDownLatch(1)),
                /* isScreenshotRequested= */ true,
                /* skipUserConsentUnused = */ false);

        assertThat(mInjector.isBugreportStarted()).isTrue();
    }

    @Test
    public void testRetrieveBugreportWithoutFilesForCaller() throws Exception {
        CountDownLatch latch = new CountDownLatch(1);