Loading packages/SystemUI/src/com/android/systemui/screenshot/LegacyScreenshotController.java +9 −9 Original line number Diff line number Diff line Loading @@ -255,11 +255,11 @@ public class LegacyScreenshotController implements InteractiveScreenshotHandler Assert.isMainThread(); mCurrentRequestCallback = requestCallback; Rect bounds = screenshot.getOriginalScreenBounds(); if (screenshot.getType() == WindowManager.TAKE_SCREENSHOT_FULLSCREEN && screenshot.getBitmap() == null) { Rect bounds = getFullScreenRect(); bounds = getFullScreenRect(); screenshot.setBitmap(mImageCapture.captureDisplay(mDisplay.getDisplayId(), bounds)); screenshot.setScreenBounds(bounds); } if (screenshot.getBitmap() == null) { Loading Loading @@ -325,22 +325,22 @@ public class LegacyScreenshotController implements InteractiveScreenshotHandler boolean showFlash; if (screenshot.getType() == WindowManager.TAKE_SCREENSHOT_PROVIDED_IMAGE) { if (screenshot.getScreenBounds() != null && aspectRatiosMatch(screenshot.getBitmap(), screenshot.getInsets(), screenshot.getScreenBounds())) { if (bounds != null && aspectRatiosMatch(screenshot.getBitmap(), screenshot.getOriginalInsets(), bounds)) { showFlash = false; } else { showFlash = true; screenshot.setInsets(Insets.NONE); screenshot.setScreenBounds(new Rect(0, 0, screenshot.getBitmap().getWidth(), screenshot.getBitmap().getHeight())); bounds = new Rect(0, 0, screenshot.getBitmap().getWidth(), screenshot.getBitmap().getHeight()); } } else { showFlash = true; } final Rect animationBounds = bounds; mViewProxy.prepareEntranceAnimation( () -> startAnimation(screenshot.getScreenBounds(), showFlash, () -> startAnimation(animationBounds, showFlash, () -> mMessageContainerController.onScreenshotTaken(screenshot))); mViewProxy.setScreenshot(screenshot); Loading packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.kt +11 −8 Original line number Diff line number Diff line Loading @@ -175,7 +175,6 @@ internal constructor( if (screenshot.type == TAKE_SCREENSHOT_FULLSCREEN && screenshot.bitmap == null) { val bounds = fullScreenRect screenshot.bitmap = imageCapture.captureDisplay(display.displayId, bounds) screenshot.screenBounds = bounds } val currentBitmap = screenshot.bitmap Loading Loading @@ -238,23 +237,27 @@ internal constructor( window.attachWindow() var bounds = screenshot.originalScreenBounds ?: Rect(0, 0, currentBitmap.width, currentBitmap.height) val showFlash: Boolean if (screenshot.type == TAKE_SCREENSHOT_PROVIDED_IMAGE) { if (aspectRatiosMatch(currentBitmap, screenshot.insets, screenshot.screenBounds)) { if ( aspectRatiosMatch( currentBitmap, screenshot.originalInsets, screenshot.originalScreenBounds, ) ) { showFlash = false } else { showFlash = true screenshot.insets = Insets.NONE screenshot.screenBounds = Rect(0, 0, currentBitmap.width, currentBitmap.height) bounds = Rect(0, 0, currentBitmap.width, currentBitmap.height) } } else { showFlash = true } // screenshot.screenBounds is expected to be non-null in all cases at this point val bounds = screenshot.screenBounds ?: Rect(0, 0, currentBitmap.width, currentBitmap.height) viewProxy.prepareEntranceAnimation { startAnimation(bounds, showFlash) { messageContainerController.onScreenshotTaken(screenshot) Loading packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotData.kt +6 −6 Original line number Diff line number Diff line Loading @@ -21,9 +21,9 @@ data class ScreenshotData( val userHandle: UserHandle, /** ComponentName of the top-most app in the screenshot. */ val topComponent: ComponentName?, var screenBounds: Rect?, val taskId: Int, var insets: Insets, val originalScreenBounds: Rect?, val originalInsets: Insets, var bitmap: Bitmap?, val displayId: Int, ) { Loading @@ -42,9 +42,9 @@ data class ScreenshotData( source = request.source, userHandle = UserHandle.of(request.userId), topComponent = request.topComponent, screenBounds = request.boundsInScreen, originalScreenBounds = request.boundsInScreen, taskId = request.taskId, insets = request.insets, originalInsets = request.insets, bitmap = request.bitmap, displayId = displayId, ) Loading @@ -61,9 +61,9 @@ data class ScreenshotData( source = source, userHandle = userHandle, topComponent = topComponent, screenBounds = null, originalScreenBounds = null, taskId = 0, insets = Insets.NONE, originalInsets = Insets.NONE, bitmap = bitmap, displayId = Display.DEFAULT_DISPLAY, ) Loading packages/SystemUI/src/com/android/systemui/screenshot/policy/PolicyRequestProcessor.kt +2 −2 Original line number Diff line number Diff line Loading @@ -141,7 +141,7 @@ class PolicyRequestProcessor( userHandle = owner, taskId = taskId, topComponent = componentName, screenBounds = taskBounds, originalScreenBounds = taskBounds, ) } Loading @@ -159,7 +159,7 @@ class PolicyRequestProcessor( bitmap = screenshot, userHandle = owner, topComponent = componentName, screenBounds = Rect(0, 0, screenshot?.width ?: 0, screenshot?.height ?: 0), originalScreenBounds = Rect(0, 0, screenshot?.width ?: 0, screenshot?.height ?: 0), taskId = taskId ?: -1, ) } Loading packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotDataTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -53,8 +53,8 @@ class ScreenshotDataTest { assertThat(data.source).isEqualTo(source) assertThat(data.type).isEqualTo(type) assertThat(data.screenBounds).isEqualTo(bounds) assertThat(data.insets).isEqualTo(insets) assertThat(data.originalScreenBounds).isEqualTo(bounds) assertThat(data.originalInsets).isEqualTo(insets) assertThat(data.taskId).isEqualTo(taskId) assertThat(data.userHandle).isEqualTo(UserHandle.of(userId)) assertThat(data.topComponent).isEqualTo(component) Loading Loading
packages/SystemUI/src/com/android/systemui/screenshot/LegacyScreenshotController.java +9 −9 Original line number Diff line number Diff line Loading @@ -255,11 +255,11 @@ public class LegacyScreenshotController implements InteractiveScreenshotHandler Assert.isMainThread(); mCurrentRequestCallback = requestCallback; Rect bounds = screenshot.getOriginalScreenBounds(); if (screenshot.getType() == WindowManager.TAKE_SCREENSHOT_FULLSCREEN && screenshot.getBitmap() == null) { Rect bounds = getFullScreenRect(); bounds = getFullScreenRect(); screenshot.setBitmap(mImageCapture.captureDisplay(mDisplay.getDisplayId(), bounds)); screenshot.setScreenBounds(bounds); } if (screenshot.getBitmap() == null) { Loading Loading @@ -325,22 +325,22 @@ public class LegacyScreenshotController implements InteractiveScreenshotHandler boolean showFlash; if (screenshot.getType() == WindowManager.TAKE_SCREENSHOT_PROVIDED_IMAGE) { if (screenshot.getScreenBounds() != null && aspectRatiosMatch(screenshot.getBitmap(), screenshot.getInsets(), screenshot.getScreenBounds())) { if (bounds != null && aspectRatiosMatch(screenshot.getBitmap(), screenshot.getOriginalInsets(), bounds)) { showFlash = false; } else { showFlash = true; screenshot.setInsets(Insets.NONE); screenshot.setScreenBounds(new Rect(0, 0, screenshot.getBitmap().getWidth(), screenshot.getBitmap().getHeight())); bounds = new Rect(0, 0, screenshot.getBitmap().getWidth(), screenshot.getBitmap().getHeight()); } } else { showFlash = true; } final Rect animationBounds = bounds; mViewProxy.prepareEntranceAnimation( () -> startAnimation(screenshot.getScreenBounds(), showFlash, () -> startAnimation(animationBounds, showFlash, () -> mMessageContainerController.onScreenshotTaken(screenshot))); mViewProxy.setScreenshot(screenshot); Loading
packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotController.kt +11 −8 Original line number Diff line number Diff line Loading @@ -175,7 +175,6 @@ internal constructor( if (screenshot.type == TAKE_SCREENSHOT_FULLSCREEN && screenshot.bitmap == null) { val bounds = fullScreenRect screenshot.bitmap = imageCapture.captureDisplay(display.displayId, bounds) screenshot.screenBounds = bounds } val currentBitmap = screenshot.bitmap Loading Loading @@ -238,23 +237,27 @@ internal constructor( window.attachWindow() var bounds = screenshot.originalScreenBounds ?: Rect(0, 0, currentBitmap.width, currentBitmap.height) val showFlash: Boolean if (screenshot.type == TAKE_SCREENSHOT_PROVIDED_IMAGE) { if (aspectRatiosMatch(currentBitmap, screenshot.insets, screenshot.screenBounds)) { if ( aspectRatiosMatch( currentBitmap, screenshot.originalInsets, screenshot.originalScreenBounds, ) ) { showFlash = false } else { showFlash = true screenshot.insets = Insets.NONE screenshot.screenBounds = Rect(0, 0, currentBitmap.width, currentBitmap.height) bounds = Rect(0, 0, currentBitmap.width, currentBitmap.height) } } else { showFlash = true } // screenshot.screenBounds is expected to be non-null in all cases at this point val bounds = screenshot.screenBounds ?: Rect(0, 0, currentBitmap.width, currentBitmap.height) viewProxy.prepareEntranceAnimation { startAnimation(bounds, showFlash) { messageContainerController.onScreenshotTaken(screenshot) Loading
packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotData.kt +6 −6 Original line number Diff line number Diff line Loading @@ -21,9 +21,9 @@ data class ScreenshotData( val userHandle: UserHandle, /** ComponentName of the top-most app in the screenshot. */ val topComponent: ComponentName?, var screenBounds: Rect?, val taskId: Int, var insets: Insets, val originalScreenBounds: Rect?, val originalInsets: Insets, var bitmap: Bitmap?, val displayId: Int, ) { Loading @@ -42,9 +42,9 @@ data class ScreenshotData( source = request.source, userHandle = UserHandle.of(request.userId), topComponent = request.topComponent, screenBounds = request.boundsInScreen, originalScreenBounds = request.boundsInScreen, taskId = request.taskId, insets = request.insets, originalInsets = request.insets, bitmap = request.bitmap, displayId = displayId, ) Loading @@ -61,9 +61,9 @@ data class ScreenshotData( source = source, userHandle = userHandle, topComponent = topComponent, screenBounds = null, originalScreenBounds = null, taskId = 0, insets = Insets.NONE, originalInsets = Insets.NONE, bitmap = bitmap, displayId = Display.DEFAULT_DISPLAY, ) Loading
packages/SystemUI/src/com/android/systemui/screenshot/policy/PolicyRequestProcessor.kt +2 −2 Original line number Diff line number Diff line Loading @@ -141,7 +141,7 @@ class PolicyRequestProcessor( userHandle = owner, taskId = taskId, topComponent = componentName, screenBounds = taskBounds, originalScreenBounds = taskBounds, ) } Loading @@ -159,7 +159,7 @@ class PolicyRequestProcessor( bitmap = screenshot, userHandle = owner, topComponent = componentName, screenBounds = Rect(0, 0, screenshot?.width ?: 0, screenshot?.height ?: 0), originalScreenBounds = Rect(0, 0, screenshot?.width ?: 0, screenshot?.height ?: 0), taskId = taskId ?: -1, ) } Loading
packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotDataTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -53,8 +53,8 @@ class ScreenshotDataTest { assertThat(data.source).isEqualTo(source) assertThat(data.type).isEqualTo(type) assertThat(data.screenBounds).isEqualTo(bounds) assertThat(data.insets).isEqualTo(insets) assertThat(data.originalScreenBounds).isEqualTo(bounds) assertThat(data.originalInsets).isEqualTo(insets) assertThat(data.taskId).isEqualTo(taskId) assertThat(data.userHandle).isEqualTo(UserHandle.of(userId)) assertThat(data.topComponent).isEqualTo(component) Loading