use of android.view.CompatibilityInfoHolder in project android_frameworks_base by ParanoidAndroid.
the class ActivityThread method getDisplayMetricsLocked.
DisplayMetrics getDisplayMetricsLocked(int displayId, CompatibilityInfo ci) {
boolean isDefaultDisplay = (displayId == Display.DEFAULT_DISPLAY);
DisplayMetrics dm = isDefaultDisplay ? mDefaultDisplayMetrics.get(ci) : null;
if (dm != null) {
return dm;
}
dm = new DisplayMetrics();
DisplayManagerGlobal displayManager = DisplayManagerGlobal.getInstance();
if (displayManager == null) {
// may be null early in system startup
dm.setToDefaults();
return dm;
}
if (isDefaultDisplay) {
mDefaultDisplayMetrics.put(ci, dm);
}
CompatibilityInfoHolder cih = new CompatibilityInfoHolder();
cih.set(ci);
Display d = displayManager.getCompatibleDisplay(displayId, cih);
if (d != null) {
d.getMetrics(dm);
} else {
// Display no longer exists
// FIXME: This would not be a problem if we kept the Display object around
// instead of using the raw display id everywhere. The Display object caches
// its information even after the display has been removed.
dm.setToDefaults();
}
// + " xdpi=" + metrics.xdpi + " ydpi=" + metrics.ydpi);
return dm;
}
use of android.view.CompatibilityInfoHolder in project android_frameworks_base by ParanoidAndroid.
the class ContextImpl method createDisplayContext.
@Override
public Context createDisplayContext(Display display) {
if (display == null) {
throw new IllegalArgumentException("display must not be null");
}
int displayId = display.getDisplayId();
CompatibilityInfo ci = CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO;
CompatibilityInfoHolder cih = getCompatibilityInfo(displayId);
if (cih != null) {
ci = cih.get();
}
ContextImpl context = new ContextImpl();
context.init(mPackageInfo, null, mMainThread);
context.mDisplay = display;
context.mResources = mMainThread.getTopLevelResources(mPackageInfo.getResDir(), displayId, null, ci);
return context;
}
Aggregations