diff options
author | Wale Ogunwale <ogunwale@google.com> | 2014-11-20 11:42:38 -0800 |
---|---|---|
committer | Wale Ogunwale <ogunwale@google.com> | 2014-11-26 13:40:52 -0800 |
commit | 361ca21acc0831a9f8bbb259bb30218c252a2aa0 (patch) | |
tree | d534bb3a0ba72caf353279eeadca5d5942c08f53 /services/core/java/com/android/server/wm/DisplaySettings.java | |
parent | f17f04a51e1e0b7f16d7c53015d0a66059b80cd3 (diff) | |
download | frameworks_base-361ca21acc0831a9f8bbb259bb30218c252a2aa0.zip frameworks_base-361ca21acc0831a9f8bbb259bb30218c252a2aa0.tar.gz frameworks_base-361ca21acc0831a9f8bbb259bb30218c252a2aa0.tar.bz2 |
Added unique id to display devices and their settings.
The display setting saved to disk were using a localized name for
the key. This is an issue if the user changes languages after the
display settings have been saved. We now use the non-localized
name for the display to access the settings if it is available,
else we fall back on the localized name.
Bug: 18190800
Change-Id: I837c06a8935df10727229a1aa2bb6eeb3953707f
Diffstat (limited to 'services/core/java/com/android/server/wm/DisplaySettings.java')
-rw-r--r-- | services/core/java/com/android/server/wm/DisplaySettings.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/wm/DisplaySettings.java b/services/core/java/com/android/server/wm/DisplaySettings.java index 34d1a64..ba995f2 100644 --- a/services/core/java/com/android/server/wm/DisplaySettings.java +++ b/services/core/java/com/android/server/wm/DisplaySettings.java @@ -16,7 +16,6 @@ package com.android.server.wm; -import android.content.Context; import android.graphics.Rect; import android.os.Environment; import android.util.AtomicFile; @@ -41,7 +40,6 @@ import java.util.HashMap; public class DisplaySettings { private static final String TAG = WindowManagerService.TAG; - private final Context mContext; private final AtomicFile mFile; private final HashMap<String, Entry> mEntries = new HashMap<String, Entry>(); @@ -57,15 +55,19 @@ public class DisplaySettings { } } - public DisplaySettings(Context context) { - mContext = context; + public DisplaySettings() { File dataDir = Environment.getDataDirectory(); File systemDir = new File(dataDir, "system"); mFile = new AtomicFile(new File(systemDir, "display_settings.xml")); } - public void getOverscanLocked(String name, Rect outRect) { - Entry entry = mEntries.get(name); + public void getOverscanLocked(String name, String uniqueId, Rect outRect) { + // Try to get the entry with the unique if possible. + // Else, fall back on the display name. + Entry entry; + if (uniqueId == null || (entry = mEntries.get(uniqueId)) == null) { + entry = mEntries.get(name); + } if (entry != null) { outRect.left = entry.overscanLeft; outRect.top = entry.overscanTop; @@ -110,7 +112,7 @@ public class DisplaySettings { int type; while ((type = parser.next()) != XmlPullParser.START_TAG && type != XmlPullParser.END_DOCUMENT) { - ; + // Do nothing. } if (type != XmlPullParser.START_TAG) { |