Loading libs/WindowManager/Shell/tests/e2e/splitscreen/flicker-legacy/src/com/android/wm/shell/flicker/splitscreen/CopyContentInSplit.kt +1 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ class CopyContentInSplit(override val flicker: LegacyFlickerTest) : listOf( ComponentNameMatcher.SPLASH_SCREEN, ComponentNameMatcher.SNAPSHOT, ComponentNameMatcher.IME_SNAPSHOT, ComponentNameMatcher.IME_SCREENSHOT, magnifierLayer, popupWindowLayer ) Loading services/core/java/com/android/server/wm/AbsAppSnapshotController.java +6 −6 Original line number Diff line number Diff line Loading @@ -319,7 +319,7 @@ abstract class AbsAppSnapshotController<TYPE extends WindowContainer, @VisibleForTesting @Nullable Rect prepareTaskSnapshot(TYPE source, TaskSnapshot.Builder builder) { final Pair<ActivityRecord, WindowState> result = checkIfReadyToSnapshot(source); final Pair<ActivityRecord, WindowState> result = checkIfReadyToScreenshot(source); if (result == null) { return null; } Loading Loading @@ -379,14 +379,14 @@ abstract class AbsAppSnapshotController<TYPE extends WindowContainer, } /** * Check if the state of the Task is appropriate to capture a snapshot, such like the task * snapshot or the associated IME surface snapshot. * Check if the state of the Task is appropriate to capture a screenshot, such like the task * snapshot or the associated IME screenshot. * * @param source the target object to capture the snapshot * @param source the target object to capture the screenshot * @return Pair of (the top activity of the task, the main window of the task) if passed the * state checking. Returns {@code null} if the task state isn't ready to snapshot. * state checking. Returns {@code null} if the task state isn't ready to screenshot. */ Pair<ActivityRecord, WindowState> checkIfReadyToSnapshot(TYPE source) { Pair<ActivityRecord, WindowState> checkIfReadyToScreenshot(TYPE source) { if (!mService.mPolicy.isScreenOn()) { if (DEBUG_SCREENSHOT) { Slog.i(TAG_WM, "Attempted to take screenshot while display was off."); Loading services/core/java/com/android/server/wm/DisplayContent.java +20 −17 Original line number Diff line number Diff line Loading @@ -4500,6 +4500,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp static final class ImeScreenshot { /** The name of the IME screenshot surface. */ private static final String SURFACE_NAME = "IME-screenshot-surface"; @NonNull private final WindowState mImeTarget; Loading Loading @@ -4541,19 +4544,18 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp private SurfaceControl createSurface(@NonNull ScreenCapture.ScreenshotHardwareBuffer b, @NonNull Transaction t) { final HardwareBuffer buffer = b.getHardwareBuffer(); ProtoLog.i(WM_DEBUG_IME, "create IME snapshot for %s, buff width=%s, height=%s", ProtoLog.i(WM_DEBUG_IME, "create IME screenshot for %s, buff width=%s, height=%s", mImeTarget, buffer.getWidth(), buffer.getHeight()); final String name = "IME-snapshot-surface"; final WindowState imeWindow = mImeTarget.getDisplayContent().mInputMethodWindow; final ActivityRecord activity = mImeTarget.mActivityRecord; final SurfaceControl parent = mImeTarget.mAttrs.type == TYPE_BASE_APPLICATION ? activity.getSurfaceControl() : mImeTarget.getSurfaceControl(); final SurfaceControl surface = mSurfaceBuilder .setName(name) .setName(SURFACE_NAME) .setBLASTLayer() .setFormat(buffer.getFormat()) // Attaching IME snapshot to the associated IME layering target on the // Attaching IME screenshot to the associated IME layering target on the // activity when: // - The target is activity main window: attaching on top of the activity. // - The target is non-activity main window (e.g. activity overlay or Loading @@ -4562,8 +4564,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp .setParent(parent) .setCallsite("DisplayContent.attachAndShowImeScreenshotOnTarget") .build(); // Make IME snapshot as trusted overlay InputMonitor.setTrustedOverlayInputInfo(surface, t, imeWindow.getDisplayId(), name); // Make IME screenshot as trusted overlay InputMonitor.setTrustedOverlayInputInfo(surface, t, imeWindow.getDisplayId(), SURFACE_NAME); t.setBuffer(surface, buffer); t.setColorSpace(activity.getSurfaceControl(), ColorSpace.get(ColorSpace.Named.SRGB)); t.setLayer(surface, 1); Loading @@ -4577,14 +4580,14 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } t.setPosition(surface, surfacePosition.x, surfacePosition.y); mSurfacePosition = surfacePosition; ProtoLog.i(WM_DEBUG_IME, "Set IME snapshot position: (%d, %d)", surfacePosition.x, surfacePosition.y); ProtoLog.i(WM_DEBUG_IME, "Set IME screenshot surface position: (%d, %d)", surfacePosition.x, surfacePosition.y); return surface; } void removeSurface(@NonNull Transaction t) { if (mSurface != null) { ProtoLog.i(WM_DEBUG_IME, "remove IME snapshot surface, caller=%s", ProtoLog.i(WM_DEBUG_IME, "remove IME screenshot surface, caller=%s", Debug.getCallers(6)); t.remove(mSurface); mSurface = null; Loading @@ -4596,9 +4599,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } /** * Attaches the snapshot of IME (a snapshot will be taken if there wasn't one) to the IME * target task and shows it. If the given {@param anyTargetTask} is true, the snapshot won't * be skipped by the activity type of IME target task. * Attaches the screenshot of IME (a screenshot will be taken if there wasn't one) to the * IME target task and shows it. If the given {@param anyTargetTask} is true, the screenshot * won't be skipped by the activity type of IME target task. */ void attachAndShow(@NonNull Transaction t, boolean anyTargetTask) { final DisplayContent dc = mImeTarget.getDisplayContent(); Loading @@ -4612,7 +4615,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // home/recents won't appear in recents task. if (task != null && (anyTargetTask || !task.isActivityTypeHomeOrRecents())) { final ScreenCapture.ScreenshotHardwareBuffer buffer = renewSurface ? dc.mWmService.mTaskSnapshotController.snapshotImeFromAttachedTask(task) ? dc.mWmService.mTaskSnapshotController.screenshotImeFromAttachedTask(task) : null; if (buffer != null) { // Remove the last surface when the surface needs to renew. Loading @@ -4625,7 +4628,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Note that if the current IME insets is not showing, no need to show IME screenshot // to reflect the true IME insets visibility and the app task layout as possible. if (isValid && dc.getInsetsStateController().getImeSourceProvider().isImeShowing()) { ProtoLog.i(WM_DEBUG_IME, "show IME snapshot, ime target=%s, callers=%s", ProtoLog.i(WM_DEBUG_IME, "show IME screenshot, ime target=%s, callers=%s", mImeTarget, Debug.getCallers(6)); t.show(mSurface); if (DEBUG_IME_VISIBILITY) { Loading Loading @@ -4662,17 +4665,17 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp private void attachImeScreenshotOnTarget(@NonNull WindowState imeTarget, boolean hideImeWindow) { final SurfaceControl.Transaction t = getPendingTransaction(); // Remove the old IME snapshot first in case the new snapshot happens to // Remove the old IME screenshot first in case the new screenshot happens to // override the current one before the transition finish and the surface never be // removed on the task. removeImeScreenshotImmediately(); mImeScreenshot = new ImeScreenshot(imeTarget, mWmService.mSurfaceControlFactory.get()); // If the caller requests to hide IME, then allow to show IME snapshot for any target // If the caller requests to hide IME, then allow to show IME screenshot for any target // task. So IME won't look like it suddenly disappeared. It usually happens when turning // the screen off. mImeScreenshot.attachAndShow(t, hideImeWindow /* anyTargetTask */); if (mInputMethodWindow != null && hideImeWindow) { // Hide the IME window when deciding to show IME snapshot on demand. // Hide the IME window when deciding to show IME screenshot on demand. // InsetsController will make IME visible again before animating it. mInputMethodWindow.hide(false, false); } Loading services/core/java/com/android/server/wm/EventLogTags.logtags +2 −2 Original line number Diff line number Diff line Loading @@ -77,9 +77,9 @@ option java_package com.android.server.wm # IME surface parent is updated. 32003 imf_update_ime_parent (surface name|3) # IME snapshot is shown. # IME screenshot is shown. 32004 imf_show_ime_screenshot (target window|3),(transition|1),(surface position|3) # IME snapshot is hidden. # IME screenshot is hidden. 32005 imf_remove_ime_screenshot (target window|3) # Request surface flinger to show / hide the wallpaper surface. Loading services/core/java/com/android/server/wm/InputMonitor.java +2 −2 Original line number Diff line number Diff line Loading @@ -438,8 +438,8 @@ final class InputMonitor { SoftInputShowHideReason.HIDE_RECENTS_ANIMATION, mDisplayContent.getDisplayId()); } // Ensure removing the IME snapshot when the app no longer to show on the // task snapshot (also taking the new task snaphot to update the overview). // Ensure removing the IME screenshot when the app no longer to show on the // task snapshot (also taking the new task snapshot to update the overview). final ActivityRecord app = mDisplayContent.getImeInputTarget() != null ? mDisplayContent.getImeInputTarget().getActivityRecord() : null; if (app != null) { Loading Loading
libs/WindowManager/Shell/tests/e2e/splitscreen/flicker-legacy/src/com/android/wm/shell/flicker/splitscreen/CopyContentInSplit.kt +1 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ class CopyContentInSplit(override val flicker: LegacyFlickerTest) : listOf( ComponentNameMatcher.SPLASH_SCREEN, ComponentNameMatcher.SNAPSHOT, ComponentNameMatcher.IME_SNAPSHOT, ComponentNameMatcher.IME_SCREENSHOT, magnifierLayer, popupWindowLayer ) Loading
services/core/java/com/android/server/wm/AbsAppSnapshotController.java +6 −6 Original line number Diff line number Diff line Loading @@ -319,7 +319,7 @@ abstract class AbsAppSnapshotController<TYPE extends WindowContainer, @VisibleForTesting @Nullable Rect prepareTaskSnapshot(TYPE source, TaskSnapshot.Builder builder) { final Pair<ActivityRecord, WindowState> result = checkIfReadyToSnapshot(source); final Pair<ActivityRecord, WindowState> result = checkIfReadyToScreenshot(source); if (result == null) { return null; } Loading Loading @@ -379,14 +379,14 @@ abstract class AbsAppSnapshotController<TYPE extends WindowContainer, } /** * Check if the state of the Task is appropriate to capture a snapshot, such like the task * snapshot or the associated IME surface snapshot. * Check if the state of the Task is appropriate to capture a screenshot, such like the task * snapshot or the associated IME screenshot. * * @param source the target object to capture the snapshot * @param source the target object to capture the screenshot * @return Pair of (the top activity of the task, the main window of the task) if passed the * state checking. Returns {@code null} if the task state isn't ready to snapshot. * state checking. Returns {@code null} if the task state isn't ready to screenshot. */ Pair<ActivityRecord, WindowState> checkIfReadyToSnapshot(TYPE source) { Pair<ActivityRecord, WindowState> checkIfReadyToScreenshot(TYPE source) { if (!mService.mPolicy.isScreenOn()) { if (DEBUG_SCREENSHOT) { Slog.i(TAG_WM, "Attempted to take screenshot while display was off."); Loading
services/core/java/com/android/server/wm/DisplayContent.java +20 −17 Original line number Diff line number Diff line Loading @@ -4500,6 +4500,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp static final class ImeScreenshot { /** The name of the IME screenshot surface. */ private static final String SURFACE_NAME = "IME-screenshot-surface"; @NonNull private final WindowState mImeTarget; Loading Loading @@ -4541,19 +4544,18 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp private SurfaceControl createSurface(@NonNull ScreenCapture.ScreenshotHardwareBuffer b, @NonNull Transaction t) { final HardwareBuffer buffer = b.getHardwareBuffer(); ProtoLog.i(WM_DEBUG_IME, "create IME snapshot for %s, buff width=%s, height=%s", ProtoLog.i(WM_DEBUG_IME, "create IME screenshot for %s, buff width=%s, height=%s", mImeTarget, buffer.getWidth(), buffer.getHeight()); final String name = "IME-snapshot-surface"; final WindowState imeWindow = mImeTarget.getDisplayContent().mInputMethodWindow; final ActivityRecord activity = mImeTarget.mActivityRecord; final SurfaceControl parent = mImeTarget.mAttrs.type == TYPE_BASE_APPLICATION ? activity.getSurfaceControl() : mImeTarget.getSurfaceControl(); final SurfaceControl surface = mSurfaceBuilder .setName(name) .setName(SURFACE_NAME) .setBLASTLayer() .setFormat(buffer.getFormat()) // Attaching IME snapshot to the associated IME layering target on the // Attaching IME screenshot to the associated IME layering target on the // activity when: // - The target is activity main window: attaching on top of the activity. // - The target is non-activity main window (e.g. activity overlay or Loading @@ -4562,8 +4564,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp .setParent(parent) .setCallsite("DisplayContent.attachAndShowImeScreenshotOnTarget") .build(); // Make IME snapshot as trusted overlay InputMonitor.setTrustedOverlayInputInfo(surface, t, imeWindow.getDisplayId(), name); // Make IME screenshot as trusted overlay InputMonitor.setTrustedOverlayInputInfo(surface, t, imeWindow.getDisplayId(), SURFACE_NAME); t.setBuffer(surface, buffer); t.setColorSpace(activity.getSurfaceControl(), ColorSpace.get(ColorSpace.Named.SRGB)); t.setLayer(surface, 1); Loading @@ -4577,14 +4580,14 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } t.setPosition(surface, surfacePosition.x, surfacePosition.y); mSurfacePosition = surfacePosition; ProtoLog.i(WM_DEBUG_IME, "Set IME snapshot position: (%d, %d)", surfacePosition.x, surfacePosition.y); ProtoLog.i(WM_DEBUG_IME, "Set IME screenshot surface position: (%d, %d)", surfacePosition.x, surfacePosition.y); return surface; } void removeSurface(@NonNull Transaction t) { if (mSurface != null) { ProtoLog.i(WM_DEBUG_IME, "remove IME snapshot surface, caller=%s", ProtoLog.i(WM_DEBUG_IME, "remove IME screenshot surface, caller=%s", Debug.getCallers(6)); t.remove(mSurface); mSurface = null; Loading @@ -4596,9 +4599,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } /** * Attaches the snapshot of IME (a snapshot will be taken if there wasn't one) to the IME * target task and shows it. If the given {@param anyTargetTask} is true, the snapshot won't * be skipped by the activity type of IME target task. * Attaches the screenshot of IME (a screenshot will be taken if there wasn't one) to the * IME target task and shows it. If the given {@param anyTargetTask} is true, the screenshot * won't be skipped by the activity type of IME target task. */ void attachAndShow(@NonNull Transaction t, boolean anyTargetTask) { final DisplayContent dc = mImeTarget.getDisplayContent(); Loading @@ -4612,7 +4615,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // home/recents won't appear in recents task. if (task != null && (anyTargetTask || !task.isActivityTypeHomeOrRecents())) { final ScreenCapture.ScreenshotHardwareBuffer buffer = renewSurface ? dc.mWmService.mTaskSnapshotController.snapshotImeFromAttachedTask(task) ? dc.mWmService.mTaskSnapshotController.screenshotImeFromAttachedTask(task) : null; if (buffer != null) { // Remove the last surface when the surface needs to renew. Loading @@ -4625,7 +4628,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Note that if the current IME insets is not showing, no need to show IME screenshot // to reflect the true IME insets visibility and the app task layout as possible. if (isValid && dc.getInsetsStateController().getImeSourceProvider().isImeShowing()) { ProtoLog.i(WM_DEBUG_IME, "show IME snapshot, ime target=%s, callers=%s", ProtoLog.i(WM_DEBUG_IME, "show IME screenshot, ime target=%s, callers=%s", mImeTarget, Debug.getCallers(6)); t.show(mSurface); if (DEBUG_IME_VISIBILITY) { Loading Loading @@ -4662,17 +4665,17 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp private void attachImeScreenshotOnTarget(@NonNull WindowState imeTarget, boolean hideImeWindow) { final SurfaceControl.Transaction t = getPendingTransaction(); // Remove the old IME snapshot first in case the new snapshot happens to // Remove the old IME screenshot first in case the new screenshot happens to // override the current one before the transition finish and the surface never be // removed on the task. removeImeScreenshotImmediately(); mImeScreenshot = new ImeScreenshot(imeTarget, mWmService.mSurfaceControlFactory.get()); // If the caller requests to hide IME, then allow to show IME snapshot for any target // If the caller requests to hide IME, then allow to show IME screenshot for any target // task. So IME won't look like it suddenly disappeared. It usually happens when turning // the screen off. mImeScreenshot.attachAndShow(t, hideImeWindow /* anyTargetTask */); if (mInputMethodWindow != null && hideImeWindow) { // Hide the IME window when deciding to show IME snapshot on demand. // Hide the IME window when deciding to show IME screenshot on demand. // InsetsController will make IME visible again before animating it. mInputMethodWindow.hide(false, false); } Loading
services/core/java/com/android/server/wm/EventLogTags.logtags +2 −2 Original line number Diff line number Diff line Loading @@ -77,9 +77,9 @@ option java_package com.android.server.wm # IME surface parent is updated. 32003 imf_update_ime_parent (surface name|3) # IME snapshot is shown. # IME screenshot is shown. 32004 imf_show_ime_screenshot (target window|3),(transition|1),(surface position|3) # IME snapshot is hidden. # IME screenshot is hidden. 32005 imf_remove_ime_screenshot (target window|3) # Request surface flinger to show / hide the wallpaper surface. Loading
services/core/java/com/android/server/wm/InputMonitor.java +2 −2 Original line number Diff line number Diff line Loading @@ -438,8 +438,8 @@ final class InputMonitor { SoftInputShowHideReason.HIDE_RECENTS_ANIMATION, mDisplayContent.getDisplayId()); } // Ensure removing the IME snapshot when the app no longer to show on the // task snapshot (also taking the new task snaphot to update the overview). // Ensure removing the IME screenshot when the app no longer to show on the // task snapshot (also taking the new task snapshot to update the overview). final ActivityRecord app = mDisplayContent.getImeInputTarget() != null ? mDisplayContent.getImeInputTarget().getActivityRecord() : null; if (app != null) { Loading