Merge "Use application context getting secondary displays." into oc-dev

am: 456882b5ae

Change-Id: Ib45a340b34f11f0112c91893893f32e0a849cf93
This commit is contained in:
Bryce Lee
2017-05-10 19:22:15 +00:00
committed by android-build-merger

View File

@@ -340,7 +340,12 @@ public final class DisplayManager {
private Display getOrCreateDisplayLocked(int displayId, boolean assumeValid) {
Display display = mDisplays.get(displayId);
if (display == null) {
display = mGlobal.getCompatibleDisplay(displayId, mContext.getResources());
// TODO: We cannot currently provide any override configurations for metrics on displays
// other than the display the context is associated with.
final Context context = mContext.getDisplay().getDisplayId() == displayId
? mContext : mContext.getApplicationContext();
display = mGlobal.getCompatibleDisplay(displayId, context.getResources());
if (display != null) {
mDisplays.put(displayId, display);
}