From 682422248cc350b9fa0db11b5701b987310bc3d7 Mon Sep 17 00:00:00 2001 From: ZhaoPengyuan Date: Tue, 8 Sep 2020 21:50:06 +0800 Subject: [PATCH] windows:set the window reserved area avoid set window to the edge of the screen --- .../com/android/server/am/TaskRecord.java | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java index b030d506..2f552165 100755 --- a/services/core/java/com/android/server/am/TaskRecord.java +++ b/services/core/java/com/android/server/am/TaskRecord.java @@ -1574,36 +1574,34 @@ final class TaskRecord { Rect updateOverrideConfigurationFromLaunchBounds(boolean defaultBounds) { Rect oriBounds; - int reserved = 20; - int width = 1920 - reserved; - int height = 1080 - 40 - reserved; // 40 means the height of mission Board + int reserved = 10; + int height = 1080 - 40 - 2 * reserved; // 40 means the height of mission Board + int width = 1920 - 40 - 2 * reserved; // maybe mission Board is set to left or right if (defaultBounds) { oriBounds = validateBounds(getLaunchBounds()); - - if (oriBounds == null) { - } else if (oriBounds.height() >= height || oriBounds.width() >= width) { - oriBounds.offsetTo(0, 0); - } else { - int level =10; - int cnt = (int)(System.currentTimeMillis() % level); - - int offsetY = (height - oriBounds.height()) / level * cnt; - int offsetX = (width - oriBounds.width()) / level * cnt; - oriBounds.offsetTo(offsetX, offsetY); - } } else { int left = 300; int top = 300; int right = left + 960; int bottom = top + 540 + 42; oriBounds = new Rect(left, top, right, bottom); + } + + if (oriBounds != null) { + int level = 10; + int offsetY = 0; + int offsetX = 0; - int level =10; - int cnt = (int)(System.currentTimeMillis() % level); + if (oriBounds.height() < height) { + int cntY = (int)(System.currentTimeMillis() % level); + offsetY = reserved + (height - oriBounds.height()) / level * cntY; + } - int offsetY = (height - oriBounds.height()) / level * cnt; - int offsetX = (width - oriBounds.width()) / level * cnt; + if (oriBounds.width() < width) { + int cntX = (int)(System.currentTimeMillis() % level); + offsetX = reserved + (width - oriBounds.width()) / level * cntX; + } oriBounds.offsetTo(offsetX, offsetY); } -- Gitee