From 0a012ba55dd79dfe087ad4bff46656283cb0b4a4 Mon Sep 17 00:00:00 2001 From: Filip Gruszczynski Date: Mon, 13 Jul 2015 15:00:11 -0700 Subject: [PATCH] Delete overscan setting by both unique id and name. When overscan with only zeros is set, it removes an entry by display's unique identifier. It turns out in the past the readable name must have been used in the past and there is a lingering value in the xml file. This CL purges also the display name entry. Bug: 22357152 Change-Id: Ie2daf76677eb96df474acb546491194d0aaf8bc0 --- .../java/com/android/server/wm/DisplaySettings.java | 11 +++++++---- .../com/android/server/wm/WindowManagerService.java | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplaySettings.java b/services/core/java/com/android/server/wm/DisplaySettings.java index ba995f22b3b44..547d0fb1e31cd 100644 --- a/services/core/java/com/android/server/wm/DisplaySettings.java +++ b/services/core/java/com/android/server/wm/DisplaySettings.java @@ -78,17 +78,20 @@ public class DisplaySettings { } } - public void setOverscanLocked(String name, int left, int top, int right, int bottom) { + public void setOverscanLocked(String uniqueId, String name, int left, int top, int right, + int bottom) { if (left == 0 && top == 0 && right == 0 && bottom == 0) { // Right now all we are storing is overscan; if there is no overscan, // we have no need for the entry. + mEntries.remove(uniqueId); + // Legacy name might have been in used, so we need to clear it. mEntries.remove(name); return; } - Entry entry = mEntries.get(name); + Entry entry = mEntries.get(uniqueId); if (entry == null) { - entry = new Entry(name); - mEntries.put(name, entry); + entry = new Entry(uniqueId); + mEntries.put(uniqueId, entry); } entry.overscanLeft = left; entry.overscanTop = top; diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index a1b74fded3f6d..83ebfa4cb4013 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -8541,7 +8541,8 @@ public class WindowManagerService extends IWindowManager.Stub displayInfo.overscanBottom = bottom; } - mDisplaySettings.setOverscanLocked(displayInfo.uniqueId, left, top, right, bottom); + mDisplaySettings.setOverscanLocked(displayInfo.uniqueId, displayInfo.name, left, top, + right, bottom); mDisplaySettings.writeSettingsLocked(); reconfigureDisplayLocked(displayContent);