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 /core/java/android/view/DisplayInfo.java | |
| parent | f17f04a51e1e0b7f16d7c53015d0a66059b80cd3 (diff) | |
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 'core/java/android/view/DisplayInfo.java')
| -rw-r--r-- | core/java/android/view/DisplayInfo.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java index 56a05fe8dfb9..9feb681a6852 100644 --- a/core/java/android/view/DisplayInfo.java +++ b/core/java/android/view/DisplayInfo.java @@ -59,6 +59,11 @@ public final class DisplayInfo implements Parcelable { public String name; /** + * Unique identifier for the display. Shouldn't be displayed to the user. + */ + public String uniqueId; + + /** * The width of the portion of the display that is available to applications, in pixels. * Represents the size of the display minus any system decorations. */ @@ -257,7 +262,7 @@ public final class DisplayInfo implements Parcelable { && flags == other.flags && type == other.type && Objects.equal(address, other.address) - && Objects.equal(name, other.name) + && Objects.equal(uniqueId, other.uniqueId) && appWidth == other.appWidth && appHeight == other.appHeight && smallestNominalAppWidth == other.smallestNominalAppWidth @@ -293,6 +298,7 @@ public final class DisplayInfo implements Parcelable { type = other.type; address = other.address; name = other.name; + uniqueId = other.uniqueId; appWidth = other.appWidth; appHeight = other.appHeight; smallestNominalAppWidth = other.smallestNominalAppWidth; @@ -348,6 +354,7 @@ public final class DisplayInfo implements Parcelable { state = source.readInt(); ownerUid = source.readInt(); ownerPackageName = source.readString(); + uniqueId = source.readString(); } @Override @@ -380,6 +387,7 @@ public final class DisplayInfo implements Parcelable { dest.writeInt(state); dest.writeInt(ownerUid); dest.writeString(ownerPackageName); + dest.writeString(uniqueId); } @Override @@ -445,6 +453,8 @@ public final class DisplayInfo implements Parcelable { StringBuilder sb = new StringBuilder(); sb.append("DisplayInfo{\""); sb.append(name); + sb.append("\", uniqueId \""); + sb.append(uniqueId); sb.append("\", app "); sb.append(appWidth); sb.append(" x "); |
